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

Fixed port declaration in openvpn

parent 849e2929
To be done :
The address of the client is declared while it should only be the address
of the server
of the server
Upgrade the logging function in order to be able to log message like
"Refreshing peers DB ... done", or add log messages to specify that an
......@@ -11,7 +11,7 @@ To be done :
Use an algorithm to choose which connections to keep and/or establish
instead of pure randomness
|-> number of routes / tunnel
|-> number of routes / tunnel
|-> favorise most used roads ?
Replace comments at the beginning of functions with docstrings & give all
......
......@@ -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