YunoHost-Apps / gotosocial_ynh

GoToSocial package for YunoHost: an ActivityPub social network server, written in Golang.
https://gotosocial.org
Other
10 stars 5 forks source link

changing "SMTP From Address" doesn't update /etc/postfix/app_senders_login_maps #149

Open chri2 opened 3 weeks ago

chri2 commented 3 weeks ago

Describe the bug

Changing "SMTP From Address" on the config panel didn't change the entry in /etc/postfix/app_senders_login_maps which allows the $app user to use the given email address as its sender address.

chri2 commented 3 weeks ago

I guess it would be needed to call this after the field in the config panel has been changed: https://github.com/YunoHost/yunohost/blob/bd43a4504e715a84cc769ce17caed1356a0d59c3/hooks/conf_regen/19-postfix#L83

This would rebuild the config for all apps, but I didn't find a function/helper to just change on entry of /etc/postfix/app_senders_login_maps.

I still do not know whether I can use bind in config_panel.toml and define a custom setter function to write the value via bind and execute some additional action.

Simplest way would be to re-create the postfix-file each time the panels values are saved.

chri2 commented 3 weeks ago

Starting writing two helpers to add and delete entries from /etc/postfix/app_senders_login_maps to fix this.

Update: Just found that the setting for email sender is named smtp_from. It would be helpful to have it stored in mail_domain & mail_user so conf regen doesn't confuse things. We'd need a custom setter script for the setting(s).

chri2 commented 3 weeks ago

Adding these settings manually didn't work like this:

yunohost app setting gotosocial mail_user -v <email sender user part>
yunohost app setting gotosocial mail_domain -v <email sender domain part>
python3 -c 'from yunohost.app import regen_mail_app_user_config_for_dovecot_and_postfix as r; r(only="postfix")'

Maybe something missing in the manifest?

OniriCorpe commented 3 weeks ago

this setting is intented for people who would like to use an external service to send GTS automated mails, it has not been thought for the usage you are describing :/

chri2 commented 3 weeks ago

this setting is intented for people who would like to use an external service to send GTS automated mails, it has not been thought for the usage you are describing :/

Clearly. But if there is no external mail service it breaks things.

I'll put a email sender field into the config panel for flohmarkt, because I realized that not everybody is running there own email. So I'll need some solution for this also. My thoughts until now look like this:

I'm thinking about a good way to extend the conf_regen part to recognize that the general code should put other emails than mail_user>@<mail_domain into app_senders_login_maps (maybe some field like interpret the following list of fields as sender addresses the app wants to use ).

OniriCorpe commented 3 weeks ago

Clearly. But if there is no external mail service it breaks things.

tbh, i don't understand why someone would change this configuration if yunohost can send mails and is usually used for this

otherwise, we can just add a warning here not to use these settings without using an external mail provider?