From 6d176d0900e398cd3781695d66cf72eb0a067490 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Thu, 14 Mar 2024 15:25:44 -0700 Subject: [PATCH] adjust system_aliases and enable userforward --- etc/exim4/exim4.conf | 31 +++++++++++++++++++------------ install.sh | 19 +++++++++++-------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/etc/exim4/exim4.conf b/etc/exim4/exim4.conf index 9c7a604..ea2f2d0 100644 --- a/etc/exim4/exim4.conf +++ b/etc/exim4/exim4.conf @@ -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. diff --git a/install.sh b/install.sh index 3c023ae..85f2ccd 100755 --- a/install.sh +++ b/install.sh @@ -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."