How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

December 16, 2012

How to update DomainKeys on a cpanel server with existing accounts

Filed under: Linux — Tags: , , , — admin @ 2:30 pm

Hello ,
Well, I have a main server with cpanel , because is easy to make e-mail account’s there , and other server for other big sites. So basically I create account on cpanel server and after that I move ip to point to other server.
However if you server crash and you restore the cpanel account it appear that cpanel rebuild the dns zone, and you have to work twice, to redo the ip to old server .
If is one domain is easy but if you have a few , then a solution is to, restore /var/named files from backup that you made, and /etc/named.conf. After this what I do was to chattr +i /var/named/*.db . In this way cpanel will keep my old configuration. However your cpanel serve will create new dkim files for you, and you will have old values on your *.db files.
So, how we fix that ?
Firs of all when the restore is done make then movable again chattr -i /var/named/*.db
After this just run :
for user in `ls -A /var/cpanel/users` ; do /usr/local/cpanel/bin/dkim_keys_uninstall $user ; done
This will erase old dkim configuration for you, when is done run :
for user in `ls -A /var/cpanel/users` ; do /usr/local/cpanel/bin/dkim_keys_uninstall $user ; done

Now you have all information updated . Off course you should use those generated files from /var/cpanel/domain_keys on other server if you send mail from there also .

Best regards

Powered by WordPress