how to fix cpanel spf and dkim generator scripts for my configuration


Mar 3, 2008
cPanel Access Level
Root Administrator
I just added a hardware firewall in front of my dedicated server running WHM. I manually edited all of the DNS records to use the public WAN ip and figured I can just edit any new account records at the time I set them up. Then I noticed the IP address was part of the spf and dkim TXT entries.

The problem is I have 81 DNS zones on this server. All were generated for the accounts via Cpanel's feature (that automatically populates the DNS records for the domain and all subdomains, and many of my sites have numerous subdomains). So manually editing all of those records... not a great option.

So, I am hoping to find a way to customize Cpanel so it will use the public IP in dkim and spf generation.

I've avoided any kind of hacks to this point so I also need to find out if there is an override system or some way to manage the changed files to avoid having my changes get overwritten on update.


Staff member
Apr 11, 2011
Hello :)

You could try using a command to edit a specific entry in all of the DNS Zones on your server. There is a similar thread on this here:

Changing All NS Records

It discusses this for NS records, but the same principle applies to any entry in a zone file.

Thank you.