-
27
Apr
This how to describe how to add domainkeys and SPF (Sender Policy Framework) records on CPanel Servers. Whenever you create a domain on CPanel server using WHM, it wont add domainkeys and SPF records for particular domains. To add domainkeys and SPF records please use following steps.
We consider here we have a domain sohailriaz.com with cpanel username sohailri
Please note on CPanel servers most of the work is done using cpanel username which then reflect setting on particular domains. If you have several domains / sub domains under one username, it will add domainkeys and SPF records for all domains / subdomains.
Execute the following command on your CPanel server using root.
1 DomainKeys
1.1 Add DomainKeys for single user
/usr/local/cpanel/bin/domain_keys_installer sohailri
where sohailri is a username
1.2 Add DomainKeys for all CPanel users.
If you wish to add DomainKeys for all Cpanel users on your server, execute following command.
ls /var/cpanel/users | while read a; do
/usr/local/cpanel/bin/domain_keys_installer $a
done
2 SPF (Sender Policy Framework)
2.1 Add SPF for single account.
/usr/local/cpanel/bin/spf_installer sohailri
2.2 Add SPF for all Cpanel accounts.
If you want to add SPF records for all cpanel accounts exist on your server then use the following command.
ls /var/cpanel/users | while read a; do
/usr/local/cpanel/bin/spf_installer $a
done
3 Enable DomainKeys and SPF for every new CPanel account.
If you want to add DomainKeys and SPF for every new account created on Cpanel, then do the following.
vi /scripts/postwwwacct
postwwwacct is a file which execute after wwwacct (used to create account), paste following lines in the file
#!/usr/bin/perl
my %OPTS = @ARGV;
$ENV{USER} = “$OPTS{‘user’}”;
system q(/usr/local/cpanel/bin/domain_keys_installer $USER);
system q(/usr/local/cpanel/bin/spf_installer $USER);
Happy Mailing
If you have any question / suggestion please comment.
- Published by Sohail Riaz in: CPanel / WHM DNS Linux
- If you like this blog please take a second from your precious time and subscribe to my rss feed!











9 Responses to “How To Add DomainKeys and SPF Records on CPanel Servers”
is there any solution if i just want to execute the script for specific hosting package?
The scripts which i used is developed by CPanel and they uses users as a input to install SPF or Domainkey for the specific user.
You can see the /var/cpanel/users directory and check for any user for your specific hosting package. You should see some unique in that user file for that hosting package.
Then you have to developed your own script which first take out the users name which are in any specific hosting package and then you can run above commands on those users to generate SPF and DomainKeys.
admin said :
Then you have to developed your own script which first take out the users name which are in any specific hosting package and then you can run above commands on those users to generate SPF and DomainKeys.
thats exactly what im asked before
the main idea is, i want to execute other script [not spf-ing] while creating new hosting account. and the script only apply for specific hosting plan [package].
1. is there any clue on what file i have to attach my script?
2. what keyword i should use for comparison?
thanks
It contains all the info you will need.
http://twiki.cpanel.net/twiki/bin/view/AllDocumentation/ScriptHooks
Regards,
hai there, howsa goin
finally i did it the script :
http://cuap.dit.web.id/index.php/2009/08/06/tentukan-batas-pengiriman-imel-per-jam-sesuai-paket-hosting-saat-membuat-akun-hosting-baru-dari-whm/
thx for your information back there…
cat /var/cpanel/users | while read a; do /usr/local/cpanel/bin/domain_keys_installer $a; done
The above command does not work with me:
/var/cpanel/users: is a directory
Any ideas?
@Osama: Sorry for mistake the command is like this
ls /var/cpanel/users | while read a; do /usr/local/cpanel/bin/domain_keys_installer $a; done
————-
I have fixed in the blog too. Please use the command as above and go with post again, it will execute fine.
————–
Regards,
hai…
too bad my server crashed [hard disk drive],
and all the research on my blog is gone
@Sohail: thanks for the correction. I had already ran it by using *for* instead of *while*.
—–
for user in `ls /var/cpanel/users`; do /usr/local/cpanel/bin/domain_keys_installer $user; done
—-
Leave a Reply