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
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
nexedi
re6stnet
Commits
5d05c34b
Commit
5d05c34b
authored
May 09, 2023
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
registry: make grace_period a command line option
parent
aff69950
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
7 deletions
+10
-7
re6st/cli/registry.py
re6st/cli/registry.py
+3
-0
re6st/registry.py
re6st/registry.py
+2
-3
re6st/tests/registry.json
re6st/tests/registry.json
+3
-2
re6st/tests/test_unit/test_registry.py
re6st/tests/test_unit/test_registry.py
+2
-2
No files found.
re6st/cli/registry.py
View file @
5d05c34b
...
...
@@ -113,6 +113,9 @@ def main():
_
(
'--community'
,
help
=
"File containing community configuration. This file cannot be"
" empty and must contain the default location ('*')."
)
_
(
'--grace-period'
,
default
=
8640000
,
type
=
int
,
help
=
"Period in seconds during which a client can renew its"
" certificate even if expired (default 100 days)"
)
_
=
parser
.
add_argument_group
(
'routing'
).
add_argument
_
(
'--hello'
,
type
=
int
,
default
=
15
,
...
...
re6st/registry.py
View file @
5d05c34b
...
...
@@ -32,7 +32,6 @@ from . import ctl, tunnel, utils, version, x509
HMAC_HEADER
=
"Re6stHMAC"
RENEW_PERIOD
=
30
*
86400
GRACE_PERIOD
=
100
*
86400
BABEL_HMAC
=
'babel_hmac0'
,
'babel_hmac1'
,
'babel_hmac2'
def
rpc
(
f
):
...
...
@@ -251,7 +250,7 @@ class RegistryServer(object):
# 'select' call does not return. Ideally, we should interrupt it.
logging
.
info
(
"Checking if there's any old entry in the database ..."
)
not_after
=
None
old
=
time
.
time
()
-
GRACE_PERIOD
old
=
time
.
time
()
-
self
.
config
.
grace_period
q
=
self
.
db
.
execute
with
self
.
lock
,
self
.
db
:
q
(
"BEGIN"
)
...
...
@@ -278,7 +277,7 @@ class RegistryServer(object):
elif
not_after
is
None
or
x
<
not_after
:
not_after
=
x
self
.
mergePrefixes
()
self
.
timeout
=
not_after
and
not_after
+
GRACE_PERIOD
self
.
timeout
=
not_after
and
not_after
+
self
.
config
.
grace_period
def
handle_request
(
self
,
request
,
method
,
kw
):
m
=
getattr
(
self
,
method
)
...
...
re6st/tests/registry.json
View file @
5d05c34b
...
...
@@ -24,5 +24,6 @@
"same_country"
:
null
,
"tunnel_refresh"
:
300
,
"hello"
:
15
,
"community"
:
null
}
\ No newline at end of file
"community"
:
null
,
"grace_period"
:
8640000
}
re6st/tests/test_unit/test_registry.py
View file @
5d05c34b
...
...
@@ -112,7 +112,7 @@ class TestRegistryServer(unittest.TestCase):
token_old
,
token
=
"bbbbdddd"
,
"ddddbbbb"
prefix_old
,
prefix
=
"1110"
,
"1111"
# 20 magic number, make sure we create old enough new cert/token
now
=
int
(
time
.
time
())
-
registry
.
GRACE_PERIOD
+
20
now
=
int
(
time
.
time
())
-
self
.
config
.
grace_period
+
20
# makeup data
insert_cert
(
cur
,
self
.
server
.
cert
,
prefix_old
,
1
)
insert_cert
(
cur
,
self
.
server
.
cert
,
prefix
,
now
-
1
)
...
...
@@ -130,7 +130,7 @@ class TestRegistryServer(unittest.TestCase):
self
.
assertIsNone
(
get_cert
(
cur
,
prefix_old
),
"old cert not deleted"
)
self
.
assertIsNotNone
(
get_cert
(
cur
,
prefix
))
self
.
assertEqual
(
self
.
server
.
timeout
,
now
-
1
+
registry
.
GRACE_PERIOD
,
now
-
1
+
self
.
config
.
grace_period
,
"time_out set wrongly"
)
delete_cert
(
cur
,
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