Class OpenVpnService
java.lang.Object
org.eblocker.server.common.openvpn.OpenVpnService
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 Summary
ConstructorsConstructorDescriptionOpenVpnService(ScriptRunner scriptRunner, DataSource dataSource, OpenVpnClientFactory openVpnClientFactory, OpenVpnConfigurator configurator, OpenVpnFileOptionValidator fileOptionValidator, String keepAliveTarget, String killAllInstancesScript, OpenVpnProfileFiles profileFiles, String passwordMask, Integer stoppedClientTimeout) -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteVpnProfile(int id) getOpenVpnProfileById(int id) Get a OpenVpn profile for a given IDgetProfileClientConfig(int id) getStatus(VpnProfile profile) getStatusByDevice(Device device) getVpnProfileById(int id) Get a VPN profile for a given IDGet all VPN profilesvoidinit()voidrestoreNormalRoutingForClient(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/stoppedvoidrouteClientThroughVpnTunnel(Device device, VpnProfile vpnProfile) saveProfile(OpenVpnProfile profile) setProfileClientConfig(int id, String config) setProfileClientConfigOptionFile(int id, String option, byte[] content) voidshutdown()voidstartVpn(VpnProfile profile) voidstopVpn(VpnProfile profile)
-
Constructor Details
-
OpenVpnService
@Inject public OpenVpnService(ScriptRunner scriptRunner, DataSource dataSource, OpenVpnClientFactory openVpnClientFactory, OpenVpnConfigurator configurator, OpenVpnFileOptionValidator fileOptionValidator, String keepAliveTarget, String killAllInstancesScript, OpenVpnProfileFiles profileFiles, String passwordMask, Integer stoppedClientTimeout)
-
-
Method Details
-
init
public void init() -
getVpnProfiles
Get all VPN profiles- Returns:
- Collection of VpnProfile objects with masked passwords.
-
saveProfile
- Throws:
IOException
-
deleteVpnProfile
public void deleteVpnProfile(int id) -
getProfileClientConfig
- Throws:
IOException
-
setProfileClientConfig
- Throws:
IOException
-
setProfileClientConfigOptionFile
public OpenVpnConfiguration setProfileClientConfigOptionFile(int id, String option, byte[] content) throws IOException - Throws:
IOException
-
getVpnProfileById
Get a VPN profile for a given ID- Parameters:
id-- Returns:
- VpnProfile with masked password
-
getOpenVpnProfileById
Get a OpenVpn profile for a given ID- Parameters:
id-- Returns:
- OpenVpnProfile with clear-text password
-
routeClientThroughVpnTunnel
-
restoreNormalRoutingForClient
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
-
stopVpn
-
getStatus
-
getStatusByDevice
-
getCacheCleaner
-
shutdown
public void shutdown()
-