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
be9efe02
Commit
be9efe02
authored
Nov 29, 2015
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure malformed ssl certificate can't cause it to be written to an arbitrary path
parent
766b98c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
ssl_certificates.py
management/ssl_certificates.py
+2
-2
No files found.
management/ssl_certificates.py
View file @
be9efe02
...
...
@@ -2,7 +2,7 @@
import
os
,
os
.
path
,
re
,
shutil
from
utils
import
shell
from
utils
import
shell
,
safe_domain_name
def
get_ssl_certificates
(
env
):
# Scan all of the installed SSL certificates and map every domain
...
...
@@ -170,7 +170,7 @@ def install_cert(domain, ssl_cert, ssl_chain, env):
cert
=
load_pem
(
load_cert_chain
(
fn
)[
0
])
all_domains
,
cn
=
get_certificate_domains
(
cert
)
path
=
"
%
s-
%
s-
%
s.pem"
%
(
cn
,
# common
name
safe_domain_name
(
cn
),
# common name, which should be filename safe because it is IDNA-encoded, but in case of a malformed cert make sure it's ok to use as a file
name
cert
.
not_valid_after
.
date
()
.
isoformat
()
.
replace
(
"-"
,
""
),
# expiration date
hexlify
(
cert
.
fingerprint
(
hashes
.
SHA256
()))
.
decode
(
"ascii"
)[
0
:
8
],
# fingerprint 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