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
zhifan huang
re6stnet
Commits
f9f4e5f3
Commit
f9f4e5f3
authored
Nov 07, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to join the network without email/token
parent
761f50c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
re6st-conf
re6st-conf
+8
-2
re6st-registry
re6st-registry
+17
-6
No files found.
re6st-conf
View file @
f9f4e5f3
...
@@ -30,6 +30,9 @@ def main():
...
@@ -30,6 +30,9 @@ def main():
help
=
"Email address where your token is sent. Use -r option if you"
help
=
"Email address where your token is sent. Use -r option if you"
" want to show an email in your certificate."
)
" want to show an email in your certificate."
)
_
(
'--token'
,
help
=
"The token you received."
)
_
(
'--token'
,
help
=
"The token you received."
)
_
(
'--anonymous'
,
action
=
'store_true'
,
help
=
"Request an anonymous certificate. No email is required but the"
" registry may deliver a longer prefix."
)
config
=
parser
.
parse_args
()
config
=
parser
.
parse_args
()
if
config
.
dir
:
if
config
.
dir
:
os
.
chdir
(
config
.
dir
)
os
.
chdir
(
config
.
dir
)
...
@@ -39,7 +42,7 @@ def main():
...
@@ -39,7 +42,7 @@ def main():
dh_path
=
'dh2048.pem'
dh_path
=
'dh2048.pem'
# Establish connection with server
# Establish connection with server
s
=
xmlrpclib
.
ServerProxy
(
config
.
registry
)
s
=
xmlrpclib
.
ServerProxy
(
config
.
registry
,
allow_none
=
True
)
# Get CA
# Get CA
create
(
ca_path
,
s
.
getCa
())
create
(
ca_path
,
s
.
getCa
())
...
@@ -74,7 +77,10 @@ def main():
...
@@ -74,7 +77,10 @@ def main():
cert_fd
=
token_advice
=
None
cert_fd
=
token_advice
=
None
try
:
try
:
if
not
config
.
token
:
if
config
.
anonymous
:
if
not
(
config
.
token
is
config
.
email
is
None
):
parser
.
error
(
"--anonymous conflicts with --email/--token"
)
elif
not
config
.
token
:
if
not
config
.
email
:
if
not
config
.
email
:
config
.
email
=
raw_input
(
'Please enter your email address: '
)
config
.
email
=
raw_input
(
'Please enter your email address: '
)
s
.
requestToken
(
config
.
email
)
s
.
requestToken
(
config
.
email
)
...
...
re6st-registry
View file @
f9f4e5f3
...
@@ -72,8 +72,11 @@ class main(object):
...
@@ -72,8 +72,11 @@ class main(object):
_
(
'--private'
,
_
(
'--private'
,
help
=
"re6stnet IP of the node on which runs the registry."
help
=
"re6stnet IP of the node on which runs the registry."
" Required for normal operation."
)
" Required for normal operation."
)
_
(
'--prefix-length'
,
default
=
16
,
_
(
'--prefix-length'
,
default
=
16
,
type
=
int
,
help
=
"Default length of allocated prefixes."
)
help
=
"Default length of allocated prefixes."
)
_
(
'--anonymous-prefix-length'
,
type
=
int
,
help
=
"Length of allocated anonymous prefixes."
" If 0 or unset, registration by email is required"
)
_
(
'-l'
,
'--logfile'
,
default
=
'/var/log/re6stnet/registry.log'
,
_
(
'-l'
,
'--logfile'
,
default
=
'/var/log/re6stnet/registry.log'
,
help
=
"Path to logging file."
)
help
=
"Path to logging file."
)
_
(
'-v'
,
'--verbose'
,
default
=
1
,
type
=
int
,
_
(
'-v'
,
'--verbose'
,
default
=
1
,
type
=
int
,
...
@@ -199,11 +202,19 @@ class main(object):
...
@@ -199,11 +202,19 @@ class main(object):
try
:
try
:
req
=
crypto
.
load_certificate_request
(
crypto
.
FILETYPE_PEM
,
cert_req
)
req
=
crypto
.
load_certificate_request
(
crypto
.
FILETYPE_PEM
,
cert_req
)
with
self
.
db
:
with
self
.
db
:
try
:
if
token
is
None
:
token
,
email
,
prefix_len
,
_
=
self
.
db
.
execute
(
"SELECT * FROM token WHERE token = ?"
,
(
token
,)).
next
()
prefix_len
=
self
.
config
.
anonymous_prefix_length
except
StopIteration
:
if
not
prefix_len
:
return
return
self
.
db
.
execute
(
"DELETE FROM token WHERE token = ?"
,
(
token
,))
email
=
None
else
:
try
:
token
,
email
,
prefix_len
,
_
=
self
.
db
.
execute
(
"SELECT * FROM token WHERE token = ?"
,
(
token
,)).
next
()
except
StopIteration
:
return
self
.
db
.
execute
(
"DELETE FROM token WHERE token = ?"
,
(
token
,))
# Get a new prefix
# Get a new prefix
prefix
=
self
.
_getPrefix
(
prefix_len
)
prefix
=
self
.
_getPrefix
(
prefix_len
)
...
...
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