MCPcopy Create free account
hub / github.com/apache/cloudstack / process

Method process

systemvm/debian/opt/cloud/bin/configure.py:1219–1255  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1217 VPNCONFDIR = "/etc/ipsec.d"
1218
1219 def process(self):
1220 self.confips = []
1221
1222 logging.debug(self.dbag)
1223
1224 for public_ip in self.dbag:
1225 if public_ip == "id":
1226 continue
1227 vpnconfig = self.dbag[public_ip]
1228
1229 # Enable remote access vpn
1230 if vpnconfig['create']:
1231 logging.debug("Enabling remote access vpn on " + public_ip)
1232
1233 CsHelper.start_if_stopped("ipsec")
1234
1235 logging.debug("Remote accessvpn data bag %s", self.dbag)
1236 config_changed = False
1237 if not self.config.has_public_network():
1238 interface = self.config.address().get_guest_if_by_network_id()
1239 if interface:
1240 config_changed = self.configure_l2tpIpsec(interface.get_ip(), self.dbag[public_ip])
1241 self.remoteaccessvpn_iptables(interface.get_device(), interface.get_ip(), self.dbag[public_ip])
1242 else:
1243 config_changed = self.configure_l2tpIpsec(public_ip, self.dbag[public_ip])
1244 self.remoteaccessvpn_iptables(self.dbag[public_ip]['public_interface'], public_ip, self.dbag[public_ip])
1245
1246 CsHelper.execute("ipsec update")
1247 if config_changed:
1248 CsHelper.execute("systemctl restart xl2tpd")
1249 else:
1250 CsHelper.execute("systemctl start xl2tpd")
1251 CsHelper.execute("ipsec rereadsecrets")
1252 else:
1253 logging.debug("Disabling remote access vpn .....")
1254 CsHelper.execute("ipsec down L2TP-PSK")
1255 CsHelper.execute("systemctl stop xl2tpd")
1256
1257 def configure_l2tpIpsec(self, left, obj):
1258 l2tpconffile = "%s/l2tp.conf" % (self.VPNCONFDIR)

Callers 1

processMethod · 0.95

Calls 9

configure_l2tpIpsecMethod · 0.95
debugMethod · 0.80
has_public_networkMethod · 0.80
addressMethod · 0.80
get_deviceMethod · 0.80
executeMethod · 0.65
get_ipMethod · 0.45

Tested by

no test coverage detected