element-hq / element-hq/element-docker-demo

Unable to create new users

Open
#10 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
169
Forks
30
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Unable to create new users using the command:

`docker compose exec mas mas-cli -c /data/config.yaml manage register-user`

Initially, my web browsers could connect to the server and establish video conferences but they distrusted the service, because of issues related to certificates, so I had to manually access and accept all domains (matrix.example.com, element.example.com, livekit.example.com, livekit-jwt.example.com, call.example.com).

I managed to install trusted certificates and now it seems that every domain is right (for the root one I had to explicitly add a new part in the add.conf file of nginx), but I cannot create new users using the corresponding command. I could do this before the new certificates, but now there is an error (I guess is related to MAS). For example, one of the new errors is:

```
ERROR homeserver.is_localpart_available{matrix.homeserver="example.com" matrix.localpart="sbd"}:http.client.request{otel.kind="client" http.request.method="GET" url.full=https://matrix.example.com/_synapse/admin/v1/username_available?username=sbd server.address="matrix.example.com" server.port=443 network.transport="tcp"}: rustls_platform_verifier::verification::others: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-platform-verifier-0.5.0/src/verification/others.rs:185: failed to verify TLS certificate: invalid peer certificate: UnknownIssuer
? Username › ERROR homeserver.is_localpart_available{matrix.homeserver="example.com" matrix.localpart="sbd"}: mas_matrix_synapse: crates/matrix-synapse/src/lib.rs:201: error=Failed to query localpart availability from Synapse

Caused by:
0: error sending request for url (https://matrix.example.com/_synapse/admin/v1/username_available?username=sbd)
1: client error (Connect)
2: invalid peer certificate: UnknownIssuer
WARN mas_cli::commands::manage: crates/cli/src/commands/manage.rs:530: Invalid username: Failed to query localpart availability from Synapse
```

Using this following command:

`sudo docker compose exec mas mas-cli -c /data/config.yaml doctor`

I had a similar error:

```
NFO cli.doctor: mas_cli::commands::doctor: crates/cli/src/commands/doctor.rs:32: 💡 Running diagnostics, make sure that both MAS and Synapse are running, and that MAS is using the same configuration files as this tool.
ERROR cli.doctor:http.client.request{otel.kind="client" http.request.method="GET" url.full=https://example.com/.well-known/matrix/client server.address="example.com" server.port=443 network.transport="tcp"}: rustls_platform_verifier::verification::others: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-platform-verifier-0.5.0/src/verification/others.rs:185: failed to verify TLS certificate: invalid peer certificate: UnknownIssuer WARN cli.doctor: mas_cli::commands::doctor: crates/cli/src/commands/doctor.rs:167: ⚠️ Failed to fetch well-known document at "https://example.com/.well-known/matrix/client".
This means that the homeserver is not reachable, the well-known document is not available, or malformed.
Make sure your homeserver is running.
Make sure going to "https://example.com/.well-known/matrix/client" in a web browser returns a valid JSON document, similar to:

{
"m.homeserver": {
"base_url": "..."
},
"org.matrix.msc2965.authentication": {
"issuer": "https:/example.com/",
"account": "https://auth.example.com/account/"
}
}

See https://element-hq.github.io/matrix-authentication-service/setup/homeserver.html

Error details: error sending request for url (https://example.com/.well-known/matrix/client)

ERROR cli.doctor:http.client.request{otel.kind="client" http.request.method="GET" url.full=https://example.com/_matrix/client/versions server.address="matrix.example.com" server.port=443 network.transport="tcp"}: rustls_platform_verifier::verification::others: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-platform-verifier-0.5.0/src/verification/others.rs:185: failed to verify TLS certificate: invalid peer certificate: UnknownIssuer
ERROR cli.doctor: mas_cli::commands::doctor: crates/cli/src/commands/doctor.rs:214: ❌ Can't reach the homeserver at "https://matrix.example.com/_matrix/client/versions".
This may be due to a misconfiguration in the `matrix` section of the config.

matrix:
homeserver: "example.com"
# The homeserver should be reachable at this URL
endpoint: "https://matrix.d4d.space/"

See https://element-hq.github.io/matrix-authentication-service/setup/homeserver.html

Error details: error sending request for url (https://matrix.example.com/_matrix/client/versions)

ERROR cli.doctor:http.client.request{otel.kind="client" http.request.method="GET" url.full=https://matrix.example.com/_matrix/client/v3/login server.address="matrix.d4d.space" server.port=443 network.transport="tcp"}: rustls_platform_verifier::verification::others: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-platform-verifier-0.5.0/src/verification/others.rs:185: failed to verify TLS certificate: invalid peer certificate: UnknownIssuer WARN cli.doctor: mas_cli::commands::doctor: crates/cli/src/commands/doctor.rs:413: ⚠️ Can't reach the legacy login API at "https://matrix.example.com/_matrix/client/v3/login".
This means legacy clients won't be able to login.
Make sure MAS is running.
Check your reverse proxy settings to make sure that this API is handled by MAS, not by Synapse.

See https://element-hq.github.io/matrix-authentication-service/setup/reverse-proxy.html

Error details: error sending request for url (https://matrix.example.com/_matrix/client/v3/login)
```

**Expected behavior**
Be able to create new users. My best guess is that this is related to nginx, MAS and the certificates. However, I found this strange as I can access to all the domains (matrix.example.com, element.example.com, livekit.example.com, livekit-jwt.example.com, call.example.com).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the docker compose service configuration, /data/config.yaml, and the nginx add.conf changes described in the report. Run mas-cli doctor first, then compare its certificate and endpoint failures with the register-user error. Done means the diagnostics can reach the homeserver and new users can be created without UnknownIssuer errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, nginx
Domain
devops, infrastructure, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.