Mod:Postfix Added basic SSL/TLS support

This commit is contained in:
2021-08-26 15:20:31 +02:00
parent 98c5429f00
commit 4238e78ac1
2 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
#Sript for setting up SSL/TLS for Postfix (Web-V2)
##Loading install vars
source /etc/ICTM/mainvar.list
##Checking if hostname cert exists
if [ ! -f "/etc/acmesh/inst/$hostname/cert.pem" ] || [ ! -f "/etc/acmesh/inst/$hostname/key.pem" ] ; then echo 'SSL Certificate for $hostname is not installed' && exit ; fi
##Updating Postix config
printf "Updating Postfix config"
systemctl stop postfix
sed -i "/smtpd_tls_cert_file=/c\ssmtpd_tls_cert_file=/etc/acmesh/inst/$hostname/cert.pem" /etc/postfix/main.cf
sed -i "/smtpd_tls_key_file=/c\smtpd_tls_key_file=/etc/acmesh/inst/$hostname/key.pem" /etc/postfix/main.cf
systemctl start postfix
printf " [\e[1;32m Ok \e[0m]\n"
##Adding postfix to SSL services (so it gets reloaded when a the cert is renewd)
printf "Updating SSL services list"
echo "postfix" >> /etc/ICTM/SslServices
printf " [\e[1;32m Ok \e[0m]\n"
##Remove script
while true; do
read -p "Remove this script -> yes/no?" yn
case $yn in
[Nn]* )
break;;
[Yy]* )
rm -- "$0"
break;;
* )echo "Choose yes or no.";;
esac
done

View File

@@ -90,6 +90,9 @@ chmod +x /etc/update-motd.d/51-generalspf
systemctl start postfix opendkim systemctl start postfix opendkim
systemctl enable postfix opendkim systemctl enable postfix opendkim
#Getting script for enableling ssl on Postfix
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/Postfix-EnableSSL.sh -o ~/Postfix-EnableSSL.sh
#if using Append module run for existing cms/sites #if using Append module run for existing cms/sites
if [ "$itype" = "AddMod" ]; then if [ "$itype" = "AddMod" ]; then
for file in /etc/ICTM/sites/*; do for file in /etc/ICTM/sites/*; do