matrix-org / sydent

Sydent: Reference Matrix Identity Server
http://matrix.org
Apache License 2.0
293 stars 84 forks source link

Unable to contact the Matrix homeserver (ResponseNeverReceived) register 500 error #591

Open thoompje opened 4 months ago

thoompje commented 4 months ago

Hello,

Can anyone help me out with my configuration. Here is the error I got:

Error log

temp@webje:/etc/matrix-sydent/sydent-env# sydent --config /etc/matrix-sydent/sydent-env/sydent.conf --verbose
WARNING: You have not specified a server name. I have guessed that this server is called 'webje'. If this is incorrect, you should edit 'general.server.name' in the config file.
WARNING: The path specified by 'general.templates.path' (res) does not exist.
2024-05-28 21:43:35,385 - sydent.sydent - 87 - INFO - Starting Sydent server
2024-05-28 21:43:35,385 - sydent.db.sqlitedb - 32 - INFO - Using DB file sydent.db
2024-05-28 21:43:35,387 - sydent.http.httpcommon - 53 - WARNING - No HTTPS private key / cert found: not starting replication server or doing replication pushes
2024-05-28 21:43:35,393 - sydent.http.httpserver - 187 - INFO - Starting Client API HTTP server on :::8090
2024-05-28 21:43:35,394 - twisted - 147 - INFO - Site starting on 8090
2024-05-28 21:43:35,395 - twisted - 147 - INFO - Starting factory <twisted.web.server.Site object at 0x7f92b7110358>
2024-05-28 21:43:37,088 - twisted - 147 - INFO - "::1" - - [28/May/2024:19:43:36 +0000] "GET /_matrix/identity/v2 HTTP/1.1" 200 2 "-" "Element/1.11.9 (iPhone 14 Pro; iOS 17.5.1; Scale/3.00)"
2024-05-28 21:43:37,100 - twisted - 147 - INFO - "::1" - - [28/May/2024:19:43:36 +0000] "GET /_matrix/identity/v2 HTTP/1.1" 200 2 "-" "Element/1.11.9 (iPhone 14 Pro; iOS 17.5.1; Scale/3.00)"
2024-05-28 21:43:37,134 - twisted - 147 - INFO - "::1" - - [28/May/2024:19:43:36 +0000] "GET /_matrix/identity/v2/terms HTTP/1.1" 200 16 "-" "Element/1.11.9 (iPhone 14 Pro; iOS 17.5.1; Scale/3.00)"
2024-05-28 21:43:38,470 - sydent.http.matrixfederationagent - 353 - INFO - Fetching https://ee2e.domain.tld./.well-known/matrix/server
2024-05-28 21:43:38,504 - twisted - 147 - INFO - Starting factory _HTTP11ClientFactory(<function HTTPConnectionPool._newConnection.<locals>.quiescentCallback at 0x7f92b709f620>, <twisted.internet.endpoints._WrapperEndpoint object at 0x7f92b7091c88>)
2024-05-28 21:43:38,521 - sydent.http.matrixfederationagent - 362 - INFO - Response from .well-known: {'m.server': 'ee2e.domain.tld:8008'}
2024-05-28 21:43:38,550 - sydent.http.matrixfederationagent - 405 - INFO - Endpoint created with b'ee2e.domain.tld':8008
2024-05-28 21:43:38,550 - sydent.http.matrixfederationagent - 410 - INFO - Connecting to ee2e.domain.tld:8008
2024-05-28 21:43:38,554 - twisted - 147 - INFO - Starting factory _HTTP11ClientFactory(<function HTTPConnectionPool._newConnection.<locals>.quiescentCallback at 0x7f92b709f6a8>, <twisted.internet.endpoints._WrapperEndpoint object at 0x7f92b682b278>)
2024-05-28 21:43:43,523 - twisted - 147 - INFO - Stopping factory _HTTP11ClientFactory(<function HTTPConnectionPool._newConnection.<locals>.quiescentCallback at 0x7f92b709f620>, <twisted.internet.endpoints._WrapperEndpoint object at 0x7f92b7091c88>)
x2024-05-28 21:44:37,101 - twisted - 147 - INFO - Timing out client: IPv6Address(type='TCP', host='::1', port=33036, flowInfo=0, scopeID=0)
2024-05-28 21:44:37,136 - twisted - 147 - INFO - Timing out client: IPv6Address(type='TCP', host='::1', port=33042, flowInfo=0, scopeID=0)
2024-05-28 21:44:38,557 - sydent.http.servlets.registerservlet - 72 - WARNING - Unable to contact the Matrix homeserver (ResponseNeverReceived)
2024-05-28 21:44:38,558 - twisted - 147 - INFO - "::1" - - [28/May/2024:19:44:38 +0000] "POST /_matrix/identity/v2/account/register HTTP/1.1" 500 100 "-" "Element/1.11.9 (iPhone 14 Pro; iOS 17.5.1; Scale/3.00)"

Config Sydent

