bashclub/zamba-lxc-toolbox

Matrix install

Knoff88 opened this issue · 3 comments

Hallo
Nach der config Einstellung: nano conf/zamba.conf
startete ich: bash install.sh -i 106
Option: 5
Bei Verwendung dieses Skriptes kam am Ende dies:
CREATE ROLE
CREATE DATABASE
Postgres User 'synapse_user' and database 'synapse_db' created.
No 'registration_shared_secret' or 'registration_shared_secret_path' defined in config.

Matrix und Element läuft, aber beim Login kommt:
Inkorrekter Nutzername und/oder Passwort.

In der Mitte kam noch ein roter Text:
13 main 5432 down postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log

darin steht:
2023-01-02 16:49:32.119 CET [10461] LOG: PostgreSQL 13.9 (Debian 13.9-0+deb11u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit startet
2023-01-02 16:49:32.119 CET [10461] LOG: erwarte Verbindungen auf IPv6-Adresse »::1«, Port 5432
2023-01-02 16:49:32.119 CET [10461] LOG: erwarte Verbindungen auf IPv4-Adresse »127.0.0.1«, Port 5432
2023-01-02 16:49:32.120 CET [10461] LOG: erwarte Verbindungen auf Unix-Socket »/var/run/postgresql/.s.PGSQL.5432«
2023-01-02 16:49:32.123 CET [10462] LOG: Datenbanksystem wurde am 2023-01-02 16:49:31 CET heruntergefahren
2023-01-02 16:49:32.127 CET [10461] LOG: Datenbanksystem ist bereit, um Verbindungen anzunehmen
2023-01-02 16:49:56.781 CET [12386] synapse_user@synapse_db WARNUNG: eine Transaktion ist bereits begonnen

Verwendung auf Proxmox 7.3-3
Container Template: Debian-11-Standard_11.3-1

Die reverseProxy Einstellung wurde zu: matrix.domain.com und element.domain.com auf port: 443 eingestellt.

Danke und freundliche Grüsse

Eigentlich sollte die /etc/matrix-synapse/homeserver.yaml bzw. die Option registration_shared_secret entsprechend befüllt werden.

Generierung von registration_shared_secret - Siehe https://github.com/bashclub/zamba-lxc-toolbox/blob/main/src/matrix/install-service.sh#L11

Schreiben/Ersetzen des Default Values - Siehe https://github.com/bashclub/zamba-lxc-toolbox/blob/main/src/matrix/install-service.sh#L138

aber anscheinend existiert dieser Standardwert nicht - deswegen wird da auch nichts ersetzt. ;)

Als Quickfix kannst du einfach folgendes Kommando ausführen:
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1

und das anschließend in die /etc/matrix-synapse/homeserver.yaml packen:

[...]
registration_shared_secret: cLcZkIRYxuBgwgNsGSbfSAL8jsA9Y6XJ

Ist kein registration_shared_secret in der /etc/matrix-synapse/homeserver.yaml gesetzt, verweigert "register_new_matrix_user" die Registrierung mit der o.g. Meldung.

Anschließend einmal den Dienst mittels "systemctl restart matrix-synapse" neustarten und dann einen Admin-User anlegen:

https://github.com/bashclub/zamba-lxc-toolbox/blob/main/src/matrix/install-service.sh#L147 (Variablen entsprechend definieren bzw. durch Werte austauschen)

Beispiel:
register_new_matrix_user -a -u admin -p 'Start!123' -c /etc/matrix-synapse/homeserver.yaml http://127.0.0.1:8008

und das wird dann auch prompt von Matrix erfolgreich durchgeführt:

root@matrix:~# register_new_matrix_user -a -u admin -p 'Start!123' -c /etc/matrix-synapse/homeserver.yaml http://127.0.0.1:8008
Sending registration request...
Success!
jppw commented

Moin,

bei mir ist das Problem noch da.

Toolbox frisch gecloned.

Zustand direkt nach Installation:

Secret fehlt.

root@matrix:/# cat /etc/matrix-synapse/homeserver.yaml
pid_file: "/var/run/matrix-synapse.pid"
listeners:

  • port: 8008
    tls: false
    type: http
    x_forwarded: true
    bind_addresses: ['::1', '127.0.0.1']
    resources:
    • names: [client, federation]
      compress: false
      database:
      name: psycopg2
      args:
      database: synapse_db
      user: synapse_user
      password: B25f7nzEZJfu3rJOv67OuOeF22tEj8Cf
      host: 127.0.0.1
      cp_min: 5
      cp_max: 10
      log_config: "/etc/matrix-synapse/log.yaml"
      media_store_path: /var/lib/matrix-synapse/media
      signing_key_path: "/etc/matrix-synapse/homeserver.signing.key"
      trusted_key_servers:
  • server_name: "matrix.org"

Wenn ich nach Anleitung weiter oben das Secret hinzufüge, Matrix stoppe und dann versuche einen Benutzer anzulegen lehnt er die Verbindung ab.

`root@matrix:/# systemctl stop matrix-synapse
root@matrix:/# register_new_matrix_user -a -u administrator -p 'Start!123' -c /etc/matrix-synapse/homeserver.yaml http://127.0.0.1:8008
Traceback (most recent call last):
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/urllib3/connection.py", line 244, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/lib/python3.9/http/client.py", line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.9/http/client.py", line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.9/http/client.py", line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.9/http/client.py", line 1010, in _send_output
self.send(msg)
File "/usr/lib/python3.9/http/client.py", line 950, in send
self.connect()
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fa820b32be0>: 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 "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8008): Max retries exceeded with url: /_synapse/admin/v1/register (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa820b32be0>: 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 "/bin/register_new_matrix_user", line 8, in
sys.exit(main())
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/synapse/_scripts/register_new_matrix_user.py", line 266, in main
register_new_user(
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/synapse/_scripts/register_new_matrix_user.py", line 150, in register_new_user
request_registration(
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/synapse/_scripts/register_new_matrix_user.py", line 53, in request_registration
r = requests.get(url, verify=False)
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/opt/venvs/matrix-synapse/lib/python3.9/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8008): Max retries exceeded with url: /_synapse/admin/v1/register (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa820b32be0>: Failed to establish a new connection: [Errno 111] Connection refused'))`