Sieve forwarding, SRS and SPF

jigster

Verified User
Joined
Jul 23, 2021
Messages
102
Hi. When an email is forwarded using a sieve forwarder (set up in Roundcube), it seems that SRS doesn't re-write the from address, as I would expect. This means SPF fails at the destination server because it checks the original sender domain's SPF, but the sending IP is the server that's done the forwarding (my server). Is there a way to fix this? Thanks
 
this is a tricky one — forwarding + SPF doesn’t always play nicely, especially without using SRS. From what I know:

forwarding messages usually breaks SPF because the email ends up being sent from the forwarding server (which isn’t listed in the original domain’s SPF). SRS (sender rewriting scheme) fixes that by rewriting the envelope sender so the mail looks “legit” from the forwarder’s domain, making SPF checks pass.


If directadmin could integrate SRS for forwarded emails by default (or allow users to enable it), that might solve a lot of SPF-fail headaches.
 
I thought SRS used to work with forwarding (using sieve), but I could be wrong. Can anyone confirm this?
 
I'm still trying to figure out the best way to get sieve forwarding to pass SPF checks. One thing that works is to edit (or create) /etc/dovecot/conf.d/99-imap-sieve.conf and add:
sieve_redirect_envelope_from = recipient
But this is not ideal.

I think it would be better handled by SRS/Exim, the same way Directadmin handles forwarders (which correctly triggers SRS so SPF passes).
In /etc/exim.conf we have:
lookuphost_forward_router:
driver = dnslookup
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = ${if !eq{$original_domain}{$domain}}
condition = ${if !eq{$original_domain}{}}
condition = "${perl{check_limits}}"
transport = remote_smtp_forward_transport
no_more

lookuphost:
driver = dnslookup
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = "${perl{check_limits}}"
transport = remote_smtp
no_more

The Directadmin forwarder is triggering lookuphost_forward_router but the sieve forwarding is not and uses lookuphost. Wondering if it's possible to change the above somehow so that sieve forwarding also triggers lookuphost_forward_router? Any ideas? Thanks :)
 
Back
Top