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
b10cde88
Commit
b10cde88
authored
Feb 03, 2022
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use X-Forwarded-For header to assign community
parent
5539f577
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
8 deletions
+3
-8
re6st/cli/conf.py
re6st/cli/conf.py
+2
-4
re6st/registry.py
re6st/registry.py
+1
-4
No files found.
re6st/cli/conf.py
View file @
b10cde88
...
...
@@ -46,8 +46,7 @@ def main():
help
=
"Request an anonymous certificate. No email is required but the"
" registry may deliver a longer prefix."
)
_
(
'--country'
,
help
=
"Specify country for the community assignment (default:"
" country is detected based on IP in X-Forwarded-For header"
)
help
=
"Specify country for the community assignment"
)
config
=
parser
.
parse_args
()
if
config
.
dir
:
os
.
chdir
(
config
.
dir
)
...
...
@@ -144,8 +143,7 @@ def main():
# to avoid using our token for nothing.
cert_fd
=
os
.
open
(
cert_path
,
os
.
O_CREAT
|
os
.
O_WRONLY
,
0666
)
print
"Requesting certificate ..."
cert
=
s
.
requestCertificate
(
token
,
req
,
country
=
config
.
country
)
\
if
config
.
country
else
s
.
requestCertificate
(
token
,
req
)
cert
=
s
.
requestCertificate
(
token
,
req
,
country
=
config
.
country
or
'_'
)
if
not
cert
:
token_advice
=
None
sys
.
exit
(
"Error: invalid or expired token"
)
...
...
re6st/registry.py
View file @
b10cde88
...
...
@@ -290,8 +290,6 @@ class RegistryServer(object):
request
.
headers
.
get
(
"X-Forwarded-For"
)
or
request
.
headers
.
get
(
"host"
),
request
.
headers
.
get
(
"user-agent"
))
if
'ip'
in
kw
:
kw
[
'ip'
]
=
request
.
headers
.
get
(
"X-Forwarded-For"
)
or
request
.
headers
.
get
(
"host"
)
try
:
result
=
m
(
**
kw
)
except
HTTPError
,
e
:
...
...
@@ -418,7 +416,7 @@ class RegistryServer(object):
return
self
.
newPrefix
(
prefix_len
,
country
)
@
rpc
def
requestCertificate
(
self
,
token
,
req
,
country
=
'
'
,
ip
=
'
'
):
def
requestCertificate
(
self
,
token
,
req
,
country
=
'
_
'
):
req
=
crypto
.
load_certificate_request
(
crypto
.
FILETYPE_PEM
,
req
)
with
self
.
lock
:
with
self
.
db
:
...
...
@@ -438,7 +436,6 @@ class RegistryServer(object):
if
not
prefix_len
:
raise
HTTPError
(
httplib
.
FORBIDDEN
)
email
=
None
country
=
country
if
country
else
self
.
_geoiplookup
(
ip
)
prefix
=
self
.
newPrefix
(
prefix_len
,
country
if
country
in
self
.
community_map
else
'_'
)
self
.
db
.
execute
(
"UPDATE cert SET email = ? WHERE prefix = ?"
,
...
...
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