Commit 13996eca authored by Guillaume Bury's avatar Guillaume Bury

Cleaned project + replaced calls with popen

parent 51bf0f51
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import argparse, errno, os, subprocess, sys, time import argparse, errno, os, subprocess, sys, time
import upnpigd import upnpigd
VIFIB_NET = "2001:db8:42::/48"
def openvpn(*args, **kw): def openvpn(*args, **kw):
args = ['openvpn', args = ['openvpn',
'--dev', 'tap', '--dev', 'tap',
...@@ -38,8 +40,42 @@ def server(*args, **kw): ...@@ -38,8 +40,42 @@ def server(*args, **kw):
def client(ip, *args, **kw): def client(ip, *args, **kw):
return openvpn(remote=ip, *args, **kw) return openvpn(remote=ip, *args, **kw)
# How do we get our vifib_ip ?
def babel(network_ip, network_mask, verbose_level):
args = [ '-S', '/var/lib/babeld/state',
'-I', 'redistribute local ip %s/%s' % (network_ip,network_mask),
'-I', 'redistribute local deny',
# Route VIFIB ip adresses
'-I', 'in ip %s' % VIFIB_NET,
# Route only addresse in the 'local' network,
# or other entire networks
#'-I', 'in ip %s/%s' % (network_ip,network_mask),
#'-I', 'in ip ::/0 le %s' % network_mask,
# Don't route other addresses
'-I', 'in ip deny',
'-d', str(verbose_level),
'-s'
]
return Popen(args)
def main(): def main():
server = openvpn.server(dev="server", verb=3 ) parser = argparse.ArgumentParser(
description="Resilient virtual private network application")
_ = parser.add_argument
_('--ca', required=True,
help="Path to ca.crt file")
_('--cert', required=True,
help="Path to host certificate file")
_('--key', required=True,
help="Path to host key file")
_('--dh', required=True,
help="Path to dh file")
_('--verbose', '-v', action='count',
help="Defines the verbose level")
args=parser.parse_args()
# how to setup openvpn connections :
server = server(dev='server', verb=3)
pass pass
if __name__ == "__main__": if __name__ == "__main__":
......
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