virtualmin / virtualmin-gpl

Virtualmin web hosting control panel for Webmin
https://www.virtualmin.com
GNU General Public License v3.0
304 stars 95 forks source link

inconsistencies and improvements for the SPF settings #696

Open shoulders opened 7 months ago

shoulders commented 7 months ago
SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04.3
Webmin version 2.105
Usermin version 2.005
Virtualmin version 7.8.2  
Theme version 21.09.5
Package updates 31 package updates are available

The issue

While setting up my Virtualmin I found the SPF settings to be tricky to use and I will outline the reasons here. Overall the 2 sections should have unified options and be correctly named.

The 2 locations where you find SPF settings. Their issues will be listed below

Edit Template section: DNS domain (Server Template)

Virtualmin --> System Settings --> Server Templates --> 'Default Settings' --> Edit Template section: DNS domain

image

DNS Options

Virtualmin --> Server Configuration --> DNS Options --> Action for other senders

image

The built SPF record has some issues

If you goto Virtualmin --> DNS Records you can see the following image

Switches explained

Because you have a and mx you do not then need to define the IP and the domain with the ip4: and a: switches.

You need to keep a and mx because they might have different IPs. The specified resources a: and ip4: should only be used when a user has manually defined a resources or perhaps you have allowed the virtual IP.

Maybe add options to use the A and MX record in the SPF options rather than specifying the IP address.

Resources

jcameron commented 7 months ago

So looking at these one at a time ... I'm not sure if using the name "Failure Qualifier" is a good idea, because it's not clear to the average person what this means. That's why I went with "Does SPF record cover all senders?" which I think better explains what it means.

jcameron commented 7 months ago

Also, I don't think +all is every an option we'd want to support since it allows all email ..

shoulders commented 7 months ago

Why you should keep +all

Why failure qualifier is a better name

Additional

I just added these so I dont forget about them.

< default >

SPF and DMARC sections should be separated

A and MX records should be tested

SPF issues on Virtualmin.com (for reference) I did an issue a while ago because there was issues with your SPF for the domain sending me the registration verification issue

I am not sure it is fixed

Virtualmin's website SPF records are faulty - Cannot register on forum https://github.com/virtualmin/virtualmin-gpl/issues/560

iliajie commented 7 months ago

Also, I don't think +all is every an option we'd want to support since it allows all email

I think using ~all is more common as it provides a degree of protection while avoiding the risk of legitimate emails being rejected. I'd suggested using ~all instead of ?all (neutral) by default. What do you think?

shoulders commented 7 months ago

I'd suggested using ~all instead of ?all (neutral) by default. What do you think?

Google is getting strict with accepting emails: https://news.ycombinator.com/item?id=36323137

iliajie commented 7 months ago

Google is getting strict with accepting emails: https://news.ycombinator.com/item?id=36323137

Google historically recommended ~all.

  • Why as a default would i let spammers use my domain to send emails.

What if the mail is relayed?

Some email services will reject email if ~all is used

Which are those?

~all is regarded as a fail in DMARC.

DMARC policy decisions are based on SPF or DKIM passing and alignment, not just the SPF policy itself. ~all, i.e. softfail alone does not cause DMARC to fail, as far as I know. If the SPF check passes, and the domain aligns with the "From" domain, then it counts as a pass for DMARC, regardless of the ~all policy.

jcameron commented 7 months ago

One thing I'll do for sure is make the field names for the SPF "all" mode consistent between server templates and the DNS Options page! And expand on the help ...

shoulders commented 7 months ago

~all or -all

Google historically recommended ~all These are example default SPF statements. ~all is definately historic.

  • Microsoft: v=spf1 +a +mx +ip4:31.31.31.31 +include:spf.protection.outlook.com -all
  • cPanel: v=spf1 +a +mx +ip4:31.31.31.31 -all

What if the mail is relayed?

Some email services will reject email if ~all is used

I cannot give you any specific examples so might not be widespread, but I have come across it.

~all is regarded as a fail in DMARC.

Other

jcameron commented 7 months ago

So is the conclusion that it would make sense to set the default to -all ?

iliajie commented 7 months ago

So is the conclusion that it would make sense to set the default to -all ?

I'd suggest to set the default to ~all. It is a much safer default than -all.