Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
4d6d38ac
Unverified
Commit
4d6d38ac
authored
3 years ago
by
Patrick Cloke
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove dead code from acme support. (#11393)
parent
5505da21
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/11393.misc
+1
-0
1 addition, 0 deletions
changelog.d/11393.misc
synapse/config/tls.py
+0
-50
0 additions, 50 deletions
synapse/config/tls.py
with
1 addition
and
50 deletions
changelog.d/11393.misc
0 → 100644
+
1
−
0
View file @
4d6d38ac
Remove dead code from supporting ACME.
This diff is collapsed.
Click to expand it.
synapse/config/tls.py
+
0
−
50
View file @
4d6d38ac
...
...
@@ -14,7 +14,6 @@
import
logging
import
os
from
datetime
import
datetime
from
typing
import
List
,
Optional
,
Pattern
from
OpenSSL
import
SSL
,
crypto
...
...
@@ -133,55 +132,6 @@ class TlsConfig(Config):
self
.
tls_certificate
:
Optional
[
crypto
.
X509
]
=
None
self
.
tls_private_key
:
Optional
[
crypto
.
PKey
]
=
None
def
is_disk_cert_valid
(
self
,
allow_self_signed
=
True
):
"""
Is the certificate we have on disk valid, and if so, for how long?
Args:
allow_self_signed (bool): Should we allow the certificate we
read to be self signed?
Returns:
int: Days remaining of certificate validity.
None: No certificate exists.
"""
if
not
os
.
path
.
exists
(
self
.
tls_certificate_file
):
return
None
try
:
with
open
(
self
.
tls_certificate_file
,
"
rb
"
)
as
f
:
cert_pem
=
f
.
read
()
except
Exception
as
e
:
raise
ConfigError
(
"
Failed to read existing certificate file %s: %s
"
%
(
self
.
tls_certificate_file
,
e
)
)
try
:
tls_certificate
=
crypto
.
load_certificate
(
crypto
.
FILETYPE_PEM
,
cert_pem
)
except
Exception
as
e
:
raise
ConfigError
(
"
Failed to parse existing certificate file %s: %s
"
%
(
self
.
tls_certificate_file
,
e
)
)
if
not
allow_self_signed
:
if
tls_certificate
.
get_subject
()
==
tls_certificate
.
get_issuer
():
raise
ValueError
(
"
TLS Certificate is self signed, and this is not permitted
"
)
# YYYYMMDDhhmmssZ -- in UTC
expiry_data
=
tls_certificate
.
get_notAfter
()
if
expiry_data
is
None
:
raise
ValueError
(
"
TLS Certificate has no expiry date, and this is not permitted
"
)
expires_on
=
datetime
.
strptime
(
expiry_data
.
decode
(
"
ascii
"
),
"
%Y%m%d%H%M%SZ
"
)
now
=
datetime
.
utcnow
()
days_remaining
=
(
expires_on
-
now
).
days
return
days_remaining
def
read_certificate_from_disk
(
self
):
"""
Read the certificates and private key from disk.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment