added CMSHook for postfix module and updated conf
CMSHook wil be inplemented so CMS releated Module configuration, this wil be loaded when using appendCMS and the main intaller
This commit is contained in:
@@ -10,7 +10,11 @@ sed -i "/^inet_interfaces =/c\inet_interfaces = loopback-only" /etc/postfix/main
|
||||
sed -i "/recipient_delimiter =/c\recipient_delimiter = +" /etc/postfix/main.cf
|
||||
sed -i "/^mydestination =/c\mydestination = \"$hostname\", localhost.\"$hostname\", \"$hostname\"" /etc/postfix/main.cf
|
||||
echo "$hostname" > /etc/mailname
|
||||
echo "bounce_notice_recipient = info@$domain" >> /etc/postfix/main.cf
|
||||
if [ "$(echo "$hostname" | grep -o "\." | wc -l)" -eq 1 ]; then
|
||||
echo "bounce_notice_recipient = admin@$hostname" >> /etc/postfix/main.cf
|
||||
else
|
||||
echo "bounce_notice_recipient = admin@$(sed 's/.*\.\(.*\..*\)/\1/' <<< $hostname)" >> /etc/postfix/main.cf
|
||||
fi
|
||||
cat <<EOF > /etc/aliases
|
||||
# See man 5 aliases for format
|
||||
postmaster: root
|
||||
@@ -34,6 +38,7 @@ adduser postfix opendkim
|
||||
mkdir /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
|
||||
dkimname sed 's/\..*$//' <<< "$url"
|
||||
cat <<EOF > /etc/opendkim/TrustedHosts
|
||||
127.0.0.1
|
||||
::1
|
||||
@@ -53,11 +58,21 @@ if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist
|
||||
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
|
||||
unset odksec
|
||||
|
||||
|
||||
cat << EOF > /etc/update-motd.d/51-generalSPF
|
||||
#!/bin/sh
|
||||
red='\e[1;31m%s\e[0m\n'
|
||||
printf "\n"
|
||||
printf \$red "To enable mail for this server add \"ip4:\$(curl -s -4 icanhazip.com) ip6:\$(curl -s -6 icanhazip.com)\" to $hostname SPF"
|
||||
printf \$red "to enable DKKIM for the hostname run bash ~/OpenDKIMInit-host.sh"
|
||||
printf \$red "remove notice this by running \"rm /etc/update-motd.d/51-generalSPF\""
|
||||
printf "\n"
|
||||
EOF
|
||||
@@ -65,3 +80,12 @@ chmod +x /etc/update-motd.d/51-generalSPF
|
||||
|
||||
systemctl start postfix opendkim
|
||||
systemctl enable postfix opendkim
|
||||
|
||||
#if using Append module run for existing cms/sites
|
||||
if [ -z "${postfixappended}" ]; then
|
||||
for sitename in /etc/ICTM/sites/*; do
|
||||
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)
|
||||
done
|
||||
fi
|
||||
Reference in New Issue
Block a user