Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix ACME config for python 2.
Browse files Browse the repository at this point in the history
Fixes #4675.
  • Loading branch information
richvdh committed Feb 22, 2019
1 parent 9bccd5e commit 6d15149
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/4717.bugfix
@@ -0,0 +1 @@
Fix ACME config for python 2.
10 changes: 7 additions & 3 deletions synapse/config/tls.py
Expand Up @@ -19,6 +19,8 @@
from datetime import datetime
from hashlib import sha256

import six

from unpaddedbase64 import encode_base64

from OpenSSL import crypto
Expand All @@ -36,9 +38,11 @@ def read_config(self, config):
acme_config = {}

self.acme_enabled = acme_config.get("enabled", False)
self.acme_url = acme_config.get(

# hyperlink complains on py2 if this is not a Unicode
self.acme_url = six.text_type(acme_config.get(
"url", u"https://acme-v01.api.letsencrypt.org/directory"
)
))
self.acme_port = acme_config.get("port", 80)
self.acme_bind_addresses = acme_config.get("bind_addresses", ['::', '0.0.0.0'])
self.acme_reprovision_threshold = acme_config.get("reprovision_threshold", 30)
Expand All @@ -55,7 +59,7 @@ def read_config(self, config):
)
if not self.tls_private_key_file:
raise ConfigError(
"tls_certificate_path must be specified if TLS-enabled listeners are "
"tls_private_key_path must be specified if TLS-enabled listeners are "
"configured."
)

Expand Down

0 comments on commit 6d15149

Please sign in to comment.