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

Force TLS certificate verification in registration script. #16530

Merged
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/16530.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Force TLS certificate verification in user registration script.
4 changes: 2 additions & 2 deletions synapse/_scripts/register_new_matrix_user.py
Copy link
Member

@clokep clokep Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the common case of running this locally ensures you don't use TLS, see:

if listener.get("type") != "http" or listener.get("tls", False):
continue

# TODO: consider bind_addresses
return f"http://localhost:{listener['port']}"

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def request_registration(
url = "%s/_synapse/admin/v1/register" % (server_location.rstrip("/"),)

# Get the nonce
r = requests.get(url, verify=False)
r = requests.get(url)

if r.status_code != 200:
_print("ERROR! Received %d %s" % (r.status_code, r.reason))
Expand Down Expand Up @@ -88,7 +88,7 @@ def request_registration(
}

_print("Sending registration request...")
r = requests.post(url, json=data, verify=False)
r = requests.post(url, json=data)

if r.status_code != 200:
_print("ERROR! Received %d %s" % (r.status_code, r.reason))
Expand Down