On October 19, 2021, we have enabled single-sign-on for our Plesk Support Center to provide a seamless login/account experience. This implies that you’ll be able to use a single account across any of our web-facing properties.
If you had already registered your account at Plesk 360 (formerly known as My Plesk) please use one for login. Otherwise please re-register it using the same email address as your existing Zendesk login (support account). It’s essential that you use the same email address on our support center to ensure that your tickets stay attached to the same account.

How to add SPF record for all domains on Plesk server?

Follow

Comments

3 comments

  • Avatar
    Turgut Kalfaoglu

    How about UPDATING all the SPF records of domains?  Since there may be multiple TXT entries for each domain, we can't just delete all the TXT and re-insert them :(

     

    0
    Comment actions Permalink
  • Avatar
    Yaroslav Tarasov

    Hello @Turgut Kalfaoglu,

    Thank you for your question. You are right, we can't just remove all the TXT type records, because they are not only for SPF. The utility "plesk bin dns" also doesn't have the "update" option. That's why we will need to update the existing records via the database. Below are two options - for Linux and for Windows.

    Linux:
    1. Connect to the server via SSH

    2. Create Plesk database backup

    3. Update the SPF entries in the database:

      # plesk db
      > UPDATE dns_recs SET val = REPLACE(val, 'v=spf1', 'v=spf1 include:example.com');
      > UPDATE dns_recs SET displayVal = REPLACE(displayVal, 'v=spf1', 'v=spf1 include:example.com');
      quit

    4. Use the Plesk repair tool kit to repair the DNS:

      # plesk repair dns -y

    Windows:
    1. Connect to the server via RDP

    2. Create Plesk database backup

    3. Open the Command line as an Administrator

    4. Update the SPF entries in the database:

      C:\> plesk db
      > UPDATE dns_recs SET val = REPLACE(val, 'v=spf1', 'v=spf1 include:example.com');
      > UPDATE dns_recs SET displayVal = REPLACE(displayVal, 'v=spf1', 'v=spf1 include:example.com');
      quit

    5. Use the Plesk repair tool kit to repair the DNS:

      C:\> plesk repair dns -y

     

    Just a note to the SQL queries above. These queries replace the old value 'v=spf1' with the new value 'v=spf1 include:example.com' on all domains. Please don't forget to change them to the ones you need.

    0
    Comment actions Permalink
  • Avatar
    Turgut Kalfaoglu (Edited )

    Thank you very much -- great help!

    I had various versions of SPFs already listed, so I got a list of them first:

    plesk db "select val from dns_recs where val like '%spf1%';" | sort|uniq > spfs

    I edited spfs file so only the bad versions remain,  Then I ran this ooRexx I wrote:

    /**/
    inf = 'spfs'
    do while lines(inf)>0
    r = strip(linein(inf))
    say "UPDATE dns_recs SET val = REPLACE(val, '"r"','v=spf1 mx a ip4:135.181.160.175 ip4:65.21.212.128/29 -all');"
    say "UPDATE dns_recs SET displayVal = REPLACE(displayVal, '"r"','v=spf1 mx a ip4:135.181.160.175 ip4:65.21.212.128/29 -all');"
    end

    I ran this, redirecting its output to a file, and then I fed it to plesk db with something like 
    plesk db < blah

    finally I ran the plesk repair dns -y

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request