Re: Null sender rewrite from a specified host.
Hi Wieste, > To cut through the noise: > > 1 - Configure a Postfix smtpd process on an additional IP addresss > or TCP port ***THAT ONLY THIS CLIENT WILL CONNECT TO. > > 2 - Configure that smtpd process with an smtpd_command_filter that > replaces "MAIL FROM:<>" with the preferred address. > > # Listen on port 1234 > /etc/postfix/master.cf: > 1234 inet .. .. .. .. .. smtpd > -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} > > # Listen on IP address 1.2.3.4 > /etc/postfix/master.cf: > 1.2.3.4:smtp inet .. .. .. .. .. smtpd > -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} > > /etc/postfix/command_filter: >/^(MAIL FROM:)\s*<>/ MAIL FROM: > > That is sufficient to rewrite the null sender from ONLY THIS SMTP client. Many thanks for this nice hint :) Xavier
Re: Null sender rewrite from a specified host.
To cut through the noise: 1 - Configure a Postfix smtpd process on an additional IP addresss or TCP port ***THAT ONLY THIS CLIENT WILL CONNECT TO. 2 - Configure that smtpd process with an smtpd_command_filter that replaces "MAIL FROM:<>" with the preferred address. # Listen on port 1234 /etc/postfix/master.cf: 1234 inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} # Listen on IP address 1.2.3.4 /etc/postfix/master.cf: 1.2.3.4:smtp inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} /etc/postfix/command_filter: /^(MAIL FROM:)\s*<>/ MAIL FROM: That is sufficient to rewrite the null sender from ONLY THIS SMTP client. Wietse
Re: Null sender rewrite from a specified host.
Le 07/07/2021 à 15:41, Emmanuel Fusté a écrit : Le 07/07/2021 à 15:36, Emmanuel Fusté a écrit : Le 07/07/2021 à 15:26, Wietse Venema a écrit : Emmanuel Fust?: Le 07/07/2021 ? 15:06, Wietse Venema a ?crit?: Viktor Dukhovni: On Tue, Jul 06, 2021 at 12:56:50PM +0200, Xavier Beaudouin wrote: I currently have an appliance that misuse the null sender (mail from:<>) to send mail. Unfortunatly, this appliance is closed source and we can only setup : fixed ip address and recipient address on GUI (nothing else, even if I try to h4x0r the configuration file). Is there any good advice I can have to make the internal relay server which is postfix based to rewrite the null sender to something cleaner... but ONLY for the device that use postfix as internal relay server? This requires a content filter or milter, that replaces the envelope sender address for messages from the client IP address in question. There is no built-in feature that performs sender address rewrites conditional on the client IP address. The milter should be easy to implement. There is another option: 1 - Configure a Postfix smtpd process on an additional IP addresss or TCP port that only this client will connect to. 2 - Configure that smtpd process with an smtpd_command_filter that replaces "MAIL FROM:<>" with the preferred address. # Listen on port 1234 /etc/postfix/master.cf: 1234 inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} # Listen on IP address 1.2.3.4 /etc/postfix/master.cf: 1.2.3.4:smtp inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} /etc/postfix/command_filter: /^(MAIL FROM:)\s*<>/ MAIL FROM: Wietse And use a client_access map in smtpd_client_restriction check_client_access with a filter action and you will transparently get the intended behavior without specific client configuration. NO FILTER is needed for the stated purpose: replace the null sender address. Sorry, I did not explain properly : 1 - Configure a Postfix smtpd process on an additional TCP port. 2 - Configure that smtpd process with an smtpd_command_filter that replaces "MAIL FROM:<>" with the preferred address. # Listen on port 1234 on localhost /etc/postfix/master.cf: 127.0.0.1:1234 inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} /etc/postfix/command_filter: /^(MAIL FROM:)\s*<>/ MAIL FROM: 3 - Use this smtpd process as a filter for clients coming from IP address w.x.y.z /etc/postfix/main.cf: smtpd_client_restriction= check_client_access /etc/postfix/client_acess, . /etc/postfix/client_acess: w.x.y.z FILTER localhost:1234 And you get "null sender address rewrites conditional on the client IP address" arghh no, sorry, smtp client must be added in between. A little more complex 1 - Configure a Postfix smtpd process on an additional TCP port. 2 - Configure that smtpd process with an smtpd_command_filter that replaces "MAIL FROM:<>" with the preferred address. # Listen on port 1234 on localhost /etc/postfix/master.cf: 127.0.0.1:1234 inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} /etc/postfix/command_filter: /^(MAIL FROM:)\s*<>/ MAIL FROM: 3 - Use this smtpd process as a filter for clients coming from IP address w.x.y.z /etc/postfix/main.cf: smtpd_client_restriction= check_client_access /etc/postfix/client_acess, . /etc/postfix/client_acess: w.x.y.z FILTER smtp:[127.0.0.1]:1234 With that, no need to change the w.x.y.z client configuration and you get "null sender address rewrites conditional on the client IP address" But yes, totally useless if you change the client configuration to point to the new listener directly. Emmanuel.
Re: Null sender rewrite from a specified host.
> On 7 Jul 2021, at 9:43 am, Emmanuel Fusté > wrote: > > arghh no, sorry, smtp client must be added in between. > A little more complex No, just a dedicated SMTP listener service that runs in parallel with the existing SMTP server. Everything else is the same... The SMTP server replaces the envelope sender, and then everything proceeds normally... -- Viktor.
Re: Null sender rewrite from a specified host.
Le 07/07/2021 à 15:36, Emmanuel Fusté a écrit : Le 07/07/2021 à 15:26, Wietse Venema a écrit : Emmanuel Fust?: Le 07/07/2021 ? 15:06, Wietse Venema a ?crit?: Viktor Dukhovni: On Tue, Jul 06, 2021 at 12:56:50PM +0200, Xavier Beaudouin wrote: I currently have an appliance that misuse the null sender (mail from:<>) to send mail. Unfortunatly, this appliance is closed source and we can only setup : fixed ip address and recipient address on GUI (nothing else, even if I try to h4x0r the configuration file). Is there any good advice I can have to make the internal relay server which is postfix based to rewrite the null sender to something cleaner... but ONLY for the device that use postfix as internal relay server? This requires a content filter or milter, that replaces the envelope sender address for messages from the client IP address in question. There is no built-in feature that performs sender address rewrites conditional on the client IP address. The milter should be easy to implement. There is another option: 1 - Configure a Postfix smtpd process on an additional IP addresss or TCP port that only this client will connect to. 2 - Configure that smtpd process with an smtpd_command_filter that replaces "MAIL FROM:<>" with the preferred address. # Listen on port 1234 /etc/postfix/master.cf: 1234 inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} # Listen on IP address 1.2.3.4 /etc/postfix/master.cf: 1.2.3.4:smtp inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} /etc/postfix/command_filter: /^(MAIL FROM:)\s*<>/ MAIL FROM: Wietse And use a client_access map in smtpd_client_restriction check_client_access with a filter action and you will transparently get the intended behavior without specific client configuration. NO FILTER is needed for the stated purpose: replace the null sender address. Sorry, I did not explain properly : 1 - Configure a Postfix smtpd process on an additional TCP port. 2 - Configure that smtpd process with an smtpd_command_filter that replaces "MAIL FROM:<>" with the preferred address. # Listen on port 1234 on localhost /etc/postfix/master.cf: 127.0.0.1:1234 inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} /etc/postfix/command_filter: /^(MAIL FROM:)\s*<>/ MAIL FROM: 3 - Use this smtpd process as a filter for clients coming from IP address w.x.y.z /etc/postfix/main.cf: smtpd_client_restriction= check_client_access /etc/postfix/client_acess, . /etc/postfix/client_acess: w.x.y.z FILTER localhost:1234 And you get "null sender address rewrites conditional on the client IP address" arghh no, sorry, smtp client must be added in between. A little more complex Emmanuel.
Re: Null sender rewrite from a specified host.
Le 07/07/2021 à 15:26, Wietse Venema a écrit : Emmanuel Fust?: Le 07/07/2021 ? 15:06, Wietse Venema a ?crit?: Viktor Dukhovni: On Tue, Jul 06, 2021 at 12:56:50PM +0200, Xavier Beaudouin wrote: I currently have an appliance that misuse the null sender (mail from:<>) to send mail. Unfortunatly, this appliance is closed source and we can only setup : fixed ip address and recipient address on GUI (nothing else, even if I try to h4x0r the configuration file). Is there any good advice I can have to make the internal relay server which is postfix based to rewrite the null sender to something cleaner... but ONLY for the device that use postfix as internal relay server? This requires a content filter or milter, that replaces the envelope sender address for messages from the client IP address in question. There is no built-in feature that performs sender address rewrites conditional on the client IP address. The milter should be easy to implement. There is another option: 1 - Configure a Postfix smtpd process on an additional IP addresss or TCP port that only this client will connect to. 2 - Configure that smtpd process with an smtpd_command_filter that replaces "MAIL FROM:<>" with the preferred address. # Listen on port 1234 /etc/postfix/master.cf: 1234 inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} # Listen on IP address 1.2.3.4 /etc/postfix/master.cf: 1.2.3.4:smtp inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} /etc/postfix/command_filter: /^(MAIL FROM:)\s*<>/ MAIL FROM: Wietse And use a client_access map in smtpd_client_restriction check_client_access with a filter action and you will transparently get the intended behavior without specific client configuration. NO FILTER is needed for the stated purpose: replace the null sender address. Sorry, I did not explain properly : 1 - Configure a Postfix smtpd process on an additional TCP port. 2 - Configure that smtpd process with an smtpd_command_filter that replaces "MAIL FROM:<>" with the preferred address. # Listen on port 1234 on localhost /etc/postfix/master.cf: 127.0.0.1:1234 inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} /etc/postfix/command_filter: /^(MAIL FROM:)\s*<>/ MAIL FROM: 3 - Use this smtpd process as a filter for clients coming from IP address w.x.y.z /etc/postfix/main.cf: smtpd_client_restriction= check_client_access /etc/postfix/client_acess, . /etc/postfix/client_acess: w.x.y.z FILTER localhost:1234 And you get "null sender address rewrites conditional on the client IP address" Emmanuel.
Re: Null sender rewrite from a specified host.
Emmanuel Fust?: > Le 07/07/2021 ? 15:06, Wietse Venema a ?crit?: > > Viktor Dukhovni: > >> On Tue, Jul 06, 2021 at 12:56:50PM +0200, Xavier Beaudouin wrote: > >> > >>> I currently have an appliance that misuse the null sender (mail > >>> from:<>) to send mail. > >>> > >>> Unfortunatly, this appliance is closed source > >>> and we can only setup : fixed ip address and recipient address on GUI > >>> (nothing else, even if I try to h4x0r the configuration file). > >>> > >>> Is there any good advice I can have to make the internal relay server > >>> which is postfix based to rewrite the null sender to something > >>> cleaner... but ONLY for the device that use postfix as internal relay > >>> server? > >> This requires a content filter or milter, that replaces the envelope > >> sender address for messages from the client IP address in question. > >> > >> There is no built-in feature that performs sender address rewrites > >> conditional on the client IP address. > >> > >> The milter should be easy to implement. > > There is another option: > > > > 1 - Configure a Postfix smtpd process on an additional IP addresss > > or TCP port that only this client will connect to. > > > > 2 - Configure that smtpd process with an smtpd_command_filter that > > replaces "MAIL FROM:<>" with the preferred address. > > > > # Listen on port 1234 > > /etc/postfix/master.cf: > > 1234 inet .. .. .. .. .. smtpd > > -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} > > > > # Listen on IP address 1.2.3.4 > > /etc/postfix/master.cf: > > 1.2.3.4:smtp inet .. .. .. .. .. smtpd > > -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} > > > > /etc/postfix/command_filter: > > /^(MAIL FROM:)\s*<>/MAIL FROM: > > > > Wietse > And use a client_access map in smtpd_client_restriction > check_client_access with a filter action and you will transparently get > the intended behavior without specific client configuration. NO FILTER is needed for the stated purpose: replace the null sender address. Wietse
Re: Null sender rewrite from a specified host.
Le 07/07/2021 à 15:06, Wietse Venema a écrit : Viktor Dukhovni: On Tue, Jul 06, 2021 at 12:56:50PM +0200, Xavier Beaudouin wrote: I currently have an appliance that misuse the null sender (mail from:<>) to send mail. Unfortunatly, this appliance is closed source and we can only setup : fixed ip address and recipient address on GUI (nothing else, even if I try to h4x0r the configuration file). Is there any good advice I can have to make the internal relay server which is postfix based to rewrite the null sender to something cleaner... but ONLY for the device that use postfix as internal relay server? This requires a content filter or milter, that replaces the envelope sender address for messages from the client IP address in question. There is no built-in feature that performs sender address rewrites conditional on the client IP address. The milter should be easy to implement. There is another option: 1 - Configure a Postfix smtpd process on an additional IP addresss or TCP port that only this client will connect to. 2 - Configure that smtpd process with an smtpd_command_filter that replaces "MAIL FROM:<>" with the preferred address. # Listen on port 1234 /etc/postfix/master.cf: 1234 inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} # Listen on IP address 1.2.3.4 /etc/postfix/master.cf: 1.2.3.4:smtp inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} /etc/postfix/command_filter: /^(MAIL FROM:)\s*<>/ MAIL FROM: Wietse And use a client_access map in smtpd_client_restriction check_client_access with a filter action and you will transparently get the intended behavior without specific client configuration. A little bit convoluted but should work. Emmanuel.
Re: Null sender rewrite from a specified host.
Viktor Dukhovni: > On Tue, Jul 06, 2021 at 12:56:50PM +0200, Xavier Beaudouin wrote: > > > I currently have an appliance that misuse the null sender (mail > > from:<>) to send mail. > > > > Unfortunatly, this appliance is closed source > > and we can only setup : fixed ip address and recipient address on GUI > > (nothing else, even if I try to h4x0r the configuration file). > > > > Is there any good advice I can have to make the internal relay server > > which is postfix based to rewrite the null sender to something > > cleaner... but ONLY for the device that use postfix as internal relay > > server? > > This requires a content filter or milter, that replaces the envelope > sender address for messages from the client IP address in question. > > There is no built-in feature that performs sender address rewrites > conditional on the client IP address. > > The milter should be easy to implement. There is another option: 1 - Configure a Postfix smtpd process on an additional IP addresss or TCP port that only this client will connect to. 2 - Configure that smtpd process with an smtpd_command_filter that replaces "MAIL FROM:<>" with the preferred address. # Listen on port 1234 /etc/postfix/master.cf: 1234 inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} # Listen on IP address 1.2.3.4 /etc/postfix/master.cf: 1.2.3.4:smtp inet .. .. .. .. .. smtpd -o {smtpd_command_filter = pcre:/etc/postfix/command_filter} /etc/postfix/command_filter: /^(MAIL FROM:)\s*<>/ MAIL FROM: Wietse
Re: Null sender rewrite from a specified host.
On Tue, Jul 06, 2021 at 12:56:50PM +0200, Xavier Beaudouin wrote: > I currently have an appliance that misuse the null sender (mail > from:<>) to send mail. > > Unfortunatly, this appliance is closed source > and we can only setup : fixed ip address and recipient address on GUI > (nothing else, even if I try to h4x0r the configuration file). > > Is there any good advice I can have to make the internal relay server > which is postfix based to rewrite the null sender to something > cleaner... but ONLY for the device that use postfix as internal relay > server? This requires a content filter or milter, that replaces the envelope sender address for messages from the client IP address in question. There is no built-in feature that performs sender address rewrites conditional on the client IP address. The milter should be easy to implement. -- Viktor.
Re: null sender rewrite
Am 20.04.2012 13:20, schrieb Amira Othman: Hi all I need to rewrite from address for system notification messages because I have them in log file as follows: from=, and I want it to be written in log user@domain how can I do that? first: please get rid of HTML mails on lists! why do you want to do this? only because logging? what benefit should this have? did you really read enough manuals to understand why null sender is used and why it is REQUIRED by RFC and the possible implications by touching this? signature.asc Description: OpenPGP digital signature
RE: null sender rewrite
Hi all I am working on a project that sends mail through postfix, the user that will be sending mail shouldn't receive notification mail for every bounce or problem happen while sending mail, it's because I have user1@mydomain (postfix user) and user2@whatever(user not on my mail server) the latter user is original sender that always receive notification which I don't want to . I searched about disabling notification mails but I found that it's not a good solution so I am thinking of redirect notification message to account I have not to the user but I can't do that because the sender of notification is null so I need it to be user@domain and then redirect this to another account as I need. Regards
Re: null sender rewrite
Am 20.04.2012 14:32, schrieb Amira Othman: Hi all I am working on a project that sends mail through postfix, the user that will be sending mail shouldn't receive notification mail for every bounce or problem happen while sending mail, it's because I have user1@mydomain (postfix user) and user2@whatever(user not on my mail server) the latter user is original sender that always receive notification which I don't want to . I searched about disabling notification mails but I found that it's not a good solution so I am thinking of redirect notification message to account I have not to the user but I can't do that because the sender of notification is null so I need it to be user@domain and then redirect this to another account as I need. Regards Hi, this is simply not a good idea the null user is needed for many special reasons try to reach you goal in an other way -- Best Regards MfG Robert Schetterer Germany/Munich/Bavaria
Re: null sender rewrite
On 4/20/2012 7:32 AM, Amira Othman wrote: Hi all I am working on a project that sends mail through postfix, the user that will be sending mail shouldn't receive notification mail for every bounce or problem happen while sending mail, it's because I have user1@mydomain (postfix user) and user2@whatever(user not on my mail server) the latter user is original sender that always receive notification which I don't want to . I searched about disabling notification mails but I found that it's not a good solution so I am thinking of redirect notification message to account I have not to the user but I can't do that because the sender of notification is null so I need it to be user@domain and then redirect this to another account as I need. Regards When you generate the original outgoing mail, set the envelope sender address to the address where errors and bounces will be delivered. You can still use the user2@whatever as the From: header address, that's the address the recipient will see when they read the message. Doing this any other way -- such as attempting to rewrite or disabling bounces -- is broken by design. -- Noel Jones