Commit 01c99fa5 authored by Guillaume Bury's avatar Guillaume Bury

Fixed port declaration in openvpn

parent 849e2929
......@@ -6,7 +6,7 @@ class PeerManager:
# internal ip = temp arg/attribute
def __init__(self, db_dir_path, server, server_port, refresh_time, address,
internal_ip, prefix, manual, proto, db_size):
internal_ip, prefix, manual, proto, port , db_size):
self._refresh_time = refresh_time
self._address = address
self._internal_ip = internal_ip
......@@ -15,6 +15,7 @@ class PeerManager:
self._server_port = server_port
self._db_size = db_size
self._proto = proto
self._ovpn_port = port
self._manual = manual
self._proxy = xmlrpclib.ServerProxy('http://%s:%u'
......@@ -92,8 +93,8 @@ class PeerManager:
utils.log('%s has disconnected' % (arg,), 3)
elif script_type == 'route-up':
if not self._manual:
external_ip, external_port = arg.split(',')
new_address = list([external_ip, external_port, proto]
external_ip = arg
new_address = list([external_ip, self._ovpn_port, proto]
for proto in self._proto)
if self._address != new_address:
self._address = new_address
......
......@@ -5,4 +5,4 @@ if os.environ['script_type'] == 'up':
os.execlp('ip', 'ip', 'link', 'set', os.environ['dev'], 'up')
# Write into pipe external ip address received
os.write(int(sys.argv[1]), '%(script_type)s %(OPENVPN_external_ip)s,%(OPENVPN_external_port)s\n' % os.environ)
os.write(int(sys.argv[1]), '%(script_type)s %(OPENVPN_external_ip)s\n' % os.environ)
......@@ -49,8 +49,6 @@ if script_type == 'client-connect':
with open(sys.argv[2], 'w') as f:
f.write('push "setenv-safe external_ip %s"\n'
% os.environ['trusted_ip'])
f.write('push "setenv-safe external_port %s"\n'
% os.environ['trusted_port'])
# Write into pipe connect/disconnect events
os.write(int(sys.argv[1]), '%(script_type)s %(common_name)s\n' % os.environ)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment