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.

Bulk add SPF (not replace)?

Discussion in 'Bind / DNS / Nameserver Issues' started by MACscr, Jan 16, 2016.

  1. MACscr

    MACscr Well-Known Member

    Joined:
    Sep 30, 2003
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Adding a smarthost for exim and obviously need to add that spf record as well. A bit tricky when just trying to add it to current spf records and not just replace some existing entry. Guess I should probably add it to the zone template too, right?
     
  2. syslint

    syslint Well-Known Member

    Joined:
    Oct 9, 2006
    Messages:
    249
    Likes Received:
    6
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Yes, You need to add it to the zone template.
     
  3. MACscr

    MACscr Well-Known Member

    Joined:
    Sep 30, 2003
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Sorry, i should have put the question in the content and not just the subject too. I need to know though how to bulk ADD to all the existing spf records.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    MACscr Well-Known Member

    Joined:
    Sep 30, 2003
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Those instructions are for replacing a value, which is easy. Doesn't help.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    There's an additional link in the thread I referenced that shows how to add new entries to a zone in mass:

    Bulk DNS insert

    You could remove all existing SPF records first, and then add the new entries with the modifications of your choosing.

    Thank you.
     
  7. MACscr

    MACscr Well-Known Member

    Joined:
    Sep 30, 2003
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    We are specifically talking about adding new values to EXISTING SPF records. All the SPF records could easily be different right now. This is where the complication resides. We are not talking about simply adding whole new A records or a whole new SPF record to a zone. We are talking about ADDING to EXISTING SPF zones that are not the same. Hopefully this makes more sense now. =)
     
  8. MACscr

    MACscr Well-Known Member

    Joined:
    Sep 30, 2003
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Looks like this might work according to a helpful user on IRC:

     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Here's the usage output that explains this further:

    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,+ip6:2001:db8:1a34::/64'.
                    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.
    Thank you.
     
Loading...

Share This Page