Thursday, March 11, 2010

DomainKeys and SPF

If you want to add DomainKeys and SPF for every new account created on Cpanel, then do the following.

----------------------------------------------------------

Add DomainKeys for single user

/usr/local/cpanel/bin/domain_keys_installer username

-----------------------------------------------------------

Add DomainKeys for all CPanel users.

If you wish to add DomainKeys for all Cpanel users on your server, execute following command.

cat /var/cpanel/users | while read a; do
/usr/local/cpanel/bin/domain_keys_installer $a
done

----------------------------------------------------------

Add SPF for single Cpanel accounts.

/usr/local/cpanel/bin/spf_installer username
------------------------------------------------------------

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.

cat /var/cpanel/users | while read a; do
/usr/local/cpanel/bin/spf_installer $a
done

--------------------------------------------------------

ADD SPF record while creating new accounts from WHM >>create account option.

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’}”;

#For domain key
system q(/usr/local/cpanel/bin/domain_keys_installer $USER);

#for spf record
system q(/usr/local/cpanel/bin/spf_installer $USER);

********

save it and restart cpanel service.


And create account from WHM and check DNS once the account is created. You will the SPF record is added automatically.