Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If matrix_domain contains @HOST@, this isn't replaced when using the option #4167

Closed
badlop opened this issue Feb 28, 2024 · 0 comments
Closed
Assignees

Comments

@badlop
Copy link
Member

badlop commented Feb 28, 2024

Reported in the ejabberd chatroom by Arcanicanis:

There seems to be a bug where server_name in /_matrix/key/v2/server will be listed literally as "@HOST@" if matrix_domain isn't set for mod_matrix_gw.

And to clarify, I mean as the string literal @HOST@, and not the intended substitution (the server's default hostname).

It's easy to reproduce, simply use ejabberd 24.02 and configure

listen:
  - 
    port: 8448
    module: ejabberd_http
    tls: true
    request_handlers:
      "/_matrix": mod_matrix_gw

modules:
  mod_matrix_gw:
    key_name: "key1"
    key: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    matrix_id_as_jid: true

And visiting https://localhost:8448/_matrix/key/v2/server returns as result:

{
 "verify_keys":{"ed25519:key1":{"key":"ftd/itbHcx5iqJ/IUhcDXA+QVQJjqUIe04EoUQO/ODU"}},
 "valid_until_ts":1709719180881,
 "signatures":{"@HOST@": {"ed25519:key1":"bpgphjYuYYB5BU..."}},
 "server_name":"@HOST@",
 "old_verify_keys":{}
}

In fact, setting the option matrix_domain: "@HOST@.aaa" will make the page show "server_name":"@HOST@.aaa".

It seems mod_matrix lacks a call to misc:expand_keyword(<<"@HOST@">>, Domain, Host) in the proper place...

@badlop badlop changed the title When matrix_domain not set, @HOST@ isn't replaced in server_name If matrix_domain contains @HOST@, this isn't replaced when using the option Feb 28, 2024
@badlop badlop self-assigned this Feb 28, 2024
@badlop badlop added this to the ejabberd 24.xx milestone Feb 28, 2024
@badlop badlop closed this as completed Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant