| Linode Forum https://forum.linode.com/ |
|
| Secure forwarding with LibSRS? https://forum.linode.com/viewtopic.php?f=11&t=11283 |
Page 1 of 1 |
| Author: | Webkungen [ Fri Sep 05, 2014 3:49 am ] |
| Post subject: | Secure forwarding with LibSRS? |
Hi! I've setup my own email server using the linode guide for postfix/mysql and dovecot. Everything is working very well. Now to my issue. I need to forward all incoming emails to a certain address so an external address, and at the same time rewrite the sender in order for SPF/DKIM to pass. I've found LibSRS (http://www.libsrs2.org/) and installed it on my debian box using apt-get. But what now? I'm unable to find any guides, instructions etc. how to configure LibSRS with this certain address. Any help I can get in this matter would be highly appreciated! Thanks! |
|
| Author: | Webkungen [ Fri Sep 05, 2014 4:38 am ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
Just to clearify things. When people are sending email to name@domain.tld, postfix has to forward that email to another-name@another-domain.tld, and alter (keep) the FROM-address to name@domain.tld intead of keeping the original sender. This is becaise I'm using SPF/DKIM and the emails will be classes as spam (not permitted sender nor valid DKIM). |
|
| Author: | hoopycat [ Fri Sep 05, 2014 6:44 am ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
I use something like this: In /etc/postfix/redirector, an executable script: Code: #!/bin/bash In master.cf: Code: # resends the message with a local envelope sender to "thwart" SPF on forwards In transport: Code: # spf-ish domains In main.cf: Code: munger_destination_recipient_limit = 1 And finally, virtual: Code: local@example.com distant@example.net.munger It worked well for pretty much all the mail going through my system, but we've been migrating domains to Fastmail. They have a ticky-box that does this automatically. (And they do mail better than I do.) |
|
| Author: | Webkungen [ Fri Sep 05, 2014 6:48 am ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
Hi! Thanks for your answer, I'll definitely have a look into this. A questions first though, what do you mean with And finally, virtual: ? Is it the virtual_alias_maps you mean in main.cf? The current value for that is virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf and I need to keep it that way in order to use the mysql table. Or do you simply mean to add the "redirect" in my existing mysql table for aliases?` Thanks! |
|
| Author: | hoopycat [ Fri Sep 05, 2014 11:02 pm ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
Basically, you'd append .munger to any destination address, however you do it, and it'll go through this transport. |
|
| Author: | Webkungen [ Fri Sep 05, 2014 11:17 pm ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
Okay! So you mean [b].munger[/u] will be removed from the target address? I'll give it a try then! |
|
| Author: | Webkungen [ Fri Sep 05, 2014 11:28 pm ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
Almost there... I've setup everything and first I got "Permission denied" for the "munger service". Ran chmod +x redirector. When a new email is arriving to the server, postfix log says: Code: Sep 6 05:26:11 li416-119 postfix/sendmail[15584]: fatal: User nobody(65534) is not allowed to submit mail Guess I have to adjust something in the redirector script, but what part? Thanks! |
|
| Author: | Webkungen [ Fri Sep 05, 2014 11:42 pm ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
Tried to change user= in master.cf to both vmail and root, same error... Suggestions? |
|
| Author: | Webkungen [ Sat Sep 06, 2014 1:36 am ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
Think I solved it! I commented out this line in main.cf: Code: smtpd_data_restrictions = reject_unauth_pipelining And added nobody to authorized_submit_users. The email is coming through as it should, and the sender is correct! Two questions on this: 1) Is there a chance of any issues with commenting out "reject_unauth_pipelining"? 2) Is it "dangerous" to add nobody to "authorized_submit_users" ? Also, would be very, very nice if the receipient (which has a local inbox on the server) could keep a copy of the mail that's being forwarded. |
|
| Author: | Webkungen [ Sat Sep 06, 2014 1:46 am ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
Hmm, nope, it's not working.... The original sender is still the sender of the forwarded email.... I.e. a) I've setup addr1@domain.tld is an alias with the destination addr2@anotherdomain.tld b) When sending an email TO addr1@domain.tld it's supposed to save a local copy of the email in the inbox, and forward to email to addr2@anotherdomain.tld. When addr2@anotherdomain.tld is receiving the email, addr1@domain.tld is supposed to be the FROM address. |
|
| Author: | hoopycat [ Sun Sep 07, 2014 9:04 pm ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
What does your mail log say? What do the received message headers say? |
|
| Author: | Webkungen [ Sun Sep 07, 2014 11:05 pm ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
Message headers: Code: Return-Path: <mail@email.mydomain.tld> Postfix log: Code: postfix/smtpd[22133]: 9167D827CB: client=localhost[127.0.0.1] |
|
| Author: | hoopycat [ Mon Sep 08, 2014 6:29 pm ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
The envelope sender is being changed: Code: Return-Path: <mail@email.mydomain.tld> It is defaulting to the user executing the redirector script, but that could be changed by adjusting the -f argument on its call to sendmail. (Perhaps -f "$2" would do the trick?) None of this touches the "From:" header inside of the message -- that's not used for SPF/DKIM/etc, it's just for human readability. As far as saving a copy of the mail locally, you might want to look into http://www.postfix.org/ADDRESS_REWRITIN ... l#auto_bcc ... instead of forwarding all mail, use recipient_bcc_maps to bcc: mail for that user to the external address. In all cases, be mindful of loops that could occur when the external address is undeliverable. If the envelope sender of the forwarding copy is the recipient's e-mail address, then all hell will break loose if the external address bounces. (That's why I didn't do -f "$2" in the first place.) |
|
| Author: | Webkungen [ Tue Sep 16, 2014 11:07 pm ] |
| Post subject: | Re: Secure forwarding with LibSRS? |
Tried to setup the recipient_bcc_maps now and the problem is when the mail is received the sender is still the original sender. So back to square 1... I need to forward the email to a adress, and change the sender adress. Perhaps the easiest way is to create a PHP script that connects to the inbox, forwarding the email and run this script from cron? |
|
| Page 1 of 1 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|