processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/en/ejabberd/
Other
6.07k stars 1.51k forks source link

Matrix gateway not working: Confusion with Ids to use #4172

Open chstoltz opened 6 months ago

chstoltz commented 6 months ago

Environment

Configuration

[...]
  -
    port: 8448
    module: ejabberd_http
    tls: true
    request_handlers:
      "/_matrix": mod_matrix_gw
[...]
s2s_access: s2s
[...]
access_rules:
[...]
  s2s:
    allow: all
[...]
  mod_matrix_gw:
    matrix_domain: "jabjab.de"
    key_name: "key1"
    key: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
[...]

Errors from error.log/crash.log

No errors

Bug description

I can't send/receive messages to/from a matrix.org account.

If I send a message from ejabberd to matrix, the debug log shows s.th. like this:

2024-03-08 12:55:02.285510+01:00 [notice] <0.1805.0> (tls|<0.1805.0>) Received XML on stream = <<"<message xmlns=\"jabber:client\" to=\"XXXXXXX@matrix.org\" type=\"chat\" id=\"64b4373b-dff9-4372-87b5-62a05a4004af\"><body>test</body><origin-id xmlns=\"urn:xmpp:sid:0\" id=\"64b4373b-dff9-4372-87b5-62a05a4004af\" /><request xmlns=\"urn:xmpp:receipts\" /><markable xmlns=\"urn:xmpp:chat-markers:0\" /></message>">>
         to = #jid{user = <<"XXXXXXX">>,server = <<"matrix.org">>,
                   resource = <<>>,luser = <<"XXXXXXX">>,
         to = #jid{user = <<"XXXXXXX">>,server = <<"matrix.org">>,
                   resource = <<>>,luser = <<"XXXXXXX">>,
2024-03-08 12:55:02.323089+01:00 [notice] <0.1882.0> (tls|<0.1882.0>) Send XML on stream = <<"<message xml:lang='en' to='XXXXXXX@matrix.org' from='admin@jabjab.de/Work' type='chat' id='64b4373b-dff9-4372-87b5-62a05a4004af'><origin-id xmlns='urn:xmpp:sid:0' id='64b4373b-dff9-4372-87b5-62a05a4004af'/><request xmlns='urn:xmpp:receipts'/><markable xmlns='urn:xmpp:chat-markers:0'/><body>test</body></message>">>

The webclient of app.element.io recieves nothing.

If I send a message from matrix.org to myself, the message returns like an echo. My chat window in gajim stays empty.

I already tried to set a specific host in the modules section, but that didn't work either. If I do a service discovery with Gajim, the matrix gateway is listed but greyed out.

Screenshot_20240308_132608

The federationtester is all green, so it must be a problem on my side I think.

What am I missing?

licaon-kter commented 6 months ago

you've read https://www.process-one.net/blog/matrix-gateway-setup-with-ejabberd/ I guess?

chstoltz commented 6 months ago

Yes, I did. Actually I waited for this post to be published. I couldn't figure out how to get this working since last saturday.

The only difference I can see: I am using the top level cert option instead of including the certfile in the listener block.

centertivevier commented 6 months ago

I have the same problem, but with one change. I can send from my Matrixserver x1.eu to xmpp.eu. The messages was post at conversations. But rewrite to the jid (i see this one in conversation) test%x1.eu@matrixx.xmpp.eu and ejabberd give me the message "host-unknown". The mode is set to implicit.

Neustradamus commented 6 months ago

From ejabberd MUC Room:

neox: Hi there. I don't have a github account so I can't answer here: https://github.com/processone/ejabberd/issues/4172

My observation is that when matrix_id_as_jid is set to true, matrix users are reachable with user1@domain1.com and not user%remotedomain.com@matrix.xmppdomain.com, and when implicit routing is enabled that's user%remotedomain.com@matrix.xmppdomain.com that is working !

neox: I tested it and reproduced it many times this week