Page tree
Skip to end of metadata
Go to start of metadata

Overview

The /usr/local/cpanel/bin/spf_installer script allows you to add an SPF record to all of a user's domains' zone files from the command line. For more information about SPF records, read our Authentication documentation.

Note:

The /scripts/enable_spf_dkim_globally script allows you to enable SPF and DKIM for existing accounts on the server, and create the appropriate DNS records for their domains. For more information, read our The SPF and DKIM Global Settings Script documentation.

The /bin/spf_installer script

To use this script, run the following command:

/usr/local/cpanel/bin/spf_installer username policy complete overwrite preserve

This example uses the following variables:

Variable
Description
Example
usernameThe username to whose domains you wish to assign SPF records.cpaneluser
policyA comma-delimited list of SPF records that you wish to assign to or remove from the user's domains.
v=spf1 +a +mx +ip4:192.0.2.0/24,-ip4:203.0.113.5,+ip6:2001:db8:1a34::/64
complete

Whether the SPF key is a complete SPF entry (ends with -all).

  • A value of 1 indicates that the spf_key option's value is a complete SPF record.
  • A value of 0 indicates that the spf_key option's value is not a complete SPF record.

    Important:

    This option is required when you use the overwrite and preserve options.

1
overwrite

Whether to overwrite the existing domains' and subdomains' SPF records with the value of the policy option.

  • A value of 1 indicates that you wish to overwrite the user's current SPF records.
  • A value of 0 indicates that you do not wish to overwrite the user's current SPF records.

    Important:

    This option is required when you use the preserve option.

1
preserve

Whether to add the new set of keys to the existing records.

  • A value of 1 indicates that you wish to append the policy option's value to the user's current SPF records.
  • A value of 0 indicates that you wish to replace the user's current SPF record with the policy option's value.
0

Arguments

The /usr/local/cpanel/bin/spf_installer script accepts the following arguments:

Argument
Description
Example
--help Displays the help text for this script. help

Success and failure

If the function does not succeed, you will receive the following error message:

Failed to set up SPF for this user.

If the function succeeds, you will not receive confirmation from the command line. To confirm that the function succeeded, navigate to cPanel's Authentication interface (Home >> Email >> Authentication) for each domain that the user owns.

Additional documentation