Explorar o código

Fix for DKIM key permission after restoring backup

dpeca %!s(int64=9) %!d(string=hai) anos
pai
achega
7815539e91
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      bin/v-restore-user

+ 12 - 0
bin/v-restore-user

@@ -517,6 +517,13 @@ if [ "$mail" != 'no' ] && [ ! -z "$MAIL_SYSTEM" ]; then
         domains=$(echo "$backup_domains" |egrep -f $tmpdir/selected.txt)
     fi
 
+    # Checking exim username for later chowning
+    exim_user="exim";
+    check_exim_username=$(grep -c '^Debian-exim:' /etc/passwd)
+    if [ "$check_exim_username" -eq 1 ]; then
+        exim_user="Debian-exim"
+    fi
+
     # Restoring dns domain
     for domain in $domains; do
         echo -e "$(date "+%F %T") $domain" |tee -a $tmpdir/restore.log
@@ -579,6 +586,11 @@ if [ "$mail" != 'no' ] && [ ! -z "$MAIL_SYSTEM" ]; then
                     -exec chown -h $user:mail {} \;
             fi
         fi
+
+        # Chowning mail conf files to exim user
+        find $HOMEDIR/$user/conf/mail/$domain_idn -user root \
+            -exec chown $exim_user {} \;
+
     done
 fi