Fixed Postfix permission issue
This commit is contained in:
parent
8e08b982e5
commit
842e927ccc
1 changed files with 18 additions and 2 deletions
|
@ -101,8 +101,24 @@ if command -v postfix > /dev/null; then
|
|||
logg info 'Forward user e-mail to root@localhost'
|
||||
echo '{{ .user.username }}: root' | sudo tee -a /etc/aliases > /dev/null
|
||||
fi
|
||||
logg info 'Running newaliases to regenerate the alias database'
|
||||
sudo newaliases
|
||||
|
||||
### Ensure old /etc/aliases.db is removed
|
||||
if [ -f /etc/aliases.db ]; then
|
||||
logg info 'Ensuring /etc/aliases.db is removed' && sudo rm -f /etc/aliases.db
|
||||
else
|
||||
logg info '/etc/aliases.db was not found'
|
||||
fi
|
||||
|
||||
### Re-generate the /etc/aliases.db file
|
||||
if [ -f /etc/aliases ]; then
|
||||
logg info 'Ensuring proper permissions on the /etc/aliases file' && chown $(stat -c "%U:%G" /etc/sudoers) /etc/aliases
|
||||
logg info 'Generating Postfix aliases' && sudo postalias /etc/aliases
|
||||
else
|
||||
logg warn '/etc/aliases is missing which is required for Postfix'
|
||||
fi
|
||||
# The `sudo newaliases` mode is probably used to regenerate the /etc/aliases.db
|
||||
# but since we are removing it to ensure proper permissions, this method is commented out.
|
||||
# logg info 'Running newaliases to regenerate the alias database' && sudo newaliases
|
||||
else
|
||||
logg warn '/etc/aliases does not appear to exist'
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue