element-hq / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://element-hq.github.io/synapse
GNU Affero General Public License v3.0
1.38k stars 161 forks source link

`register_new_matrix_user` can't deal with unix socket listeners #16390

Open matrixbot opened 9 months ago

matrixbot commented 9 months ago

This issue has been migrated from #16390.


Description

I have configured an unix-socket as a listener in homeserver.yaml, without listening on ports, on a newly configured synapse instance.

This way, register_new_matrix_user crashes.

Steps to reproduce

Homeserver

self-hosted synapse

Synapse Version

1.92.1

Installation Method

Other (please mention below)

Database

single pgsql 15.4, fresh setup

Workers

Single process

Platform

archlinux arm

Configuration

listeners:
  - path: /run/synapse/homeserver.sock
    mode: 660
    type: http
    resources:
      - names: [client, federation]

Relevant log output

not relevant

Anything else that would be useful to know?

Error Traceback:

Traceback (most recent call last):
  File "/usr/bin/register_new_matrix_user", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/synapse/_scripts/register_new_matrix_user.py", line 247, in main
    server_url = _find_client_listener(config)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/synapse/_scripts/register_new_matrix_user.py", line 309, in _find_client_listener
    return f"http://localhost:{listener['port']}"
                               ~~~~~~~~^^^^^^^^
KeyError: 'port'
mikezackles commented 9 months ago

In case it helps someone, I worked around this by having my reverse proxy also listen for requests to ^/_synapse/admin on 127.0.0.1.