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
Joanne Hugé
re6stnet
Commits
351e4fe8
Commit
351e4fe8
authored
Jul 16, 2012
by
Guillaume Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed recuperation of external_ip via openvpn
parent
c180e126
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
12 deletions
+4
-12
client-connect
client-connect
+1
-1
ipchange
ipchange
+0
-8
openvpn.py
openvpn.py
+1
-1
vifibnet.py
vifibnet.py
+2
-2
No files found.
client-connect
View file @
351e4fe8
...
@@ -40,7 +40,7 @@ import os, time, sys
...
@@ -40,7 +40,7 @@ import os, time, sys
# Send to client his external ip address
# Send to client his external ip address
if
os
.
environ
[
'script_type'
]
==
'client-connect'
:
if
os
.
environ
[
'script_type'
]
==
'client-connect'
:
with
open
(
sys
.
argv
[
2
],
'w'
)
as
f
:
with
open
(
sys
.
argv
[
2
],
'w'
)
as
f
:
f
.
write
(
'push "setenv 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
# Write into pipe connect/disconnect events
os
.
write
(
int
(
sys
.
argv
[
1
]),
'%(script_type)s %(common_name)s
\
n
'
%
os
.
environ
)
os
.
write
(
int
(
sys
.
argv
[
1
]),
'%(script_type)s %(common_name)s
\
n
'
%
os
.
environ
)
ipchange
deleted
100755 → 0
View file @
c180e126
#!/usr/bin/python -S
import
os
,
time
,
sys
# Write into pipe external ip address received
# Pb: executed before ( or at the same time ) as client-connect on server
# \===> external_ip not set when script is launched
# os.write(int(sys.argv[1]), '%(script_type)s %(external_ip)s\n' % os.environ)
openvpn.py
View file @
351e4fe8
...
@@ -41,6 +41,6 @@ def client(serverIp, pipe_fd, *args, **kw):
...
@@ -41,6 +41,6 @@ def client(serverIp, pipe_fd, *args, **kw):
'--client'
,
'--client'
,
'--remote'
,
serverIp
,
'--remote'
,
serverIp
,
'--up'
,
'up-client'
,
'--up'
,
'up-client'
,
'--
ipchange'
,
'ipchange
'
+
str
(
pipe_fd
),
'--
route-up'
,
'route-up
'
+
str
(
pipe_fd
),
*
args
,
**
kw
)
*
args
,
**
kw
)
vifibnet.py
View file @
351e4fe8
...
@@ -101,7 +101,7 @@ def getConfig():
...
@@ -101,7 +101,7 @@ def getConfig():
# TODO: use maxpeer
# TODO: use maxpeer
_
(
'--max-clients'
,
default
=
10
,
type
=
int
,
_
(
'--max-clients'
,
default
=
10
,
type
=
int
,
help
=
'the number of peers that can connect to the server'
)
help
=
'the number of peers that can connect to the server'
)
_
(
'--refresh-time'
,
default
=
6
0
,
type
=
int
,
_
(
'--refresh-time'
,
default
=
30
0
,
type
=
int
,
help
=
'the time (seconds) to wait before changing the connections'
)
help
=
'the time (seconds) to wait before changing the connections'
)
_
(
'--refresh-count'
,
default
=
1
,
type
=
int
,
_
(
'--refresh-count'
,
default
=
1
,
type
=
int
,
help
=
'The number of connections to drop when refreshing the connections'
)
help
=
'The number of connections to drop when refreshing the connections'
)
...
@@ -205,7 +205,7 @@ def handle_message(msg):
...
@@ -205,7 +205,7 @@ def handle_message(msg):
# TODO: check if we are not already connected to it
# TODO: check if we are not already connected to it
elif
script_type
==
'client-disconnect'
:
elif
script_type
==
'client-disconnect'
:
log
.
log
(
'%s has disconnected'
%
(
arg
,),
3
)
log
.
log
(
'%s has disconnected'
%
(
arg
,),
3
)
elif
script_type
==
'
ipchange
'
:
elif
script_type
==
'
route-up
'
:
# TODO: save the external ip received
# TODO: save the external ip received
log
.
log
(
'External Ip : '
+
arg
,
3
)
log
.
log
(
'External Ip : '
+
arg
,
3
)
else
:
else
:
...
...
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