mirror of
https://github.com/anonaddy/anonaddy.git
synced 2026-04-25 14:15:53 +03:00
[GH-ISSUE #582] complex SPF fails during check/validation #984
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/anonaddy#984
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MyUncleSam on GitHub (Jan 14, 2024).
Original GitHub issue: https://github.com/anonaddy/anonaddy/issues/582
Hello,
the SPF validation fails for my SPF records.
There are a lot of ways to configure the SPF settings. In my case I am using the
redirectionfunction in almost all my domains. The main reason is, that I want to configure the SPF records in a central place for all my domains which use the same mailservers. So my SPF record looks somthing likev=spf1 redirect=spf.domain.tldwhich is simply not valid by the current SPF validation.For me I found a solution to use
v=spf1 mx include:spf.domain.tld -allinstead ofv=spf1 redirect=spf.domain.tldwhich is more or less the same but a bit ugly in my eyes.My request would be to have:
@luckydonald commented on GitHub (Aug 1, 2025):
This is the current SPF check:
github.com/anonaddy/anonaddy@753ccea6b9/app/Models/Domain.php (L261-L277)More specifically:
So regarding
Pretty sure it can be added there, basically one has to come up with a rule for what is allowed instead.
@MyUncleSam if you can write down what it needs to check in at least english text, someone else can look into writing code for that.
Not knowing a whole lot about spf, I imagine if it contains
redirect=spf.domain.tldit would follow along that domain and load the DNS records of that instead, and then apply the previous rule to that domain?@MyUncleSam commented on GitHub (Aug 2, 2025):
Thx for the feedback @luckydonald I thought more about using a real SPF library instead of doing regex magic. (I also switched from redirect to include since this post)
The simple reason is, that managing SPF record with an include is much easier as soon as you have multiple domains than managing each one in their own spf records. One example is gmail.com which are even using a chain of includes to manage spf records. Checking this via regex is not really working well.
So I thought using a PHP library doing the more or less complex SPF checks could lead into better checking of domain spf records.
The PHP libraries I found (just as an example):