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

Fix ACME config for python 2. #4717

Merged
merged 1 commit into from
Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/4717.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix ACME config for python 2.
10 changes: 7 additions & 3 deletions synapse/config/tls.py
Original file line number Diff line number Diff line change
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