adjust system_aliases and enable userforward

This commit is contained in:
Matthew Saunders Brown 2024-03-14 15:25:44 -07:00
parent ee02317ed5
commit 6d176d0900
2 changed files with 30 additions and 20 deletions

View File

@ -944,9 +944,15 @@ virtual_alias_catchall:
# listed below are the same as are used for .forward files; you might want
# to set up different ones for pipe and file deliveries from aliases.
# System Aliases, and User Forwards below, are only enabled for primary_hostname & qualify_domain.
# primary_hostname is the server hostname (FQDN)
# qualify_domain can be set in exim_local.conf and defaults to the server domain name,
# which is the primary_hostname without the local part - what "hostname -d" returns.
# These routers do not get invoked for any other virtual email domains configured on the server.
system_aliases:
driver = redirect
domains = +local_domains
domains = $primary_hostname:$qualify_domain
allow_fail
allow_defer
data = ${lookup{$local_part}lsearch{/etc/aliases}}
@ -973,17 +979,18 @@ system_aliases:
# forwarding generates a direct delivery to a file, or to a pipe, or sets
# up an auto-reply, respectively.
#userforward:
# driver = redirect
# check_local_user
# file = $home/.forward
# no_verify
# no_expn
# check_ancestor
## allow_filter
# file_transport = address_file
# pipe_transport = address_pipe
# reply_transport = address_reply
userforward:
driver = redirect
check_local_user
domains = $primary_hostname:$qualify_domain
file = $home/.forward
no_verify
no_expn
check_ancestor
allow_filter
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply
# This router matches local user mailboxes.

View File

@ -44,6 +44,14 @@ if [ ! -d "/etc/mysql/" ]; then
mysql -e "CREATE USER 'nagios'@'localhost' IDENTIFIED WITH mysql_native_password AS '';"
mysqladmin flush-privileges
elif ! systemctl is-active --quiet mysql ; then
echo "MySQL config dir exists, but MySQL/MariaDB server is not running."
echo "Check your server config and either make sure MySQL is running"
echo "or purge MySQL/MariaDB and all related packages (e.g. mysql-common)"
echo "from the server and then re-run this installer."
exit 1
fi
# create vmail user & db
@ -186,17 +194,12 @@ fi
if [[ -d /etc/fail2ban/ ]]; then
chmod 644 etc/fail2ban/*/*.conf
cp -a etc/fail2ban/* /etc/fail2ban/
sed -i "s|postmaster|postmaster@$maildomain|g" /etc/fail2ban/action.d/mail-ratelimit.conf
echo
echo "Fail2ban rate limit will email postmaster@$maildomain."
echo "Change postmaster@$maildomain in /etc/fail2ban/action.d/mail-ratelimit.conf to suit your needs."
else
echo
echo "fail2ban not installed, skipping fail2ban email configs."
fi
echo "root: webmaster@$maildomain" >> /etc/aliases
echo
echo "Email for root user notifications are configured to go to webmaster@$maildomain."
echo "Update /etc/aliases to suit your needs."
echo "webmaster@$maildomain" > /root/.forward
echo "System emails are configured to forward to webmaster@$maildomain."
echo "Adjust /etc/aliases & /root/.forward as desired."