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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vincent Pelletier
caucase
Commits
cbfcd37c
Commit
cbfcd37c
authored
Nov 25, 2020
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP wsgi: Produce http response caching headers.
parent
74828dc4
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
356 additions
and
66 deletions
+356
-66
caucase/ca.py
caucase/ca.py
+25
-4
caucase/test.py
caucase/test.py
+6
-6
caucase/wsgi.py
caucase/wsgi.py
+325
-56
No files found.
caucase/ca.py
View file @
cbfcd37c
...
@@ -193,6 +193,13 @@ class CertificateAuthority(object):
...
@@ -193,6 +193,13 @@ class CertificateAuthority(object):
self
.
_loadCAKeyPairList
()
self
.
_loadCAKeyPairList
()
self
.
_renewCAIfNeeded
()
self
.
_renewCAIfNeeded
()
@
property
def
crt_life_time
(
self
):
"""
Read-only access to crt_life_time ctor parameter, as a timedelta.
"""
return
self
.
_crt_life_time
@
property
@
property
def
digest_list
(
self
):
def
digest_list
(
self
):
"""
"""
...
@@ -229,8 +236,13 @@ class CertificateAuthority(object):
...
@@ -229,8 +236,13 @@ class CertificateAuthority(object):
previous_crt_pem
=
crt_pem
previous_crt_pem
=
crt_pem
previous_key
=
key
previous_key
=
key
self
.
_ca_key_pairs_list
=
ca_key_pair_list
self
.
_ca_key_pairs_list
=
ca_key_pair_list
self
.
_ca_certificate_chain
=
tuple
(
self
.
_ca_certificate_chain_and_expiration_date
=
(
ca_certificate_chain
tuple
(
ca_certificate_chain
),
(
None
if
previous_crt
is
None
else
# Only True during __init__
previous_crt
.
not_valid_after
),
)
)
def
getCertificateSigningRequest
(
self
,
csr_id
):
def
getCertificateSigningRequest
(
self
,
csr_id
):
...
@@ -621,6 +633,14 @@ class CertificateAuthority(object):
...
@@ -621,6 +633,14 @@ class CertificateAuthority(object):
"""
"""
return
utils
.
dump_certificate
(
self
.
_getCurrentCAKeypair
()[
'crt'
])
return
utils
.
dump_certificate
(
self
.
_getCurrentCAKeypair
()[
'crt'
])
def
getCACertificateAndExpirationDate
(
self
):
"""
Return current CA certificate, PEM-encoded, and its expiration date
(datetime).
"""
certificate
=
self
.
_getCurrentCAKeypair
()[
'crt'
]
return
utils
.
dump_certificate
(
certificate
),
certificate
.
not_valid_after
def
getCACertificateList
(
self
):
def
getCACertificateList
(
self
):
"""
"""
Return the current list of CA certificates as X509 obbjects.
Return the current list of CA certificates as X509 obbjects.
...
@@ -630,7 +650,8 @@ class CertificateAuthority(object):
...
@@ -630,7 +650,8 @@ class CertificateAuthority(object):
def
getValidCACertificateChain
(
self
):
def
getValidCACertificateChain
(
self
):
"""
"""
Return the CA certificate chain based on oldest CA certificate.
Return the CA certificate chain based on oldest CA certificate, and
expiration date of the last (most recent) CA certificate in the chain.
Each item in the chain is a wrapped dict with the following keys:
Each item in the chain is a wrapped dict with the following keys:
old (str)
old (str)
...
@@ -655,7 +676,7 @@ class CertificateAuthority(object):
...
@@ -655,7 +676,7 @@ class CertificateAuthority(object):
purposes.
purposes.
"""
"""
self
.
_renewCAIfNeeded
()
self
.
_renewCAIfNeeded
()
return
self
.
_ca_certificate_chain
return
self
.
_ca_certificate_chain
_and_expiration_date
def
revoke
(
self
,
crt_pem
):
def
revoke
(
self
,
crt_pem
):
"""
"""
...
...
caucase/test.py
View file @
cbfcd37c
...
@@ -1644,6 +1644,7 @@ class CaucaseTest(unittest.TestCase):
...
@@ -1644,6 +1644,7 @@ class CaucaseTest(unittest.TestCase):
Mock CAU.
Mock CAU.
"""
"""
digest_list
=
[
'sha256'
]
digest_list
=
[
'sha256'
]
crt_life_time
=
datetime
.
timedelta
(
90
,
0
)
@
staticmethod
@
staticmethod
def
getCACertificateList
():
def
getCACertificateList
():
...
@@ -1653,11 +1654,14 @@ class CaucaseTest(unittest.TestCase):
...
@@ -1653,11 +1654,14 @@ class CaucaseTest(unittest.TestCase):
return
cau_list
return
cau_list
@
staticmethod
@
staticmethod
def
getCACertificate
():
def
getCACertificate
AndExpirationDate
():
"""
"""
Return a dummy string as CA certificate
Return a dummy string as CA certificate
"""
"""
return
b'notreallyPEM'
return
(
b'notreallyPEM'
,
datetime
.
datetime
.
utcnow
()
+
datetime
.
timedelta
(
130
,
0
),
)
@
staticmethod
@
staticmethod
def
getCertificateRevocationListDict
():
def
getCertificateRevocationListDict
():
...
@@ -2022,10 +2026,6 @@ class CaucaseTest(unittest.TestCase):
...
@@ -2022,10 +2026,6 @@ class CaucaseTest(unittest.TestCase):
header_dict
[
'Access-Control-Allow-Origin'
],
header_dict
[
'Access-Control-Allow-Origin'
],
cross_origin
,
cross_origin
,
)
)
self
.
assertEqual
(
header_dict
[
'Vary'
],
'Origin'
,
)
self
.
assertItemsEqual
(
self
.
assertItemsEqual
(
[
[
x
.
strip
()
x
.
strip
()
...
...
caucase/wsgi.py
View file @
cbfcd37c
This diff is collapsed.
Click to expand it.
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