From f933144e60c7051d5ee2779b0d6a1800260f362c Mon Sep 17 00:00:00 2001 From: myve Date: Mon, 25 Mar 2024 07:15:45 -0600 Subject: [PATCH] Update mail-aio.sh --- mail-aio.sh | 80 ++++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 44 deletions(-) diff --git a/mail-aio.sh b/mail-aio.sh index f2dbe18..0319b36 100644 --- a/mail-aio.sh +++ b/mail-aio.sh @@ -922,7 +922,7 @@ ln -s /etc/nginx/sites-available/mail.conf /etc/nginx/sites-enabled/ # Certbot systemctl -q disable --now apache2.service systemctl -q reload nginx.service -/etc/init.d/php*-fpm reload +/etc/init.d/php*-fpm reload >/dev/null until certbot --nginx --agree-tos --redirect --hsts --no-eff-email --staple-ocsp -m ${eff_email} -d ${subdomain}.${domain} do @@ -954,44 +954,33 @@ ln -s /usr/share/webapps/roundcube/bin/cleandb.sh /etc/cron.daily/roundcube-clea echo -e '\n\e[1;34mInstalling Postwhite\e[0m' /usr/local/bin/postwhite/postwhite -# echo -e '\n\e[1;34mRestarting system services...\e[0m' -# /etc/init.d/php*-fpm restart -# systemctl -q restart postfix.service dovecot.service opendkim.service opendmarc.service nginx.service mariadb.service fail2ban.service - -# # Check DKIM key -# while : -# do -# if opendkim-testkey -d ${domain} -s default -# then -# echo -e '\n\e[1;32mDKIM key has been verified!\e[0m' -# break -# fi -# sleep 5 -# done & -# disown - su ${username} <<"CHANGEUSER" - # SSH - yes | ssh-keygen -t ed25519 -q -f ~/.ssh/id_ed25519 -P "" - echo "${sshkeys}" >~/.ssh/authorized_keys - # Home directory mods - echo -e '\nif [ -f ~/.bash_history ] -then - rm -f ~/.bash_history -fi +# SSH +yes | ssh-keygen -t ed25519 -q -f ~/.ssh/id_ed25519 -P "" +echo "${sshkeys}" >~/.ssh/authorized_keys +# Home directory mods +cat >>~/.bashrc </dev/null } function mail-check @@ -1019,30 +1008,31 @@ function mail-check function mail-test { - systemctl stop postfix dovecot + sudo systemctl stop postfix dovecot read -n 1 -s -p $'\nPress any key to continue...\n' - systemctl start postfix dovecot && + sudo systemctl start postfix dovecot && mail-watch } # SSH pubkey access function ssh-on { - sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config.d/10-personal-sshd.conf - systemctl -q restart sshd + sudo sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config.d/10-personal-sshd.conf + sudo systemctl -q restart sshd } function ssh-off { - sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config.d/10-personal-sshd.conf - systemctl -q restart sshd -}' >> ~/.bashrc + sudo sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config.d/10-personal-sshd.conf + sudo systemctl -q restart sshd +} +bashrc install /dev/stdin ~/dhparam >/dev/null <<'dhparam' #!/usr/bin/env bash echo - # Create certificates +# Create certificates echo -e '\e[1;34mGenerating DH parameters with openssl\e[0m' echo -e '\e[3m# a notification will pop up once completed\e[0m' @@ -1052,15 +1042,17 @@ echo -e '\n\n\e[1;32mOpenssl certificates have successfully been generated!\e[0m rm ${0} dhparam CHANGEUSER - clear - # In your DNS manager, create a TXT record, enter default._domainkey in the name field - echo -e '\e[1;34mUpdate DKIM TXT on DNS registrar and press any key to continue\e[5m...\e[0m' - echo -e '\e[3m# Use default._domainkey in the host field' - echo -e '# Visit https://www.dmarcanalyzer.com/dkim/dkim-checker/ to check manually\e[0m' - cat /etc/opendkim/keys/${domain}/default.txt | sed 's/.*( //' | sed 's/ ).*//' | sed 's/"//g' | sed 's/^[ \t]*//g' | sed ':a;N;$!ba;s/\n//g' +clear - cat <