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
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
nexedi
re6stnet
Commits
f9beed0c
Commit
f9beed0c
authored
Jul 04, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.erp5.org/repos/vifibnet
Conflicts: main.py
parents
bc5d0fc1
8cba4e19
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
main.py
main.py
+9
-8
openvpn.py
openvpn.py
+10
-3
No files found.
main.py
View file @
f9beed0c
...
@@ -6,7 +6,6 @@ import random
...
@@ -6,7 +6,6 @@ import random
VIFIB_NET
=
"2001:db8:42::/48"
VIFIB_NET
=
"2001:db8:42::/48"
# TODO : How do we get our vifib ip ?
# TODO : How do we get our vifib ip ?
def
babel
(
network_ip
,
network_mask
,
verbose_level
):
def
babel
(
network_ip
,
network_mask
,
verbose_level
):
...
@@ -32,13 +31,6 @@ def getConfig():
...
@@ -32,13 +31,6 @@ def getConfig():
global
config
global
config
parser
=
argparse
.
ArgumentParser
(
description
=
'Resilient virtual private network application'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Resilient virtual private network application'
)
_
=
parser
.
add_argument
_
=
parser
.
add_argument
_
(
'--dh'
,
required
=
True
,
help
=
'Path to dh file'
)
_
(
'--babel-state'
,
help
=
'Path to babeld state-file'
)
_
(
'--verbose'
,
'-v'
,
default
=
'0'
,
help
=
'Defines the verbose level'
)
_
(
'--ca'
,
required
=
True
,
help
=
'Path to the certificate authority'
)
_
(
'--key'
,
required
=
True
,
help
=
'Path to the rsa_key'
)
_
(
'--cert'
,
required
=
True
,
help
=
'Pah to the certificate'
)
# connections establishement
_
(
'--max-peer'
,
help
=
'the number of peers that can connect to the server'
,
default
=
'10'
)
_
(
'--max-peer'
,
help
=
'the number of peers that can connect to the server'
,
default
=
'10'
)
# TODO : use it
# TODO : use it
_
(
'--client-count'
,
help
=
'the number servers the peers try to connect to'
,
default
=
'2'
)
_
(
'--client-count'
,
help
=
'the number servers the peers try to connect to'
,
default
=
'2'
)
...
@@ -46,8 +38,17 @@ def getConfig():
...
@@ -46,8 +38,17 @@ def getConfig():
# TODO : use it
# TODO : use it
_
(
'--refresh-count'
,
help
=
'The number of connections to drop when refreshing the connections'
,
default
=
'1'
)
_
(
'--refresh-count'
,
help
=
'The number of connections to drop when refreshing the connections'
,
default
=
'1'
)
# TODO : use it
# TODO : use it
_
(
'--dh'
,
required
=
True
,
help
=
'Path to dh file'
)
_
(
'--babel-state'
,
help
=
'Path to babeld state-file'
)
_
(
'--verbose'
,
'-v'
,
default
=
'0'
,
help
=
'Defines the verbose level'
)
# Temporary args
# Temporary args
_
(
'--ip'
,
required
=
True
,
help
=
'IPv6 of the server'
)
_
(
'--ip'
,
required
=
True
,
help
=
'IPv6 of the server'
)
# Openvpn options
_
(
'openvpn_args'
,
nargs
=
argparse
.
REMAINDER
,
help
=
"Common OpenVPN options (e.g. certificates)"
)
config
=
parser
.
parse_args
()
config
=
parser
.
parse_args
()
def
startNewConnection
():
def
startNewConnection
():
...
...
openvpn.py
View file @
f9beed0c
import
subprocess
import
subprocess
def
openvpn
(
config
,
*
args
):
def
openvpn
(
config
,
*
args
):
args
=
[
'openvpn'
,
args
=
[
'openvpn'
,
'--dev'
,
'tap'
,
'--dev'
,
'tap'
,
'--ca'
,
config
.
ca
,
'--ca'
,
config
.
ca
,
...
@@ -12,8 +12,15 @@ def openvpn(config, *args):
...
@@ -12,8 +12,15 @@ def openvpn(config, *args):
'--user'
,
'nobody'
,
'--user'
,
'nobody'
,
'--group'
,
'nogroup'
,
'--group'
,
'nogroup'
,
'--verb'
,
config
.
verbose
'--verb'
,
config
.
verbose
]
+
list
(
args
)
]
+
list
(
args
)
+
config
.
openvpn_args
return
subprocess
.
Popen
(
args
)
#stdin = kw.pop('stdin', None)
#stdout = kw.pop('stdout', None)
#stderr = kw.pop('stderr', None)
#for i in kw.iteritems():
# args.append('--%s=%s' % i)
return
subprocess
.
Popen
(
args
#stdin=stdin, stdout=stdout, stderr=stderr,
)
# TODO : set iface up when creating a server/client
# TODO : set iface up when creating a server/client
# ! check working directory before launching up script ?
# ! check working directory before launching up script ?
...
...
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