Having got my several 'send only' systems configured successfully
(thank you all for your help doing this) I now have another fairly minor problem. Errors from all of these systems are (mostly) sent by root, typically they will be cron or anacron processes. As these are just systems on my LAN they don't each have their own 'valid on the internet' hostname. Thus the error messages come from [hidden email] whichever system has sent it. While I can look through the E-Mail header to see where the message has come from it would be good if I could somehow configure things so that the headers I normally see (From:, To: and Subject:) include something that indicates where the message is from. So, is there something I can configure in postfix to always add some text of some sort (the hostname is the obvious thing) to one of From:, To: or Subject: ? -- Chris Green |
On 2020-12-08 17:56 GMT, Chris Green wrote:
> So, is there something I can configure in postfix to always add some > text of some sort (the hostname is the obvious thing) to one of From:, > To: or Subject: ? Try something like main.cf sender_canonical_maps = hash:/etc/postfix/sender-canonical-map sender-canonical-map root foo-root HTH, -- Nick |
In reply to this post by Chris Green-11
On Tue, 8 Dec 2020 17:56:33 +0000
Chris Green <[hidden email]> wrote: > So, is there something I can configure in postfix to always add some > text of some sort (the hostname is the obvious thing) to one of From:, > To: or Subject: ? Personally, I use the GCOS field in /etc/passwd (the 5th field). Mine looks moreless like "Charlie <hotstname> &", and all my diagnostic messages come fairly recognizable. One real world example: root:*:0:0:Charlie Baobab &:/root:/bin/csh Luciano. -- /"\ /Via A. Salaino, 7 - 20144 Milano (Italy) \ / ASCII RIBBON CAMPAIGN / PHONE : +39 02485781 FAX: +39 0248028247 X AGAINST HTML MAIL / E-MAIL: [hidden email] / \ AND POSTINGS / WWW: http://www.lesassaie.IT/ |
On Tue, Dec 08, 2020 at 07:36:57PM +0100, Luciano Mannucci wrote:
> On Tue, 8 Dec 2020 17:56:33 +0000 > Chris Green <[hidden email]> wrote: > > > So, is there something I can configure in postfix to always add some > > text of some sort (the hostname is the obvious thing) to one of From:, > > To: or Subject: ? > Personally, I use the GCOS field in /etc/passwd (the 5th field). Mine > looks moreless like "Charlie <hotstname> &", and all my diagnostic > messages come fairly recognizable. One real world example: > > root:*:0:0:Charlie Baobab &:/root:/bin/csh > -- Chris Green |
In reply to this post by Chris Green-11
On Tue, Dec 08, 2020 at 05:56:33PM +0000, Chris Green wrote:
> Having got my several 'send only' systems configured successfully > (thank you all for your help doing this) I now have another fairly > minor problem. > > Errors from all of these systems are (mostly) sent by root, typically > they will be cron or anacron processes. As these are just systems on > my LAN they don't each have their own 'valid on the internet' > hostname. Thus the error messages come from [hidden email] whichever > system has sent it. > > While I can look through the E-Mail header to see where the message > has come from it would be good if I could somehow configure things so > that the headers I normally see (From:, To: and Subject:) include > something that indicates where the message is from. http://www.postfix.org/MULTI_INSTANCE_README.html#quick -- Viktor. |
In reply to this post by Chris Green-11
On Tue, 8 Dec 2020 20:03:27 +0000
Chris Green <[hidden email]> wrote: > > root:*:0:0:Charlie Baobab &:/root:/bin/csh > > > So does anything in the GCOS field appear in the From: header? Well, it seems to. "The From:" I get in the diagnostic messages looks like this: From: Charlie Baobab Root <[hidden email]> It might be configurable, depending probably on the Mail User Agent that you are using. Luciano. -- /"\ /Via A. Salaino, 7 - 20144 Milano (Italy) \ / ASCII RIBBON CAMPAIGN / PHONE : +39 02485781 FAX: +39 0248028247 X AGAINST HTML MAIL / E-MAIL: [hidden email] / \ AND POSTINGS / WWW: http://www.lesassaie.IT/ |
On Tue, Dec 08, 2020 at 10:36:48PM +0100, Luciano Mannucci wrote:
> On Tue, 8 Dec 2020 20:03:27 +0000 > Chris Green <[hidden email]> wrote: > > > > root:*:0:0:Charlie Baobab &:/root:/bin/csh > > > > > So does anything in the GCOS field appear in the From: header? > Well, it seems to. "The From:" I get in the diagnostic messages looks > like this: > > From: Charlie Baobab Root <[hidden email]> > > It might be configurable, depending probably on the Mail User Agent > that you are using. > -- Chris Green |
In reply to this post by Chris Green-11
Chris Green:
> On Tue, Dec 08, 2020 at 07:36:57PM +0100, Luciano Mannucci wrote: > > On Tue, 8 Dec 2020 17:56:33 +0000 > > Chris Green <[hidden email]> wrote: > > > > > So, is there something I can configure in postfix to always add some > > > text of some sort (the hostname is the obvious thing) to one of From:, > > > To: or Subject: ? > > Personally, I use the GCOS field in /etc/passwd (the 5th field). Mine > > looks moreless like "Charlie <hotstname> &", and all my diagnostic > > messages come fairly recognizable. One real world example: > > > > root:*:0:0:Charlie Baobab &:/root:/bin/csh > > > So does anything in the GCOS field appear in the From: header? Yes. You can provide the full name with The following are used when no From: header exists. Some mail command-line tools will add a From: header with information that may or may not be what you want. sendmail -f full_name, used only when no From: header exists. The NAME environment variable, used by the sendmal command. Otherwise it uses the GECOS field. The sendmail command line fails to mention that. Wietse |
In reply to this post by Chris Green-11
On 08 Dec 2020, at 13:04, Chris Green <[hidden email]> wrote:
> On Tue, Dec 08, 2020 at 12:39:07PM -0700, @lbutlr wrote: >> On 08 Dec 2020, at 10:56, Chris Green <[hidden email]> wrote: >>> While I can look through the E-Mail header to see where the message >>> has come from it would be good if I could somehow configure things so >>> that the headers I normally see (From:, To: and Subject:) include >>> something that indicates where the message is from. >> >> I would configure root to be an alias to root+machineID. >> > So how do I do that? Edit the .../postfix/aliases file and then run postalias on the file. -- When someone asks you, A penny for your thoughts, and you put your two cents in, what happens to the other penny? |
On Wed, Dec 09, 2020 at 02:33:37AM -0700, @lbutlr wrote:
> On 08 Dec 2020, at 13:04, Chris Green <[hidden email]> wrote: > > On Tue, Dec 08, 2020 at 12:39:07PM -0700, @lbutlr wrote: > >> On 08 Dec 2020, at 10:56, Chris Green <[hidden email]> wrote: > >>> While I can look through the E-Mail header to see where the message > >>> has come from it would be good if I could somehow configure things so > >>> that the headers I normally see (From:, To: and Subject:) include > >>> something that indicates where the message is from. > >> > >> I would configure root to be an alias to root+machineID. > >> > > So how do I do that? > > Edit the .../postfix/aliases file and then run postalias on the file. > luser_relay = [hidden email] local_recipient_maps = There are no local recipients, that's the whole point. These messages will always be errors/warnings from daemons or cron processes on (mostly) headless systems that I want to see so I'm sending them off to myself. -- Chris Green |
On 09 Dec 2020, at 03:00, Chris Green <[hidden email]> wrote:
> On Wed, Dec 09, 2020 at 02:33:37AM -0700, @lbutlr wrote: >> On 08 Dec 2020, at 13:04, Chris Green <[hidden email]> wrote: >>> On Tue, Dec 08, 2020 at 12:39:07PM -0700, @lbutlr wrote: >>>> On 08 Dec 2020, at 10:56, Chris Green <[hidden email]> wrote: >>>>> While I can look through the E-Mail header to see where the message >>>>> has come from it would be good if I could somehow configure things so >>>>> that the headers I normally see (From:, To: and Subject:) include >>>>> something that indicates where the message is from. >>>> >>>> I would configure root to be an alias to root+machineID. >>>> >>> So how do I do that? >> >> Edit the .../postfix/aliases file and then run postalias on the file. >> > Ah, no, it never gets that far, I have:- > > luser_relay = [hidden email] > local_recipient_maps = Hmm. Might have to edit the /etc/aliases and run newalaises then. But changing the name in /etc/password seems cleaner. > There are no local recipients, that's the whole point. These messages > will always be errors/warnings from daemons or cron processes on > (mostly) headless systems that I want to see so I'm sending them off > to myself. Right, but cron and daemon emails do not need or use a postfix install by default, so the question would be does the sendmail process or ssmtp read the /etc/alaises? I THINK it does, but it's been a long time since I needed to do this. I do have one server that still does this, but it is currently offline until I drive to the server room and push some buttons, so I can't double check exactly how it is configured, but this is what an exchange looks like from that server: [<-] 220 mail.covisp.net ESMTP Postfix 3.5.8 [->] EHLO mail.covisp.net:465 [<-] 250 CHUNKING [->] AUTH LOGIN [<-] 334 STUFF [->] STUFF [<-] 334 STUFF [<-] 235 2.7.0 Authentication successful [->] MAIL FROM:<[hidden email]> [<-] 250 2.1.0 Ok [->] RCPT TO:<[hidden email]> [<-] 250 2.1.5 Ok [->] DATA [<-] 354 End data with <CR><LF>.<CR><LF> [->] Received: by mail.covisp.net:465 (sSMTP sendmail emulation); Sun, 29 Nov 2020 02:02:00 -0700 (But that's not postfix, but the very basic sSMTP, which works fine since that server only generates a few cron/deamon messages per week) -- Stupid men are often capable of things the clever would not dare to contemplate... --Feet of Clay |
On Wed, Dec 09, 2020 at 04:55:13AM -0700, @lbutlr wrote:
> On 09 Dec 2020, at 03:00, Chris Green <[hidden email]> wrote: > > On Wed, Dec 09, 2020 at 02:33:37AM -0700, @lbutlr wrote: > >> On 08 Dec 2020, at 13:04, Chris Green <[hidden email]> wrote: > >>> On Tue, Dec 08, 2020 at 12:39:07PM -0700, @lbutlr wrote: > >>>> On 08 Dec 2020, at 10:56, Chris Green <[hidden email]> wrote: > >>>>> While I can look through the E-Mail header to see where the message > >>>>> has come from it would be good if I could somehow configure things so > >>>>> that the headers I normally see (From:, To: and Subject:) include > >>>>> something that indicates where the message is from. > >>>> > >>>> I would configure root to be an alias to root+machineID. > >>>> > >>> So how do I do that? > >> > >> Edit the .../postfix/aliases file and then run postalias on the file. > >> > > Ah, no, it never gets that far, I have:- > > > > luser_relay = [hidden email] > > local_recipient_maps = > > Hmm. Might have to edit the /etc/aliases and run newalaises then. > > But changing the name in /etc/password seems cleaner. > > > There are no local recipients, that's the whole point. These messages > > will always be errors/warnings from daemons or cron processes on > > (mostly) headless systems that I want to see so I'm sending them off > > to myself. > > Right, but cron and daemon emails do not need or use a postfix install > by default, so the question would be does the sendmail process or ssmtp > read the /etc/alaises? I THINK it does, but it's been a long time since > I needed to do this. > systems, thus errors from anacron/cron go nowhere, that's the original issue that I was addressing. While I could install ssmtp, for me it's no easier than Postfix. The required main.cf to make it work is very simple and is identical on all these systems. -- Chris Green |
In reply to this post by @lbutlr
Dnia 9.12.2020 o godz. 04:55:13 @lbutlr pisze:
> > Hmm. Might have to edit the /etc/aliases and run newalaises then. /etc/aliases works for incoming email. OP clearly states that there is no incoming email at all, and he needs to modify the username for outgoing email. > Right, but cron and daemon emails do not need or use a postfix install by > default, They do use /usr/sbin/sendmail however, and that needs to come "from somewhere". In OP's case, from Postfix. -- Regards, Jaroslaw Rafa [hidden email] -- "In a million years, when kids go to school, they're gonna know: once there was a Hushpuppy, and she lived with her daddy in the Bathtub." |
On 09 Dec 2020, at 05:59, Jaroslaw Rafa <[hidden email]> wrote:
> Dnia 9.12.2020 o godz. 04:55:13 @lbutlr pisze: >> >> Hmm. Might have to edit the /etc/aliases and run newalaises then. > > /etc/aliases works for incoming email. No, that is definitely not correct. It works for internal local mail as well, otherwise I would never see mail sent to root. -- "You can speak soon and write like a graduate college if me let you help for a day of 15 minutes" "1963" Issue #1 |
On Wed, Dec 09, 2020 at 06:04:58AM -0700, @lbutlr wrote:
> On 09 Dec 2020, at 05:59, Jaroslaw Rafa <[hidden email]> wrote: > > Dnia 9.12.2020 o godz. 04:55:13 @lbutlr pisze: > >> > >> Hmm. Might have to edit the /etc/aliases and run newalaises then. > > > > /etc/aliases works for incoming email. > > No, that is definitely not correct. It works for internal local mail as > well, otherwise I would never see mail sent to root. > /etc/aliases to make sure I receive mail sent to postmaster, root and a couple of other user accounts. However on the other (mostly headless) systems on the LAN a way to catch *any* mail sent and fire it off to me on my desktop is handy. -- Chris Green |
In reply to this post by @lbutlr
Dnia 9.12.2020 o godz. 06:04:58 @lbutlr pisze:
> > /etc/aliases works for incoming email. > > No, that is definitely not correct. It works for internal local mail as > well, otherwise I would never see mail sent to root. But what is important is that /etc/aliases applies when mail is *received*, not sent. In this context it's "incoming" mail. It doesn't matter that it is both sent and received on local machine. /etc/aliases ensures that eg. mail sent to "root" goes to "mysuer". But it doesn't help if you want mail sent *from* "root" have in "From:" field something like "root-machineA". And that's what OP wanted. He wanted to be able to distinguish messages sent from "root" on different machines, where each sender address is the same "root@domain", by somehow including machine name in the "From:" header. /etc/aliases won't help in that. -- Regards, Jaroslaw Rafa [hidden email] -- "In a million years, when kids go to school, they're gonna know: once there was a Hushpuppy, and she lived with her daddy in the Bathtub." |
Free forum by Nabble | Edit this page |