[DEFAULT]
server.name = identity.domain.tld
log.path = /etc/matrix-sydent/sydent-env/sydent.log
log.level = DEBUG
pidfile.path = sydent.pid
terms.path =
address_lookup_limit = 10000
templates.path = res
brand.default = matrix-org
enable_v1_associations = true
delete_tokens_on_bind = true
ip.blacklist =
ip.whitelist = 172.25.1.50
homeserver_allow_list =
enable_v1_access = true
db.file = sydent.db
clientapi.http.bind_address = ::
clientapi.http.port = 8090
internalapi.http.bind_address = ::1
internalapi.http.port =
replication.https.certfile =
replication.https.cacert =
replication.https.bind_address = ::
replication.https.port = 4434
obey_x_forwarded_for = False
federation.verifycerts = True
client_http_base =
email.from = Sydent Validation <identity@domain.tld>
email.subject = Your Validation Token
email.invite.subject = %(sender_display_name)s has invited you to chat
email.invite.subject_space = %(sender_display_name)s has invited you to a space
email.smtphost = localhost
email.smtpport = 25
email.smtpusername =
email.smtppassword =
email.hostname =
email.tlsmode = 0
email.default_web_client_location = https://app.element.io
email.third_party_invite_username_obfuscate_characters = 3
email.third_party_invite_domain_obfuscate_characters = 3
bodytemplate = Your code is {token}
username =
password =
#ed25519.signingkey = 

[general]
ip.whitelist = 172.15.10.10
homeserver_url = https://ee2e.domain.tld:8008
[db]

[http]

[email]

[sms]

[crypto]

ed25519.signingkey = ed25519 0 qFnE7h+I

[logging]
level = DEBUG

[homeserver]
base_url = https://ee2e.domain.tld:8008

[identity_server]
base_url = https://identity.domain.tld

Config Matrix


#enable_registration: true
#registration_shared_secret: "xxxxxx"
macaroon_secret_key: "9Ey2ssdasdasdasdw2r6E="
enable_registration: true
enable_registration_without_verification: true
server_name: "ee2e.domain.tld"
#media_store_path: "/mnt/matrix"
account_threepid_delegates:
  msisdn: "https://identity.domain.tld"
enable_3pid_changes: true
pid_file: "/var/run/matrix-synapse.pid"
listeners:
  - port: 8008
    tls: false
    type: http
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client, federation]
        compress: false
database:
  name: psycopg2
  args:
    user: synapse_user
    password: xxxxxxx
    database: synapse_db_new_correct
    host: localhost
    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"
trusted_third_party_id_servers:
  - "identity.domain.tld"

.well-known/matrix/server

{
  "m.server": "ee2e.domain.tld:8008"
  }

Apache Matrix config

<VirtualHost *:80>
    ServerName ee2e.domain.tld
    DocumentRoot /var/www/matrix

    RewriteEngine On
    RewriteCond %{SERVER_NAME} =ee2e.domain.tld
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    <Directory "/var/www/matrix/.well-known">
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:443>
    ServerName ee2e.domain.tld
    DocumentRoot /var/www/matrix

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/ee2e.domain.tld/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/ee2e.domain.tld/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf

    RequestHeader set X-Forwarded-Proto "https"
    ProxyPreserveHost On

    # Ensure the .well-known directory is served by Apache
    <Location /.well-known>
        ProxyPass !
    </Location>
    <Directory "/var/www/matrix/.well-known">
        AllowOverride None
        Require all granted
    </Directory>

    # Redirect all other traffic to Synapse
    ProxyPass /_matrix http://localhost:8008/_matrix
    ProxyPassReverse /_matrix http://localhost:8008/_matrix
    ProxyPass /_synapse/client http://localhost:8008/_synapse/client
    ProxyPassReverse /_synapse/client http://localhost:8008/_synapse/client

    # Federation traffic
    ProxyPass /_matrix/federation/v1 http://localhost:8448/_matrix/federation/v1
    ProxyPassReverse /_matrix/federation/v1 http://localhost:8448/_matrix/federation/v1
</VirtualHost>

<VirtualHost *:8448>
    ServerName ee2e.domain.tld
    DocumentRoot /var/www/matrix

   # RewriteEngine On
   # RewriteCond %{SERVER_NAME} =ee2e.domain.tld
   # RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    <Directory "/var/www/matrix/.well-known">
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

Apache config Sydent

<VirtualHost *:80>
    ServerName identity.domain.tld
    DocumentRoot /var/www/matrix

    # Redirect HTTP to HTTPS
    RewriteEngine On
    RewriteCond %{SERVER_NAME} =identity.domain.tld
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    <Directory "/var/www/matrix/.well-known">
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:443>
    ServerName identity.domain.tld
    DocumentRoot /var/www/matrix

    # Enable SSL
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/identity.domain.tld/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/identity.domain.tld/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf

    RequestHeader set X-Forwarded-Proto "https"
    ProxyPreserveHost On

    # Ensure the .well-known directory is served by Apache
    <Directory "/var/www/matrix/.well-known">
        AllowOverride None
        Require all granted
    </Directory>

    # Matrix Identity Server
    ProxyPass /_matrix/identity http://localhost:8090/_matrix/identity
    ProxyPassReverse /_matrix/identity http://localhost:8090/_matrix/identity
</VirtualHost>

Please help me out! Many thanks already, cheers!

thoompje commented 4 months ago

Is there anyone who can help with this? I am totally stuck in what to do next :)

reivilibre commented 4 months ago

It's having trouble connecting to ee2e.domain.tld:8008. You could try connecting with curl from the same machine curl https://ee2e.domain.tld:8008 and seeing what happens.