diff --git a/SubModules/postfix/CMSHook-conf.sh b/SubModules/postfix/CMSHook-conf.sh index 5164b4a..38e4efc 100644 --- a/SubModules/postfix/CMSHook-conf.sh +++ b/SubModules/postfix/CMSHook-conf.sh @@ -1,15 +1,15 @@ #ADD DOMAIN -sudo --user opendkim mkdir /etc/opendkim/keys/"$maildomain" -sudo --user opendkim opendkim-genkey -r -D /etc/opendkim/keys/"$maildomain" -d "$maildomain" -s vps -echo "$maildomain" >> /etc/opendkim/TrustedHosts -echo "vps._domainkey."$maildomain" "$maildomain":vps:/etc/opendkim/keys/"$maildomain"/vps.private" >> /etc/opendkim/KeyTable +sudo --user opendkim mkdir /etc/opendkim.d/keys/"$maildomain" +sudo --user opendkim opendkim-genkey -r -D /etc/opendkim.d/keys/"$maildomain" -d "$maildomain" -s vps +echo "$maildomain" >> /etc/opendkim.d/TrustedHosts +echo "vps._domainkey."$maildomain" "$maildomain":vps:/etc/opendkim.d/keys/"$maildomain"/vps.private" >> /etc/opendkim.d/KeyTable if [ $webserv != nginx_nonphp ]; then echo "php_admin_value[mail.force_extra_parameters] = \"-f$mailas -F'$maildomain'\"" >> "$phpPoolDir"/"$sitename".conf fi -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/config/opendkim-init.sh -o ~/OpenDKIMInit-$sitename.sh +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/opendkim-init.sh -o ~/OpenDKIMInit-$sitename.sh sed -i -e 's/DOMAINname/'$domain'/' 's/SITEName/'$sitename'/' ~/OpenDKIMInit-$sitename.sh cat << EOF > /etc/update-motd.d/51-opendkim-"$sitename" diff --git a/SubModules/postfix/conf.sh b/SubModules/postfix/conf.sh index 6970ec2..1959030 100644 --- a/SubModules/postfix/conf.sh +++ b/SubModules/postfix/conf.sh @@ -37,10 +37,11 @@ EOF ##--------------## adduser postfix opendkim -mkdir -p /etc/opendkim/keys -chown opendkim:opendkim /etc/opendkim/keys -R -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/config/opendkim.conf -o /etc/opendkim.conf -cat < /etc/opendkim/TrustedHosts +rm -rm /etc/opendkim.d +mkdir -p /etc/opendkim.d/keys +chown opendkim:opendkim /etc/opendkim.d/keys -R +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/config/opendkim.conf -o /etc/opendkim.d.conf +cat < /etc/opendkim.d/TrustedHosts 127.0.0.1 ::1 localhost @@ -54,17 +55,17 @@ if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist mkdir /var/spool/postfix/opendkim sudo chown opendkim:postfix /var/spool/postfix/opendkim sed -i "/^RUNDIR=/c\RUNDIR=/var/spool/postfix/var/run/opendkim" /etc/default/opendkim - echo "TrustAnchorFile /usr/share/dns/root.key" >> /etc/opendkim/conf + echo "TrustAnchorFile /usr/share/dns/root.key" >> /etc/opendkim.d/conf bash /lib/opendkim/opendkim.service.generate systemctl daemon-reload fi odksec=$(sed 's/\..*$//' <<< $hostname) -sudo --user opendkim mkdir /etc/opendkim/keys/"$hostname" -sudo --user opendkim opendkim-genkey -r -D /etc/opendkim/keys/"$hostname" -d "$hostname" -s $odksec -echo ""$odksec"._domainkey."$hostname" "$hostname":"$odksec":/etc/opendkim/keys/"$hostname"/"$odksec".private" >> /etc/opendkim/KeyTable -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/config/opendkim-init.sh -o ~/OpenDKIMInit-host.sh -sed -i -e 's/DOMAINname/'$hostname'/' 's/SITEName/'host'/' 's/vps/'$odksec'/' ~/OpenDKIMInit-host.sh +sudo --user opendkim mkdir /etc/opendkim.d/keys/"$hostname" +sudo --user opendkim opendkim-genkey -r -D /etc/opendkim.d/keys/"$hostname" -d "$hostname" -s $odksec +echo ""$odksec"._domainkey."$hostname" "$hostname":"$odksec":/etc/opendkim.d/keys/"$hostname"/"$odksec".private" >> /etc/opendkim.d/KeyTable +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/opendkim-init.sh -o ~/OpenDKIMInit-host.sh +sed -i -e 's/DOMAINname/'$hostname'/' -e 's/SITEName/'host'/' 's/vps/'$odksec'/' ~/OpenDKIMInit-host.sh unset odksec @@ -87,7 +88,7 @@ if [ ! -z "${postfixappended}" ]; then for file in /etc/ICTM/sites/*; do sitename="${file##*/}" domain=${sitename//_/.} - source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/appendCMS-preconf.sh) - source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/appendCMS-conf.sh) + source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/CMSHook-preconf.sh) + source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/CMSHook-conf.sh) done fi \ No newline at end of file diff --git a/SubModules/postfix/config/opendkim.conf b/SubModules/postfix/config/opendkim.conf index 9446ba4..799422c 100644 --- a/SubModules/postfix/config/opendkim.conf +++ b/SubModules/postfix/config/opendkim.conf @@ -6,7 +6,7 @@ OversignHeaders From UserID opendkim Canonicalization relaxed/simple Mode s -KeyTable refile:/etc/opendkim/KeyTable -SigningTable refile:/etc/opendkim/SigningTable -ExternalIgnoreList refile:/etc/opendkim/TrustedHosts -InternalHosts refile:/etc/opendkim/TrustedHosts +KeyTable refile:/etc/opendkim.d/KeyTable +SigningTable refile:/etc/opendkim.d/SigningTable +ExternalIgnoreList refile:/etc/opendkim.d/TrustedHosts +InternalHosts refile:/etc/opendkim.d/TrustedHosts diff --git a/SubModules/postfix/opendkim-init.sh b/SubModules/postfix/opendkim-init.sh index ba52059..8460fc8 100644 --- a/SubModules/postfix/opendkim-init.sh +++ b/SubModules/postfix/opendkim-init.sh @@ -2,7 +2,7 @@ if [ -n "$1" ]; then if [[ "$1" = "--enable" ]]; then echo "Enableing DKIM" - echo "*@DOMAINname vps._domainkey.DOMAINname" >>/etc/opendkim/SigningTable + echo "*@DOMAINname vps._domainkey.DOMAINname" >>/etc/opendkim.d/SigningTable systemctl reload opendkim #Remove script while true; do @@ -26,7 +26,7 @@ echo "Optional to enable dkim" echo "ip4:$(curl -s -4 icanhazip.com) ip6:$(curl -s -6 icanhazip.com)" echo "Please add the folloing TXT Record to the DNS of DOMAINname" echo "WARNING the output is split, please combine key before inserting into DNS" -cat /etc/opendkim/keys/DOMAINname/vps.txt +cat /etc/opendkim.d/keys/DOMAINname/vps.txt echo "" echo "If DNS is propegated then run \"bash $0 --enable\""