Open ivoruetsche opened 11 months ago
...in the mean time, I understand, that "matrix-registration" and "matrix-registration-bot" has no relation between (as the documentation mention on "matrix-registration" - sorry, my fault...), so I didn't need "matrix-registration", just "matrix-registration-bot". I can generate the tokens via the "matrix-registration-bot" and can use it for new users on the login page, maybe it would be nice to have it in the documentation, how to use the tokens.
Because we deploy more Matrix servers, we would like to let the script run without manual tasks, but if we execute "a brand new server (without importing data)", the script stops with this error:
$ ansible-playbook -i inventory/hosts setup.yml --tags=install-all,ensure-matrix-users-created,start
...
TASK [custom/matrix-user-creator : Ensure Synapse user registered - bot.matrix-registration-bot] ******************************************************************************************************************
fatal: [matrix.urig.digital]: FAILED! => changed=false
cmd:
- /usr/bin/env
- docker
- exec
- matrix-synapse
- register_new_matrix_user
- -u
- bot.matrix-registration-bot
- -p
- abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz12
- -c
- /data/homeserver.yaml
- --admin
- http://localhost:8008
delta: '0:00:01.539306'
end: '2023-12-31 12:30:37.085822'
failed_when_result: true
msg: non-zero return code
rc: 1
start: '2023-12-31 12:30:35.546516'
stderr: |-
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 203, in _new_conn
sock = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
raise err
File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 791, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 497, in _make_request
conn.request(
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 395, in request
self.endheaders()
File "/usr/local/lib/python3.11/http/client.py", line 1289, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.11/http/client.py", line 1048, in _send_output
self.send(msg)
File "/usr/local/lib/python3.11/http/client.py", line 986, in send
self.connect()
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 243, in connect
self.sock = self._new_conn()
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 218, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f2aa28f7a90>: Failed to establish a new connection: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 845, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8008): Max retries exceeded with url: /_synapse/admin/v1/register (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2aa28f7a90>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/register_new_matrix_user", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/local/lib/python3.11/site-packages/synapse/_scripts/register_new_matrix_user.py", line 266, in main
register_new_user(
File "/usr/local/lib/python3.11/site-packages/synapse/_scripts/register_new_matrix_user.py", line 150, in register_new_user
request_registration(
File "/usr/local/lib/python3.11/site-packages/synapse/_scripts/register_new_matrix_user.py", line 53, in request_registration
r = requests.get(url)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8008): Max retries exceeded with url: /_synapse/admin/v1/register (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2aa28f7a90>: Failed to establish a new connection: [Errno 111] Connection refused'))
stderr_lines: <omitted>
stdout: ''
stdout_lines: <omitted>
...
When I try to create the user (as root) manually, it works:
$ docker exec matrix-synapse register_new_matrix_user -u bot.matrix-registration-bot -p abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz12 -c /data/homeserver.yaml --admin http://localhost:8008
Sending registration request...
Success!
Then we let the ansible script running again and end's without errors.
Thanks a lot Ivo
Having same problem: matrix-registration is not working anymore (we have benn warned). matrix-registration-bot does not create user @bot.matrix-registration-bot:DOMAIN and thus can't be used. Even after creating user and giving admin persissions, bot would not accept invite.
I just saw that registration tokens can also be created in synapse-admin. You can use this until the bot is working again
Hi all
I struggling with the user registration part "matrix-registration" and "matrix-registration-bot". If I setup a complete new server and I set the matrix_bot_matrix_registration_bot_enabled to "true", the script can't add the user, so I set it to false, add the bot user manually and add the bot separate with the ansible script, then, it works.
Then, I create a now Token with the matrix-registration-bot, but if a new user will register with the generated token, the GUI points to the Token field ans say's "Please match the requested format.". If I try to generate the token with the "generate-matrix-registration-token" tag, the GUI says:
Error There was an error while trying to register you. Token Error Token is invalid
I think I didn't understand anything correct, or I forgot something?
my inventory/host_vars/matrix.urig.digital/vars.yml: