In Progress CPANEL-43352 - using spf_installer to remove entry

123Host

Well-Known Member
Apr 24, 2015
47
13
58
USA
cPanel Access Level
Root Administrator
I have a hosting server with many accounts.

The spf record looks something like


v=spf1 +a +mx +ip4:1.2.3.4 -all​

I want to use spf_installer to change it to

v=spf1 +a +mx +include:spf.example.com -all

when I use

/usr/local/cpanel/bin/spf_installer user +include:spf.example.com

it adds that entry OK.

But when I try

/usr/local/cpanel/bin/spf_installer user -ip4:1.2.3.4

it doesn't remove that entry. Where am I going wrong?
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
17,470
2,843
363
cPanel Access Level
Root Administrator
Hey there! When I test this on my end, it takes that value as a literal string, so it adds "-ip4:1.2.3.4". Here is an example from my DNS zone after running your command:

Code:
cptest.com.    14400    IN    TXT    "v=spf1 +a +mx +ip4:10.2.35.7 -ip4:1.2.3.4 ~all"
This isn't the intended behavior, so I've created case CPANEL-43352 to have our developers review this. They will either fix that tool, or provide us with updated documentation.

My testing did show that the command will overwite data. So if you want to remove a certain IP, just dont' include that in the command. For example, if your record looks like this:

Code:
cptest.com.    14400    IN    TXT    "v=spf1 +a +mx +ip4:10.2.35.7 +ip4:1.2.3.4 -ipv4:4.3.2.1 ~all"
and you want to remove the 4.3.2.1 address, just run this:

Code:
/usr/local/cpanel/bin/spf_installer cptest +ip4:1.2.3.4
 

123Host

Well-Known Member
Apr 24, 2015
47
13
58
USA
cPanel Access Level
Root Administrator
Thanks, I am pretty surprised no one has reported this before .

The problem for me now is that I can't update ALL zone files using the overwrite method as some include other entries for 3rd party mail providers e.g. Microsoft or Google .

Short of just leaving the unwanted entry until this is fixed, any suggestions?