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
cb4cb822
Commit
cb4cb822
authored
Jul 04, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding openvpn.py
parent
8e578298
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
main.py
main.py
+4
-2
openvpn.py
openvpn.py
+36
-0
No files found.
main.py
View file @
cb4cb822
...
...
@@ -44,8 +44,10 @@ def getConfig():
def
main
():
getConfig
()
serverProcess
=
openvpn
.
server
(
config
,
config
.
ip
)
client1Process
=
openvpn
.
client
(
config
,
'10.1.4.2'
)
if
config
.
ip
!=
'none'
:
serverProcess
=
openvpn
.
server
(
config
,
config
.
ip
)
else
:
client1Process
=
openvpn
.
client
(
config
,
'10.1.4.2'
)
if
__name__
==
"__main__"
:
...
...
openvpn.py
0 → 100644
View file @
cb4cb822
import
subprocess
def
openvpn
(
config
,
*
args
):
args
=
[
'openvpn'
,
'--dev'
,
'tap'
,
'--ca'
,
config
.
ca
,
'--cert'
,
config
.
cert
,
'--key'
,
config
.
key
,
'--persist-tun'
,
'--persist-key'
,
'--script-security'
,
'2'
,
'--user'
,
'nobody'
,
'--group'
,
'nogroup'
,
'--verb'
,
config
.
verbose
]
+
list
(
args
)
return
subprocess
.
Popen
(
args
)
# TODO : set iface up when creating a server/client
# ! check working directory before launching up script ?
def
server
(
config
,
ip
):
return
openvpn
(
config
,
'--tls-server'
,
'--keepalive'
,
'10'
,
'60'
,
'--mode'
,
'server'
,
'--duplicate-cn'
,
'--up'
,
'up-server '
+
ip
,
'--dh'
,
config
.
dh
)
def
client
(
config
,
serverIp
):
return
openvpn
(
config
,
'--nobind'
,
'--tls-client'
,
'--remote'
,
serverIp
,
'--up'
,
'up-client'
)
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