Cleanup VPN synchronizer
diff --git a/xos/configurations/devel/docker-compose.yml b/xos/configurations/devel/docker-compose.yml
index d7958a9..d8d652f 100644
--- a/xos/configurations/devel/docker-compose.yml
+++ b/xos/configurations/devel/docker-compose.yml
@@ -29,7 +29,6 @@
- ctl:${MYIP}
volumes:
- ../setup/id_rsa:/opt/xos/synchronizers/vpn/vpn_private_key:ro # private key
- - ../../core/static/vpn:/opt/xos/core/static/vpn:rw
# FUTURE
#xos_swarm_synchronizer:
diff --git a/xos/synchronizers/vpn/steps/sync_vpntenant.py b/xos/synchronizers/vpn/steps/sync_vpntenant.py
index c7ae5e3..483e1c7 100644
--- a/xos/synchronizers/vpn/steps/sync_vpntenant.py
+++ b/xos/synchronizers/vpn/steps/sync_vpntenant.py
@@ -41,58 +41,8 @@
}
def run_playbook(self, o, fields):
- self.create_client_script(o)
# Generate the server files
(stdout, stderr) = Popen("/opt/openvpn/easyrsa3/easyrsa --batch build-server-full server" + o.instance.instance_id + " nopass",shell=True, stdout=PIPE).communicate()
print(str(stdout))
print(str(stderr))
super(SyncVPNTenant, self).run_playbook(o, fields)
-
- def create_client_script(self, tenant):
- script = open("/opt/xos/core/static/vpn/" + str(tenant.script), 'w')
- # write the configuration portion
- script.write("printf \"%b\" \"")
- for line in self.generate_client_conf(tenant).splitlines():
- script.write(line + r"\n")
- script.write("\" > client.conf\n")
- script.write("printf \"%b\" \"")
- for line in self.generate_login().splitlines():
- script.write(line + r"\n")
- script.write("\" > login.up\n")
- script.write("printf \"%b\" \"")
- for line in tenant.ca_crt:
- script.write(line.rstrip() + r"\n")
- script.write("\" > ca.crt\n")
- # make sure openvpn is installed
- script.write("apt-get update\n")
- script.write("apt-get install openvpn\n")
- script.write("openvpn client.conf &\n")
- # close the script
- script.close()
-
- def generate_login(self):
- return str(time.time()) + "\npassword\n"
-
- def generate_client_conf(self, tenant):
- """str: Generates the client configuration to use to connect to this VPN server.
-
- Args:
- tenant (VPNTenant): The tenant to generate the client configuration for.
-
- """
- conf = ("client\n" +
- "auth-user-pass login.up\n" +
- "dev tun\n" +
- "proto udp\n" +
- "remote " + str(tenant.nat_ip) + " 1194\n" +
- "resolv-retry infinite\n" +
- "nobind\n" +
- "ca ca.crt\n" +
- "comp-lzo\n" +
- "verb 3\n")
-
- if tenant.is_persistent:
- conf += "persist-tun\n"
- conf += "persist-key\n"
-
- return conf