Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
541d9252
Commit
541d9252
authored
Jul 13, 2015
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow PEM files to have non-Unix line endings
parent
cbbbb117
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
status_checks.py
management/status_checks.py
+2
-2
No files found.
management/status_checks.py
View file @
541d9252
...
...
@@ -746,7 +746,7 @@ def check_certificate(domain, ssl_certificate, ssl_private_key, warn_if_expiring
def
load_cert_chain
(
pemfile
):
# A certificate .pem file may contain a chain of certificates.
# Load the file and split them apart.
re_pem
=
rb
"(-+BEGIN (?:.+)-+[
\r\n
]
(?:[A-Za-z0-9+/=]{1,64}[
\r\n
])+-+END (?:.+)-+[
\r\n
]
)"
re_pem
=
rb
"(-+BEGIN (?:.+)-+[
\r\n
]
+(?:[A-Za-z0-9+/=]{1,64}[
\r\n
]+)+-+END (?:.+)-+[
\r\n
]+
)"
with
open
(
pemfile
,
"rb"
)
as
f
:
pem
=
f
.
read
()
+
b
"
\n
"
# ensure trailing newline
pemblocks
=
re
.
findall
(
re_pem
,
pem
)
...
...
@@ -760,7 +760,7 @@ def load_pem(pem):
from
cryptography.x509
import
load_pem_x509_certificate
from
cryptography.hazmat.primitives
import
serialization
from
cryptography.hazmat.backends
import
default_backend
pem_type
=
re
.
match
(
b
"-+BEGIN (.*?)-+
\n
"
,
pem
)
pem_type
=
re
.
match
(
b
"-+BEGIN (.*?)-+
[
\r\n
]
"
,
pem
)
if
pem_type
is
None
:
raise
ValueError
(
"File is not a valid PEM-formatted file."
)
pem_type
=
pem_type
.
group
(
1
)
...
...
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