fix : Ipv6 pref sending if available - #2312
Conversation
| if settings["mail_out"]: | ||
| mail.append((basename, ttl, "TXT", '"v=spf1 a mx -all"')) | ||
| # Tentative de mitigation en cas où le serveur du domaine d'envoi du mail est différent | ||
| # du serveur du domaine (site externalisé) Issue: #2465 |
There was a problem hiding this comment.
The issue 2465 seems not about distinct mail and web server for a same domain.
| # Tentative de mitigation en cas où le serveur du domaine d'envoi du mail est différent | ||
| # du serveur du domaine (site externalisé) Issue: #2465 | ||
| spf4 = "" | ||
| spf6 = "" | ||
| if ipv4: | ||
| spf4 = ' ip4:' + ipv4 | ||
| if ipv6: | ||
| spf6 = ' ip6:' + ipv6 | ||
| mail.append((basename, ttl, "TXT", f'"v=spf1 a mx{spf4}{spf6} -all"')) |
There was a problem hiding this comment.
a already means AAAA if the mail is sent with ipv6.
SO for me the only reasons to add this, is the case where no MX or A records exists for the IP of the server. This happens if mail_in is disabled and if a website is hosted on the domain on another host.
https://github.com/Nerteron/yunohost/blob/12c2594b1024a604d5bd3d96007b79905d4de87d/src/dns.py#L207
I think there could be a lot of situations for which SPF should be customized, the important thing is to check with diagnosis that current IPs are allowed.
For me this part should be in another PR , maybe with a settings to include a custom part to SPF
| # Tentative de mitigation en cas où le serveur du domaine d'envoi du mail est différent | ||
| # du serveur du domaine (site externalisé) Issue: #2465 | ||
| spf4 = "" | ||
| spf6 = "" | ||
| if ipv4: | ||
| spf4 = ' ip4:' + ipv4 | ||
| if ipv6: | ||
| spf6 = ' ip6:' + ipv6 | ||
| mail.append((basename, ttl, "TXT", f'"v=spf1 a mx{spf4}{spf6} -all"')) |
There was a problem hiding this comment.
| # Tentative de mitigation en cas où le serveur du domaine d'envoi du mail est différent | |
| # du serveur du domaine (site externalisé) Issue: #2465 | |
| spf4 = "" | |
| spf6 = "" | |
| if ipv4: | |
| spf4 = ' ip4:' + ipv4 | |
| if ipv6: | |
| spf6 = ' ip6:' + ipv6 | |
| mail.append((basename, ttl, "TXT", f'"v=spf1 a mx{spf4}{spf6} -all"')) | |
| mail.append((basename, ttl, "TXT", '"v=spf1 a mx -all"')) |
zamentur
left a comment
There was a problem hiding this comment.
I suggest to remove the SPF part
AW: I just added the solution provided by @jershon
The problem
For SPF record :
As I understood, it could be problem if main domain (exemple for a website) has different ipv4 than actual mail server.
For ipv6 :
Some email provider communicate only in ipv6. Apparently following issue this can be a solution of not receiving mail on some email hosting providers.
Related issues: : fixes YunoHost/issues#2465
Related PRs:
Solution
AI transparency: Understand difference between record (I didn't fully remember what was the good way to handle such case).
PR Status
Tested partially
Code TODOs
Here are frequently forgotten tasks:
Tests TODOs
Indicate here tests you have already done, and tests you think should be done
How to test
Please add here commands to install dependencies, manual change to do in ynh-dev container, commands to make some basic tests, etc.
...