Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caucase
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
caucase
Commits
3f04238d
Commit
3f04238d
authored
Feb 02, 2021
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http.manage: Do not prune expired certificates from ca table.
Because this is not the job of an import/export tool.
parent
7a7d0383
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
caucase/http.py
caucase/http.py
+2
-2
caucase/storage.py
caucase/storage.py
+8
-7
No files found.
caucase/http.py
View file @
3f04238d
...
@@ -1114,7 +1114,7 @@ def manage(argv=None, stdout=sys.stdout):
...
@@ -1114,7 +1114,7 @@ def manage(argv=None, stdout=sys.stdout):
db
=
SQLite3Storage
(
db_path
,
table_prefix
=
'cas'
)
db
=
SQLite3Storage
(
db_path
,
table_prefix
=
'cas'
)
trusted_ca_crt_set
=
[
trusted_ca_crt_set
=
[
utils
.
load_ca_certificate
(
x
[
'crt_pem'
])
utils
.
load_ca_certificate
(
x
[
'crt_pem'
])
for
x
in
db
.
getCAKeyPairList
()
for
x
in
db
.
getCAKeyPairList
(
prune
=
False
)
]
]
latest_ca_not_after
=
max
(
latest_ca_not_after
=
max
(
x
.
not_valid_after
x
.
not_valid_after
...
@@ -1159,7 +1159,7 @@ def manage(argv=None, stdout=sys.stdout):
...
@@ -1159,7 +1159,7 @@ def manage(argv=None, stdout=sys.stdout):
for
key_pair
in
SQLite3Storage
(
for
key_pair
in
SQLite3Storage
(
db_path
,
db_path
,
table_prefix
=
'cas'
,
table_prefix
=
'cas'
,
).
getCAKeyPairList
():
).
getCAKeyPairList
(
prune
=
False
):
write
(
write
(
key_pair
[
'crt_pem'
]
+
serialization
.
load_pem_private_key
(
key_pair
[
'crt_pem'
]
+
serialization
.
load_pem_private_key
(
key_pair
[
'key_pem'
],
key_pair
[
'key_pem'
],
...
...
caucase/storage.py
View file @
3f04238d
...
@@ -215,13 +215,14 @@ class SQLite3Storage(local):
...
@@ -215,13 +215,14 @@ class SQLite3Storage(local):
except
sqlite3
.
IntegrityError
:
except
sqlite3
.
IntegrityError
:
pass
pass
def
getCAKeyPairList
(
self
):
def
getCAKeyPairList
(
self
,
prune
=
True
):
"""
"""
Return the chronologically sorted (oldest in [0], newest in [-1])
Return the chronologically sorted (oldest in [0], newest in [-1])
certificate authority key pairs.
certificate authority key pairs.
"""
"""
with
self
.
_db
as
db
:
with
self
.
_db
as
db
:
c
=
db
.
cursor
()
c
=
db
.
cursor
()
if
prune
:
c
.
execute
(
c
.
execute
(
'DELETE FROM %sca WHERE expiration_date < ?'
%
(
'DELETE FROM %sca WHERE expiration_date < ?'
%
(
self
.
_table_prefix
,
self
.
_table_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