YunoHost-Apps / mautrix_signal_ynh

Matrix signal package for YunoHost
GNU Affero General Public License v3.0
4 stars 10 forks source link

Bridge permission issue in config.yaml after upgrade to version 0.6.2~ynh1 #108

Closed CodeShakingSheep closed 3 months ago

CodeShakingSheep commented 5 months ago

Describe the bug

After upgrade to version 0.6.2~ynh1 my messages weren't bridged anymore. While investigating I saw that the following permissions were written to config.yaml which was the root cause.

    # Permissions for using the bridge.
    # Permitted values:
    #    relay - Talk through the relaybot (if enabled), no access otherwise
    #     user - Access to use the bridge to chat with a Signal account.
    #    admin - User level and some additional administration tools
    # Permitted keys:
    #        * - All Matrix users
    #   domain - All users on that homeserver
    #     mxid - Specific user
    permissions:
        "*": relay
        "domain": user
        "Your;main;Matrix;account": admin

I found that the config.yaml template attempts to dynamically set these values based on BOTSUERS and BOTADMIN. See https://github.com/YunoHost-Apps/mautrix_signal_ynh/blob/master/conf/config.yaml#L283 . In manifest.toml the defined default values are the exact values in my config.yaml (domain and Your main Matrix account). See https://github.com/YunoHost-Apps/mautrix_signal_ynh/blob/master/manifest.toml#L65 .

I could fix it by stopping mautrix_signal systemd service, altering config.yaml and starting mautrix_signal systemd service. Afterwards everything was working fine again.

    # Permissions for using the bridge.
    # Permitted values:
    #    relay - Talk through the relaybot (if enabled), no access otherwise
    #     user - Access to use the bridge to chat with a Signal account.
    #    admin - User level and some additional administration tools
    # Permitted keys:
    #        * - All Matrix users
    #   domain - All users on that homeserver
    #     mxid - Specific user
    permissions:
        "*": relay
        "<MY_SYNAPSE_DOMAIN>": user
        "@<MY_USERNAME>:<MY_SYNAPSE_DOMAIN>": admin

Note that after the upgrade to version 0.6.1~ynh1 I also had to manually adopt those values.

Context

Steps to reproduce

I just hit the upgrade button in webadmin to upgrade from version 0.6.1~ynh to 0.6.2~ynh1.

Expected behavior

I believe that the install questions in manifest.toml have been introduced recently and apparently they aren't set in my app. I think introducting a config_panel where I could set these values would solve the issue long-term. Any other short-term solutions so that these values aren't overwritten after each upgrade?

Logs

A bunch of error messages related to the bridge permission issue such as

Jun 18 16:45:51 mautrix-signal[990187]: 2024-06-18T16:45:51Z ERR Failed to fetch profile error="error getting profile (unsuccessful status code 401)" action="fetch contact then try and update with profile" function=Puppet.UpdateInfo profile_aci=e861c0e4-469a-4dd0-9f14-1b67c2c6bf47 signal_user_id=e861c0e4-469a-4dd0-9f14-1b67c2c6bf47 user_id=@<MY_USERNAME>:<MY_SYNAPSE_DOMAIN>
Jun 18 16:45:54 mautrix-signal[990187]: 2024-06-18T16:45:54Z ERR Failed to fetch profile error="error getting profile (unsuccessful status code 401)" action="fetch contact then try and update with profile" function=Puppet.UpdateInfo profile_aci=7ccbb714-494d-424b-a7a7-569feeb55352 signal_user_id=7ccbb714-494d-424b-a7a7-569feeb55352 user_id=@<MY_USERNAME>:synapse.<MY_SYNAPSE_DOMAIN>
CodeShakingSheep commented 3 months ago

For anybody else stumbling into this, I could solve this by manually setting the values:

source /usr/share/yunohost/helpers && ynh_app_setting_set --app="mautrix_signal" --key="botadmin" --value="@<MY_USERNAME>:<MY_SYNAPSE_DOMAIN>" && ynh_app_setting_set --app="mautrix_signal" --key="botusers" --value="<MY_SYNAPSE_DOMAIN>"