PDA

View Full Version : How to bulk update SPF DNS record on all cpanel account DNS zones



Fli
02-22-2018, 11:22 PM
Hello,

i was interested to know how to simply do this. Edit SPF DNS record in all cPanel account's DNS zone files.

I read i have to change serial numbers in DNS zone files too in order to changes take effect.

And here is what i found:

method 1.

cd /var;cp -rp named named.backup_datehere
sed -i "s|spf1 |spf1 valueiwantedtoadd |g" *.db
go to WHM/DNS functions/Set Zone Time To Live (TTL) and select all domains (click first entry, hold shift key and click last entry) change TTL number a bit, example from 3600 to 3610 and apply change. It will change serial numbers in all zones and that is all needed to do

method 2.

https://forums.cpanel.net/threads/mass-update-spf.431371/#post-1744281

method 3.

https://documentation.cpanel.net/display/68Docs/The+spf_installer+Script

example script to run it on all accounts once single account test was successfull:

for user in `ls -A /var/cpanel/users` ; do
echo "Working with user $user"
/usr/local/cpanel/bin/spf_installer $user ......
echo "sleep 1" && sleep 1; done

kumkum
10-09-2021, 03:57 PM
Thanks for explaining about bulk SPF record on server.
DKIM record are also protect from spamming, you can easily enable them from WHM panel.
1. Login to WHM.
2. Click on "Modify an account".
3. Here you have to check the box "Enable DKIM on this account." for DKIM and "Enable SPF on this account." for SPF record.
4. At last click on "Save".

You can also do enable DKIM and SPF records in command line (https://hoststud.com/resources/how-to-enable-spf-and-dkim-for-all-new-creating-cpanel-accounts-from-whm.342/).