Mailsecure
Premade - after install reply.
Hello, I have activated MailSecure for the DOMAINSHERE domain. You'll begin to see emails coming in with a [spam] tag in the subject line; these are the emails the firewall found to be suspicious or spam-like. All of these emails should also be automatically filtered to your spam folder under every email account on this domain. Please let us know if you have any questions or concerns, or if the service is not working as expected.
Make domain list(put the domains the want in here)
vim /root/mailsecurelist
Run this for loop to use the domain list to backup each domains zone file, then remove the old mx entries, and add the new ones as well as update the ttls and serials all at once.
for i in `cat mailsecurelist`; do sed -i.lwbak -e '/IN[[:space:]]*MX/d' /var/named/$i.db; echo "$i. 300 IN MX 0 bmx01.sourcedns.com." >> /var/named/$i.db; echo "$i. 300 IN MX 0 bmx02.sourcedns.com." >> /var/named/$i.db; sed -i -e 's/^\$TTL.*/$TTL 300/g' -e 's/[0-9]\{10\}/'`date +%Y%m%d%H`'/g' /var/named/$i.db; done
test work
for i in `cat /root/mailsecurelist`; do grep --color "\$TTL" /var/named/$i.db; grep --color -e '[0-9]\{10\}' /var/named/$i.db; egrep --color 'IN[[:space:]]*MX' /var/named/$i.db; done
Reload name server.
rndc reload