Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
re6stnet
Commits
13996eca
Commit
13996eca
authored
Jul 03, 2012
by
Guillaume Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned project + replaced calls with popen
parent
51bf0f51
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
main.py
main.py
+37
-1
No files found.
main.py
View file @
13996eca
...
...
@@ -2,6 +2,8 @@
import
argparse
,
errno
,
os
,
subprocess
,
sys
,
time
import
upnpigd
VIFIB_NET
=
"2001:db8:42::/48"
def
openvpn
(
*
args
,
**
kw
):
args
=
[
'openvpn'
,
'--dev'
,
'tap'
,
...
...
@@ -38,8 +40,42 @@ def server(*args, **kw):
def
client
(
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
():
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
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment