Disclosure up front: I run IPYE, a company that leases IP space. This is a practical how-to, and IPYE comes up where it helps, with a short call to action at the end.
Mail delivery over IPv6 gets most of the attention, but users also need to read their mail, and IMAP over IPv6 has its own details to get right: listener addresses, proxies that hide client addresses, and authentication throttling that has to understand IPv6. This guide configures Dovecot for IMAP and submission clients on a dedicated address from a free IPv6 /48 from IPYE. The examples use the documentation prefix 2001:db8:100::/48 and the mail host mail.example.net at 2001:db8:100:c0::25.
Listen on the right addresses
In /etc/dovecot/dovecot.conf:
listen = 2001:db8:100:c0::25, 192.0.2.25 protocols = imap lmtp The default listen = *, :: covers all IPv4 and IPv6 addresses. Name addresses explicitly when the host also runs other services on other addresses.
Only offer encrypted IMAP
In 10-master.conf, turn off plain-text port 143 and keep 993:
service imap-login { inet_listener imap { port = 0 } inet_listener imaps { port = 993 ssl = yes } } In 10-ssl.conf:
ssl = required ssl_cert = </etc/letsencrypt/live/mail.example.net/fullchain.pem ssl_key = </etc/letsencrypt/live/mail.example.net/privkey.pem ssl_min_protocol = TLSv1.2 The leading < tells Dovecot to read the file contents. Without it, Dovecot treats the path as the certificate text itself.
DNS for clients
Mail clients find servers either from your manual settings or through autoconfiguration. Publish an AAAA record for the name in the certificate:
mail.example.net. IN AAAA 2001:db8:100:c0::25 mail.example.net. IN A 192.0.2.25 _imaps._tcp.example.net. IN SRV 0 1 993 mail.example.net. RFC 6186 SRV records are optional, but some clients use them to fill in settings automatically.
Behind a proxy or load balancer
If HAProxy sits in front, enable the PROXY protocol so Dovecot sees real client addresses:
haproxy_trusted_networks = 2001:db8:100:c0::/64 service imap-login { inet_listener imaps_proxy { port = 10993 ssl = yes haproxy = yes } } On the HAProxy side, use send-proxy-v2 on the server line. Without this, every login appears to come from the proxy. A single bad password would then throttle everyone, and logs would be useless for abuse reports.
Authentication throttling
Dovecot delays failed logins with auth_failure_delay, and its auth_policy hooks can call an external policy server. For simple setups, fail2ban works on Dovecot's log lines. For IPv6, ban by /64 rather than by single address, because a client can rotate through addresses within its /64. Recent fail2ban versions can do this with nftables actions that match on a prefix. Otherwise, write the action to insert ip6 saddr <ip>/64 rules.
Test
openssl s_client -connect '[2001:db8:100:c0::25]:993' -servername mail.example.net -quiet You should see * OK [CAPABILITY ...] Dovecot ready. Then sign in with a test account:
a1 LOGIN testuser@example.net 'password' a2 LIST "" "*" a3 LOGOUT Check doveadm who to see connected users and their addresses. Bracketed IPv6 client addresses confirm that clients are actually connecting over IPv6.
Firewall
ip6 daddr 2001:db8:100:c0::25 tcp dport { 993, 587, 465 } accept Submission on 587 and 465 is usually Postfix's job, with Dovecot providing SASL authentication through its auth socket.
Why your own prefix for mail
Mail reputation and client settings both depend on addresses and names staying stable. A prefix you announce yourself, with matching reverse DNS, keeps your mail host's address the same through hardware and provider changes. IPYE's free /48 comes with a LOA for your upstream and an automatically created ROA.
Get started
Claim the free /48 from the IPYE portal, give the mail host a dedicated address, and require TLS on every IMAP listener.
About IPYE
IPYE leases IPv4, IPv6 and ASN space with instant setup. Your first IPv6 /48 is free for the first year, a real allocation you can announce on your own ASN, with a LOA from the portal and the ROA created automatically. IPv4 /24 to /22 leases include LOA, ROA and per-/24 rDNS, and ASN and region changes apply automatically. Locations: Los Angeles, New York, Ashburn, Salt Lake City, London, Amsterdam, Frankfurt. More at ipye.com. Questions: ipye@turnel.com.
Disclosure: I run IPYE