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
Xiaowu Zhang
re6stnet
Commits
01c99fa5
Commit
01c99fa5
authored
Jul 24, 2012
by
Guillaume Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed port declaration in openvpn
parent
849e2929
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
8 deletions
+7
-8
TODO
TODO
+2
-2
db.py
db.py
+4
-3
ovpn-client
ovpn-client
+1
-1
ovpn-server
ovpn-server
+0
-2
No files found.
TODO
View file @
01c99fa5
To be done :
To be done :
The address of the client is declared while it should only be the address
The address of the client is declared while it should only be the address
of the server
of the server
Upgrade the logging function in order to be able to log message like
Upgrade the logging function in order to be able to log message like
"Refreshing peers DB ... done", or add log messages to specify that an
"Refreshing peers DB ... done", or add log messages to specify that an
...
@@ -11,7 +11,7 @@ To be done :
...
@@ -11,7 +11,7 @@ To be done :
Use an algorithm to choose which connections to keep and/or establish
Use an algorithm to choose which connections to keep and/or establish
instead of pure randomness
instead of pure randomness
|-> number of routes / tunnel
|-> number of routes / tunnel
|-> favorise most used roads ?
|-> favorise most used roads ?
Replace comments at the beginning of functions with docstrings & give all
Replace comments at the beginning of functions with docstrings & give all
...
...
db.py
View file @
01c99fa5
...
@@ -6,7 +6,7 @@ class PeerManager:
...
@@ -6,7 +6,7 @@ class PeerManager:
# internal ip = temp arg/attribute
# internal ip = temp arg/attribute
def
__init__
(
self
,
db_dir_path
,
server
,
server_port
,
refresh_time
,
address
,
def
__init__
(
self
,
db_dir_path
,
server
,
server_port
,
refresh_time
,
address
,
internal_ip
,
prefix
,
manual
,
proto
,
db_size
):
internal_ip
,
prefix
,
manual
,
proto
,
port
,
db_size
):
self
.
_refresh_time
=
refresh_time
self
.
_refresh_time
=
refresh_time
self
.
_address
=
address
self
.
_address
=
address
self
.
_internal_ip
=
internal_ip
self
.
_internal_ip
=
internal_ip
...
@@ -15,6 +15,7 @@ class PeerManager:
...
@@ -15,6 +15,7 @@ class PeerManager:
self
.
_server_port
=
server_port
self
.
_server_port
=
server_port
self
.
_db_size
=
db_size
self
.
_db_size
=
db_size
self
.
_proto
=
proto
self
.
_proto
=
proto
self
.
_ovpn_port
=
port
self
.
_manual
=
manual
self
.
_manual
=
manual
self
.
_proxy
=
xmlrpclib
.
ServerProxy
(
'http://%s:%u'
self
.
_proxy
=
xmlrpclib
.
ServerProxy
(
'http://%s:%u'
...
@@ -92,8 +93,8 @@ class PeerManager:
...
@@ -92,8 +93,8 @@ class PeerManager:
utils
.
log
(
'%s has disconnected'
%
(
arg
,),
3
)
utils
.
log
(
'%s has disconnected'
%
(
arg
,),
3
)
elif
script_type
==
'route-up'
:
elif
script_type
==
'route-up'
:
if
not
self
.
_manual
:
if
not
self
.
_manual
:
external_ip
,
external_port
=
arg
.
split
(
','
)
external_ip
=
arg
new_address
=
list
([
external_ip
,
external
_port
,
proto
]
new_address
=
list
([
external_ip
,
self
.
_ovpn
_port
,
proto
]
for
proto
in
self
.
_proto
)
for
proto
in
self
.
_proto
)
if
self
.
_address
!=
new_address
:
if
self
.
_address
!=
new_address
:
self
.
_address
=
new_address
self
.
_address
=
new_address
...
...
ovpn-client
View file @
01c99fa5
...
@@ -5,4 +5,4 @@ if os.environ['script_type'] == 'up':
...
@@ -5,4 +5,4 @@ if os.environ['script_type'] == 'up':
os
.
execlp
(
'ip'
,
'ip'
,
'link'
,
'set'
,
os
.
environ
[
'dev'
],
'up'
)
os
.
execlp
(
'ip'
,
'ip'
,
'link'
,
'set'
,
os
.
environ
[
'dev'
],
'up'
)
# Write into pipe external ip address received
# Write into pipe external ip address received
os
.
write
(
int
(
sys
.
argv
[
1
]),
'%(script_type)s %(OPENVPN_external_ip)s
,%(OPENVPN_external_port)s
\
n
'
%
os
.
environ
)
os
.
write
(
int
(
sys
.
argv
[
1
]),
'%(script_type)s %(OPENVPN_external_ip)s
\
n
'
%
os
.
environ
)
ovpn-server
View file @
01c99fa5
...
@@ -49,8 +49,6 @@ if script_type == 'client-connect':
...
@@ -49,8 +49,6 @@ if script_type == 'client-connect':
with
open
(
sys
.
argv
[
2
],
'w'
)
as
f
:
with
open
(
sys
.
argv
[
2
],
'w'
)
as
f
:
f
.
write
(
'push "setenv-safe external_ip %s"
\
n
'
f
.
write
(
'push "setenv-safe external_ip %s"
\
n
'
%
os
.
environ
[
'trusted_ip'
])
%
os
.
environ
[
'trusted_ip'
])
f
.
write
(
'push "setenv-safe external_port %s"
\
n
'
%
os
.
environ
[
'trusted_port'
])
# 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
)
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