The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

rebuild spf records

Discussion in 'E-mail Discussions' started by urgido, Jan 2, 2016.

  1. urgido

    urgido Well-Known Member

    Joined:
    Jul 19, 2005
    Messages:
    66
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hi
    I am unable to run this:

    root@cdd [/var/cpanel/users]# for i in `ls /var/cpanel/users` ;do
    /usr/local/cpanel/bin/spf_installer $i ;done

    OUTPUT:

    Code:
    Usage: /usr/local/cpanel/bin/spf_installer <user> [policy [is-complete
    [overwrite [preserve]]]]
    
    Installs an SPF policy in TXT records for the given user's domains.
    
    Note: The following will be prepended to the policy: +a +mx +ip4:<main-IP>.
    
    Options:
    <user> User whose domains will receive the SPF record.
    
    <policy>
    Comma delimited list of SPF mechanisms to include in the
    policy, e.g. '+ip4:192.0.2.0/24,-ip4:203.0.113.5'.
    Default: ""
    
    <is-complete>
    Indicates whether the policy represents a complete record,
    that is, whether it should terminate with "-all". Use "1"
    to indicate that it is; otherwise, use "0". Default: "0"
    
    <overwrite>
    Indicates whether all SPF records should be overwritten for
    the user. If not, only select records will be replaced; see
    Overwrite. Use "1" to indicate that it should; otherwise,
    use "0". Default: "0"
    
    <preserve>
    Indicates that existing mechanisms should be retained from
    the
    current SPF record for the domain. Use "1" to indicate that
    they should be kept; otherwise, use "0". Default: "0"
    
    Overwrite
    
    When this script is run, the zone file for the domain is inspected and the
    first SPF record that is found (generally, the main domain) is recorded.
    Any
    other subdomains that have an identical SPF record to this one are replaced.
    If <overwrite> is "1", then all SPF records, regardless of whether their
    content matches the first record, are replaced.
    
    Usage: /usr/local/cpanel/bin/spf_installer <user> [policy [is-complete
    [overwrite [preserve]]]]
    
    Installs an SPF policy in TXT records for the given user's domains.
    
    Note: The following will be prepended to the policy: +a +mx +ip4:<main-IP>.
    
    Options:
    <user> User whose domains will receive the SPF record.
    
    <policy>
    Comma delimited list of SPF mechanisms to include in the
    policy, e.g. '+ip4:192.0.2.0/24,-ip4:203.0.113.5'.
    Default: ""
    
    <is-complete>
    Indicates whether the policy represents a complete record,
    that is, whether it should terminate with "-all". Use "1"
    to indicate that it is; otherwise, use "0". Default: "0"
    
    <overwrite>
    Indicates whether all SPF records should be overwritten for
    the user. If not, only select records will be replaced; see
    Overwrite. Use "1" to indicate that it should; otherwise,
    use "0". Default: "0"
    
    <preserve>
    Indicates that existing mechanisms should be retained from
    the
    current SPF record for the domain. Use "1" to indicate that
    they should be kept; otherwise, use "0". Default: "0"
    
    Overwrite
    
    When this script is run, the zone file for the domain is inspected and the
    first SPF record that is found (generally, the main domain) is recorded.
    Any
    other subdomains that have an identical SPF record to this one are replaced.
    If <overwrite> is "1", then all SPF records, regardless of whether their
    content matches the first record, are replaced.
    
    1 1 0
    ^C
    root@cdd [/var/cpanel/users]# for i in `ls /var/cpanel/users` ;do
    /usr/local/cpanel/bin/spf_installer $i ;done
    Usage: /usr/local/cpanel/bin/spf_installer <user> [policy [is-complete
    [overwrite [preserve]]]]
    
    Installs an SPF policy in TXT records for the given user's domains.
    
    Note: The following will be prepended to the policy: +a +mx +ip4:<main-IP>.
    
    Options:
    <user> User whose domains will receive the SPF record.
    
    <policy>
    Comma delimited list of SPF mechanisms to include in the
    policy, e.g. '+ip4:192.0.2.0/24,-ip4:203.0.113.5'.
    Default: ""
    
    <is-complete>
    Indicates whether the policy represents a complete record,
    that is, whether it should terminate with "-all". Use "1"
    to indicate that it is; otherwise, use "0". Default: "0"
    
    <overwrite>
    Indicates whether all SPF records should be overwritten for
    the user. If not, only select records will be replaced; see
    Overwrite. Use "1" to indicate that it should; otherwise,
    use "0". Default: "0"
    
    <preserve>
    Indicates that existing mechanisms should be retained from
    the
    current SPF record for the domain. Use "1" to indicate that
    they should be kept; otherwise, use "0". Default: "0"
    
    
    I want to remove and then add spf records to all my accounts.
    Any clue?
     
    #1 urgido, Jan 2, 2016
    Last edited by a moderator: Jan 2, 2016
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    There are no options to remove all existing SPF records, but you can overwrite them. Try using a command such as:

    Code:
    for i in `ls /var/cpanel/users` ;do  /usr/local/cpanel/bin/spf_installer $i 0 1 0 ;done
    You will still receive the output that suggests it fails, but that's simply for the invalid users in the output. Review the zones after the command completes and they should reflect the proper SPF records.

    Thank you.
     
  3. urgido

    urgido Well-Known Member

    Joined:
    Jul 19, 2005
    Messages:
    66
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Thanks for your reply but my commands are fine I just need to wait for command prompt again.
    This was solved by support ticket to cPanel's team.

    And there is an option to uninstall ( Ryan Berding ):

    # cd /var/cpanel/users
    # for i in `ls /var/cpanel/users` ;do /usr/local/cpanel/bin/spf_uninstaller $i ;done
    # for i in `ls /var/cpanel/users` ;do /usr/local/cpanel/bin/spf_installer $i ;done

    The clue: It should return back to a regular command prompt when finished.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page