Class OpenVpnService

java.lang.Object
org.eblocker.server.common.openvpn.OpenVpnService

public class OpenVpnService extends Object
This class makes all the work which is asked for by the OpenVpnController (REST Interface). It will trigger/tell the other objects to adapt the firewall configuration, rewrite squids config and so on...
  • Constructor Details

  • Method Details

    • init

      public void init()
    • getVpnProfiles

      public Collection<VpnProfile> getVpnProfiles()
      Get all VPN profiles
      Returns:
      Collection of VpnProfile objects with masked passwords.
    • saveProfile

      public OpenVpnProfile saveProfile(OpenVpnProfile profile) throws IOException
      Throws:
      IOException
    • deleteVpnProfile

      public void deleteVpnProfile(int id)
    • getProfileClientConfig

      public OpenVpnConfiguration getProfileClientConfig(int id) throws IOException
      Throws:
      IOException
    • setProfileClientConfig

      public OpenVpnConfiguration setProfileClientConfig(int id, String config) throws IOException
      Throws:
      IOException
    • setProfileClientConfigOptionFile

      public OpenVpnConfiguration setProfileClientConfigOptionFile(int id, String option, byte[] content) throws IOException
      Throws:
      IOException
    • getVpnProfileById

      public VpnProfile getVpnProfileById(int id)
      Get a VPN profile for a given ID
      Parameters:
      id -
      Returns:
      VpnProfile with masked password
    • getOpenVpnProfileById

      public OpenVpnProfile getOpenVpnProfileById(int id)
      Get a OpenVpn profile for a given ID
      Parameters:
      id -
      Returns:
      OpenVpnProfile with clear-text password
    • routeClientThroughVpnTunnel

      public void routeClientThroughVpnTunnel(Device device, VpnProfile vpnProfile)
    • restoreNormalRoutingForClient

      public void restoreNormalRoutingForClient(Device device)
      Do not route device through VpnProfile (and the VPN tunnel which belongs to this profile) anymore When this was the last device using this VPN profile, it will automatically get shutdown/stopped
      Parameters:
      device -
    • startVpn

      public void startVpn(VpnProfile profile)
    • stopVpn

      public void stopVpn(VpnProfile profile)
    • getStatus

      public VpnStatus getStatus(VpnProfile profile)
    • getStatusByDevice

      public VpnStatus getStatusByDevice(Device device)
    • getCacheCleaner

      public Runnable getCacheCleaner()
    • shutdown

      public void shutdown()