From 9156b1e56af2dba336305557c4f2146a7c798bc8 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 14 Sep 2020 17:54:20 +0200 Subject: [PATCH] Fix warnings and weird stuff >_> --- data/hooks/conf_regen/19-postfix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/data/hooks/conf_regen/19-postfix b/data/hooks/conf_regen/19-postfix index 67ca22991..29787576e 100755 --- a/data/hooks/conf_regen/19-postfix +++ b/data/hooks/conf_regen/19-postfix @@ -27,22 +27,21 @@ do_pre_regen() { # Add possibility to specify a relay # Could be useful with some isp with no 25 port open or more complex setup export relay_host="$(yunohost settings get 'smtp.relay.host')" - if [ ! -z "${relay_host}" ]; then + if [ -n "${relay_host}" ] + then export relay_port="$(yunohost settings get 'smtp.relay.port')" export relay_user="$(yunohost settings get 'smtp.relay.user')" relay_password="$(yunohost settings get 'smtp.relay.password')" # Avoid to display "Relay account paswword" to other users touch ${postfix_dir}/sasl_passwd - chmod o=--- ${postfix_dir}/sasl_passwd + chmod 750 ${postfix_dir}/sasl_passwd # Avoid "postmap: warning: removing zero-length database file" chown postfix ${pending_dir}/etc/postfix chown postfix ${pending_dir}/etc/postfix/sasl_passwd cat <<< "[${relay_host}]:${relay_port} ${relay_user}:${relay_password}" > ${postfix_dir}/sasl_passwd postmap ${postfix_dir}/sasl_passwd - - fi export main_domain export domain_list="$YNH_DOMAINS" @@ -67,8 +66,12 @@ do_pre_regen() { do_post_regen() { regen_conf_files=$1 - chmod o=--- /etc/postfix/sasl_passwd* - chown postfix /etc/postfix/sasl_passwd* + + if [ -e /etc/postfix/sasl_passwd ] + then + chmod 750 /etc/postfix/sasl_passwd* + chown postfix:root /etc/postfix/sasl_passwd* + fi [[ -z "$regen_conf_files" ]] \ || { service postfix restart && service postsrsd restart; }