mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-12-09 17:23:04 +03:00
SMTP falsely prefers IPv4 over IPv6 #328
Reference in New Issue
Block a user
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 @imp1sh on GitHub.
Vaultwarden Support String
Your environment (Generated via diagnostics page)
Config (Generated via diagnostics page)
Show Running Config
Environment settings which are overridden: DOMAIN, SIGNUPS_ALLOWED, ADMIN_TOKEN, SMTP_HOST, SMTP_SECURITY, SMTP_PORT, SMTP_FROM, SMTP_USERNAME, SMTP_PASSWORD
Vaultwarden Build Version
1.32.3-2f20ad86 (testing tag)
Deployment method
Official Container Image
Custom deployment method
No response
Reverse Proxy
nginx 1.22.1
Host/Server Operating System
Linux
Operating System Version
Debian 12
Clients
Web Vault
Client Version
Firefox 132.0
Steps To Reproduce
Configure SMTP settings with DNS name that both resolves IPv6 and IPv4 address.
As in RFC 6724 it is required that IPv6 is being preferred over IPv4.
Expected Result
Instead of trying to connect to the SMTP host via IPv4 first, it should prefer IPv6. BTW it's a GUA address, no ULA.
Actual Result
The application tries to connect via IPv4 first.
Logs
Screenshots or Videos
No response
Additional Context
No response
@stefan0xC commented on GitHub:
Can you run something like
curl ifconfig.meorcurl my.ip.fiinside the container to check whether your system prefers IPv6 over IPv4?@imp1sh commented on GitHub:
https://github.com/lettre/lettre/issues/1003
@BlackDex commented on GitHub:
I think this isn't something specific to Vaultwarden, but more to the mall library/crate https://github.com/lettre/lettre.
It also isn't something we control in Vaultwarden.
@imp1sh commented on GitHub:
Docker sucks with IPv6 tbh
I'm using podman though and my setup is fully tested and functional with IPv6
@stefan0xC commented on GitHub:
Do you have IPv6 enabled in docker? Because I don't think that this is the applications fault but should depend on your system setup and I don't think that docker by default can resolve ipv6 addresses.
edit: at least podman cannot do this as far as i've tested it:
(and running my vaultwarden instance locally it seems to connect just fine to the ipv6 address according to the smtp server)
@stefan0xC commented on GitHub:
Well, I'm glad we could narrow it down a bit. So it might be specific to podman and the way it resolves DNS or how you set it up? In any case I don't think I can help any further as I have not enabled IPv6 in podman myself yet and this is probably something you should ask the podman community directly.
@imp1sh commented on GitHub:
I might have linked the wrong RFC. When it comes to precedence question RFC 6555 is the relevant one.
@imp1sh commented on GitHub:
This gives me the IPv4 address when I'm inside a container. But I don't understand... I can both connect to container services inbound via IPv6 and outbound v6 communication basically also works.
Outside of the container it resolves correctly to the IPv6 adress... Weird stuff
@paolobarbolini commented on GitHub:
On the lettre side we don't do dualstack properly, so it's going to use whichever IP address the resolver returns first.
As for running
curlin the container I suggest adding-6so you are extra sure about it trying to use IPv6. If it doesn't connect you know your container doesn't have an IPv6 address. I don't know much about podman but I know docker only recently released changes that made IPv6 more useful, or at least easier to use, so it could be just that podman has to do the same steps or maybe simply doesn't enable it by default.@stefan0xC commented on GitHub:
@paolobarbolini
Would that be wrong? I mean that's how the RFC explains how it typically works as well, is it not?
@paolobarbolini commented on GitHub:
Yeah what I meant is that we don't implement happy eyeballs at all