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
Yohann D'Anello
re6stnet
Commits
b9857d17
Commit
b9857d17
authored
Jul 17, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge openvpn scripts in 2: 1 for server and 1 for client
parent
550be227
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
17 deletions
+20
-17
openvpn-up-client
openvpn-up-client
+0
-2
openvpn-up-server
openvpn-up-server
+0
-4
ovpn-client
ovpn-client
+4
-2
ovpn-server
ovpn-server
+11
-4
plib.py
plib.py
+5
-5
No files found.
openvpn-up-client
deleted
100755 → 0
View file @
550be227
#!/bin/sh -e
ip
link set
$dev
up
openvpn-up-server
deleted
100755 → 0
View file @
550be227
#!/bin/sh -e
ip
link set
$dev
up
ip addr add
$1
dev
$dev
o
penvpn-route-up
→
o
vpn-client
View file @
b9857d17
#!/usr/bin/python -S
import
os
,
time
,
sys
import
os
,
sys
if
os
.
environ
[
'script_type'
]
==
'route-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
\
n
'
%
os
.
environ
)
o
penvpn-server-events
→
o
vpn-server
View file @
b9857d17
#!/usr/bin/python -S
import
os
,
time
,
sys
# example of os.environ
{
'X509_0_C'
:
'FR'
,
...
...
@@ -37,10 +36,18 @@ import os, time, sys
'untrusted_port'
:
'59345'
,
'verb'
:
'3'
}
# Send to client his external ip address
if
os
.
environ
[
'script_type'
]
==
'client-connect'
:
script_type
=
os
.
environ
[
'script_type'
]
if
script_type
==
'up'
:
from
subprocess
import
call
dev
=
os
.
environ
[
'dev'
]
sys
.
exit
(
call
((
'ip'
,
'link'
,
'set'
,
dev
,
'up'
))
or
call
((
'ip'
,
'addr'
,
'add'
,
sys
.
argv
[
1
],
'dev'
,
dev
)))
if
script_type
==
'client-connect'
:
# Send client its external ip address
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_ip %s"
\
n
'
%
os
.
environ
[
'trusted_ip'
])
# Write into pipe connect/disconnect events
os
.
write
(
int
(
sys
.
argv
[
1
]),
'%(script_type)s %(common_name)s
\
n
'
%
os
.
environ
)
plib.py
View file @
b9857d17
...
...
@@ -31,9 +31,9 @@ def server(ip, pipe_fd, *args, **kw):
return
openvpn
(
'--tls-server'
,
'--mode'
,
'server'
,
'--up'
,
'o
penvpn-up
-server %s/%u'
%
(
ip
,
len
(
utils
.
config
.
vifibnet
)),
'--client-connect'
,
'o
penvpn-server-events
'
+
str
(
pipe_fd
),
'--client-disconnect'
,
'o
penvpn-server-events
'
+
str
(
pipe_fd
),
'--up'
,
'o
vpn
-server %s/%u'
%
(
ip
,
len
(
utils
.
config
.
vifibnet
)),
'--client-connect'
,
'o
vpn-server
'
+
str
(
pipe_fd
),
'--client-disconnect'
,
'o
vpn-server
'
+
str
(
pipe_fd
),
'--dh'
,
utils
.
config
.
dh
,
'--max-clients'
,
str
(
utils
.
config
.
max_clients
),
*
args
,
**
kw
)
...
...
@@ -44,8 +44,8 @@ def client(serverIp, pipe_fd, *args, **kw):
'--nobind'
,
'--client'
,
'--remote'
,
serverIp
,
'--up'
,
'o
penvpn-up
-client'
,
'--route-up'
,
'o
penvpn-route-up
'
+
str
(
pipe_fd
),
'--up'
,
'o
vpn
-client'
,
'--route-up'
,
'o
vpn-client
'
+
str
(
pipe_fd
),
*
args
,
**
kw
)
def
babel
(
**
kw
):
...
...
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