From 2aae4d854a49cc3ab69bb8b4188375b052b7a806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 22 Feb 2024 22:17:10 +0100 Subject: [PATCH] Add main domain into hosts file For apps which send mail (or receive) which need a valid TLS certificate the way to make it work is to pass a valid domain (and not localhost), so the target domain match with the provided certificate. But postfix and dovecot refuse app authentication from external IP. So we need to force the request on local interface (with the public domain). --- hooks/conf_regen/43-dnsmasq | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hooks/conf_regen/43-dnsmasq b/hooks/conf_regen/43-dnsmasq index 90e3ed2d7e..4eca107f1d 100755 --- a/hooks/conf_regen/43-dnsmasq +++ b/hooks/conf_regen/43-dnsmasq @@ -83,6 +83,11 @@ do_post_regen() { short_hostname=$(hostname -s) grep -q "127.0.0.1.*$short_hostname" /etc/hosts || echo -e "\n127.0.0.1\t$short_hostname" >>/etc/hosts + # For SMTP connexion from apps wich request valid certificate we need to force main domain to point to localhost ip + # because connexion on external ip is forbinden by mail server for apps. + main_domain=$(yunohost domain main-domain --output-as plain) + grep -q "127.0.0.1.*$main_domain" /etc/hosts || echo -e "\n127.0.0.1\t$main_domain" >>/etc/hosts + [[ -n "$regen_conf_files" ]] || return 0 # Remove / disable services likely to conflict with dnsmasq