Re: Mail not being sent to file
- Message from Damian - Date: Thu, 17 Jun 2021 12:22:28 +0200 From: Damian Subject: Re: Mail not being sent to file To: postfix-users@postfix.org That's interesting... 8.4 saw the upgrade to Postfix 3.5.8 (from 3.3.1 I believe) http://rpmfind.net/linux/centos/8.3.2011/BaseOS/x86_64/os/Packages/postfix-3.3.1-12.el8.x86_64.rpm already had PrivateTmp. Yes... and going back further as far as I can see every version of Postfix used on Centos 8 has had it: https://git.centos.org/rpms/postfix/releases Oldest C8 Postfix is 3.3.1-8, which had it: https://git.centos.org/rpms/postfix/blob/aebf407fea0eeff2335e0d09c70514d7046e7cad/f/SOURCES/postfix.service Standing by earlier comment - this was a change from C7 to C8, not a change within C8. Simon. -- Simon Wilson M: 0400 12 11 16
Re: Mail not being sent to file
On Thu, Jun 17, 2021 at 12:22:28PM +0200, Damian wrote: > >That's interesting... 8.4 saw the upgrade to Postfix 3.5.8 (from > >3.3.1 I believe) > http://rpmfind.net/linux/centos/8.3.2011/BaseOS/x86_64/os/Packages/postfix-3.3.1-12.el8.x86_64.rpm > already had PrivateTmp. Thanks. Honestly I don't have the data to know when I lost my function. It's a fairly rarely used function to acknowledge Nagios alerts via mail. At anyrate, what's clear is that it wasn't a Postfix issue afterall. And I learned a few things as well. Sorry for any noise but I am grateful for the assistance!
Re: Mail not being sent to file
That's interesting... 8.4 saw the upgrade to Postfix 3.5.8 (from 3.3.1 I believe) http://rpmfind.net/linux/centos/8.3.2011/BaseOS/x86_64/os/Packages/postfix-3.3.1-12.el8.x86_64.rpm already had PrivateTmp.
Re: Mail not being sent to file
It broke because as Bastian pointed out in CentOS 8 the Postfix service definition (postfix.service) changed with the addition of PrivateTmp=true. CentOS 7 did not have that so used the "standard" /tmp. Your process WAS WORKING - just not writing to the /tmp you were looking at, but to the postfix service's private /tmp. Pardon me, what I meant was that this used to work with CentOS 8. That's interesting... 8.4 saw the upgrade to Postfix 3.5.8 (from 3.3.1 I believe) which was a major change, but nothing in the release notes (see /usr/share/doc/postfix/README-RedHat.txt on an 8.4 system) mentions a change to the .service file, nor at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.4_release_notes/new-features#enhancement_infrastructure-services. And the changelog only refers to the one bugzilla: * Fri Nov 13 2020 Jaroslav Škarvada - 2:3.5.8-1 - New version Resolves: rhbz#1688389 When did you first see the change? We are possibly straying a little from this mailing list's function... Simon. -- Simon Wilson M: 0400 12 11 16
Re: Mail not being sent to file
On Thu, Jun 17, 2021 at 06:43:11PM +1000, Simon Wilson wrote: > >>>Just don't assume /tmp or /var/tmp are the same between services. > >>> > >>>Postfix on RHEL 8 is configured with private /tmp. To be exact: > >>>| PrivateTmp=true > >>>| CapabilityBoundingSet=~ CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT > >>>CAP_SYS_MODULE > >>>| ProtectSystem=true > >>>| PrivateDevices=true > >>> > >>>Bastian > >> > >> > >>- End message from Bastian Blank > >> - > >> > >>Yup. > >> > >>Using a directory other than /tmp works fine on RHEL8: > >> > >>[root@emp87 ~]# chmod 1777 /home/simon > >>[root@emp87 ~]# echo "somealias: /home/simon/somefile" >> > >>/etc/aliases && newaliases > >>[root@emp87 ~]# echo "test" | mail somealias@localhost > >>[root@emp87 simon]# cat /home/simon/somefile > >>{content as expected} > > > >Thanks guys. You are right -- this does work. > > > >My previous example worked for a long time. Not sure why it suddenly became > >broken but I will try to dig into that some more. > > > > It broke because as Bastian pointed out in CentOS 8 the Postfix > service definition (postfix.service) changed with the addition of > PrivateTmp=true. CentOS 7 did not have that so used the "standard" > /tmp. Your process WAS WORKING - just not writing to the /tmp you > were looking at, but to the postfix service's private /tmp. Pardon me, what I meant was that this used to work with CentOS 8. > You *could* return it to the way it worked before by changing the > service definition file and removing privatetmp - assuming you were > comfortable with opening up postfix /tmp to be normal system /tmp - > others far smarter than I with Postfix would be better placed to > comment on any risks so introduced. > > Simon. > > -- > Simon Wilson > M: 0400 12 11 16 >
Re: Mail not being sent to file
>Just don't assume /tmp or /var/tmp are the same between services. > >Postfix on RHEL 8 is configured with private /tmp. To be exact: >| PrivateTmp=true >| CapabilityBoundingSet=~ CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT >CAP_SYS_MODULE >| ProtectSystem=true >| PrivateDevices=true > >Bastian - End message from Bastian Blank - Yup. Using a directory other than /tmp works fine on RHEL8: [root@emp87 ~]# chmod 1777 /home/simon [root@emp87 ~]# echo "somealias: /home/simon/somefile" >> /etc/aliases && newaliases [root@emp87 ~]# echo "test" | mail somealias@localhost [root@emp87 simon]# cat /home/simon/somefile {content as expected} Thanks guys. You are right -- this does work. My previous example worked for a long time. Not sure why it suddenly became broken but I will try to dig into that some more. It broke because as Bastian pointed out in CentOS 8 the Postfix service definition (postfix.service) changed with the addition of PrivateTmp=true. CentOS 7 did not have that so used the "standard" /tmp. Your process WAS WORKING - just not writing to the /tmp you were looking at, but to the postfix service's private /tmp. You *could* return it to the way it worked before by changing the service definition file and removing privatetmp - assuming you were comfortable with opening up postfix /tmp to be normal system /tmp - others far smarter than I with Postfix would be better placed to comment on any risks so introduced. Simon. -- Simon Wilson M: 0400 12 11 16
Re: Mail not being sent to file
On Thu, Jun 17, 2021 at 05:18:54PM +1000, Simon Wilson wrote: > - Message from Bastian Blank > - >Date: Thu, 17 Jun 2021 07:59:10 +0200 >From: Bastian Blank > Subject: Re: Mail not being sent to file > To: postfix-users@postfix.org > > > >On Wed, Jun 16, 2021 at 05:59:16PM -0700, Jeremiah Rothschild wrote: > >>To triple check my sanity, I created a brand new VM and confirmed the > >>behavior. > >>So anyone should be able to easily reproduce this. > >> > >>* Fresh CentOS 8.4 install > >>* Choose "Minimal" base environment > >>* Defaults for everything else > >> > >># yum -y update > >># yum -y install postfix mailx > >># systemctl start postfix > >># echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases > >># echo "test" | mail somealias@localhost > >># ls /tmp/somefile > > > >Just don't assume /tmp or /var/tmp are the same between services. > > > >Postfix on RHEL 8 is configured with private /tmp. To be exact: > >| PrivateTmp=true > >| CapabilityBoundingSet=~ CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT > >CAP_SYS_MODULE > >| ProtectSystem=true > >| PrivateDevices=true > > > >Bastian > > > - End message from Bastian Blank > - > > Yup. > > Using a directory other than /tmp works fine on RHEL8: > > [root@emp87 ~]# chmod 1777 /home/simon > [root@emp87 ~]# echo "somealias: /home/simon/somefile" >> > /etc/aliases && newaliases > [root@emp87 ~]# echo "test" | mail somealias@localhost > [root@emp87 ~]# cd /home/simon > [root@emp87 simon]# cat /home/simon/somefile > {content as expected} Thanks guys. You are right -- this does work. My previous example worked for a long time. Not sure why it suddenly became broken but I will try to dig into that some more. > Simon. > > -- > Simon Wilson > M: 0400 12 11 16 >
Re: Mail not being sent to file
- Message from Bastian Blank - Date: Thu, 17 Jun 2021 07:59:10 +0200 From: Bastian Blank Subject: Re: Mail not being sent to file To: postfix-users@postfix.org On Wed, Jun 16, 2021 at 05:59:16PM -0700, Jeremiah Rothschild wrote: To triple check my sanity, I created a brand new VM and confirmed the behavior. So anyone should be able to easily reproduce this. * Fresh CentOS 8.4 install * Choose "Minimal" base environment * Defaults for everything else # yum -y update # yum -y install postfix mailx # systemctl start postfix # echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases # echo "test" | mail somealias@localhost # ls /tmp/somefile Just don't assume /tmp or /var/tmp are the same between services. Postfix on RHEL 8 is configured with private /tmp. To be exact: | PrivateTmp=true | CapabilityBoundingSet=~ CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_MODULE | ProtectSystem=true | PrivateDevices=true Bastian - End message from Bastian Blank - Yup. Using a directory other than /tmp works fine on RHEL8: [root@emp87 ~]# chmod 1777 /home/simon [root@emp87 ~]# echo "somealias: /home/simon/somefile" >> /etc/aliases && newaliases [root@emp87 ~]# echo "test" | mail somealias@localhost [root@emp87 ~]# cd /home/simon [root@emp87 simon]# cat /home/simon/somefile {content as expected} Simon. -- Simon Wilson M: 0400 12 11 16
Re: Mail not being sent to file
On Wed, Jun 16, 2021 at 10:48:27PM -0400, Viktor Dukhovni wrote: > On Wed, Jun 16, 2021 at 05:59:16PM -0700, Jeremiah Rothschild wrote: > > > So anyone should be able to easily reproduce this. > > > > * Fresh CentOS 8.4 install > > * Choose "Minimal" base environment > > * Defaults for everything else > > You can debug further with: > > http://www.postfix.org/DEBUG_README.html#auto_trace > http://www.postfix.org/DEBUG_README.html#screen > > > # yum -y update > > # yum -y install postfix mailx > > # systemctl start postfix > > # echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases > > # echo "test" | mail somealias@localhost > > # ls /tmp/somefile > > The upstream Postfix distribution does not claim to have delivered > messages to a file without delivering them to that file. If your > vendor modified Postfix, or your OS discards writes for security > reasons, or ... that's not a result of upstream Postfix behaviour. I believe you. I should have mentioned that this used to work. So it probably is OS-related rather than Postfix-specific. Unfortunately, I don't have enough data to correlate it to any particular package update or other event. > On my machine (latest snapshot, but the local(8) mailbox delivery code > has not changed in ages): > > $ postconf mail_version > mail_version = 3.7-20210605 > > $ postmap -q bogusalias $(postconf -xh alias_maps) > /tmp/bogusalias > > Jun 16 22:40:02 amnesiac postfix/pickup[8135]: B4A3FC7196: uid=0 > from=<...@...> > Jun 16 22:40:02 amnesiac postfix/cleanup[9089]: B4A3FC7196: > message-id=<20210617024002.B4A3FC7196@amnesiac.local> > Jun 16 22:40:02 amnesiac postfix/qmgr[76221]: B4A3FC7196: from=<...@...>, > size=295, nrcpt=1 (queue active) > Jun 16 22:40:02 amnesiac postfix/local[9091]: B4A3FC7196: > to=, relay=local, delay=0.06, > delays=0.04/0.02/0/0, dsn=2.0.0, status=sent (delivered to file: > /tmp/bogusalias) > Jun 16 22:40:02 amnesiac postfix/qmgr[76221]: B4A3FC7196: removed > > $ cat /tmp/bogusalias > From ...@... Wed Jun 16 22:40:02 2021 > Return-Path: <...@...> > X-Original-To: bogusalias@amnesiac.local > Delivered-To: bogusalias@amnesiac.local > Received: by amnesiac.local (Postfix, from userid 0) > id B4A3FC7196; Wed, 16 Jun 2021 22:40:02 -0400 (EDT) > To: bogusalias@amnesiac.local > From: ...@... > Subject: test > Message-Id: <20210617024002.B4A3FC7196@amnesiac.local> > Date: Wed, 16 Jun 2021 22:40:02 -0400 (EDT) > > hi > > -- > Viktor.
Re: Mail not being sent to file
On Wed, Jun 16, 2021 at 05:59:16PM -0700, Jeremiah Rothschild wrote: > To triple check my sanity, I created a brand new VM and confirmed the > behavior. > So anyone should be able to easily reproduce this. > > * Fresh CentOS 8.4 install > * Choose "Minimal" base environment > * Defaults for everything else > > # yum -y update > # yum -y install postfix mailx > # systemctl start postfix > # echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases > # echo "test" | mail somealias@localhost > # ls /tmp/somefile Just don't assume /tmp or /var/tmp are the same between services. Postfix on RHEL 8 is configured with private /tmp. To be exact: | PrivateTmp=true | CapabilityBoundingSet=~ CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_MODULE | ProtectSystem=true | PrivateDevices=true Bastian -- You! What PLANET is this! -- McCoy, "The City on the Edge of Forever", stardate 3134.0
Re: Mail not being sent to file
On Thu, Jun 17, 2021 at 12:42:43PM +1000, Simon Wilson wrote: > On RHEL 8: > > [root@emp87 ~]# echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases > [root@emp87 ~]# echo "test" | mail somealias@localhost > [root@emp87 ~]# ls /tmp/somefile > ls: cannot access '/tmp/somefile': No such file or directory - Is this reproducible regardles of the target filesystem, i.e. also for delivery to mbox files in other directories (mode 1777 is typically required for for the "dotlock protocol" to work). - Is the "nobody" account specifically affected, or also other accounts, i.e. what happens if you change "default_privs" to some other account? - Does maildir work better? > Jun 17 12:38:57 emp87 postfix/local[2333723]: B92E199511: > to=, relay=local, delay=0.02, > delays=0.01/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to file: > /tmp/somefile) > > On CentOS 7: > > [root@emp75 ~]# echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases > [root@emp75 ~]# echo "test" | mail somealias@localhost > [root@emp75 ~]# ls /tmp/somefile > /tmp/somefile (contents as expected) Looks like RedHat "improved" Postfix, the OS or both... -- Viktor.
Re: Mail not being sent to file
On Wed, Jun 16, 2021 at 05:59:16PM -0700, Jeremiah Rothschild wrote: > So anyone should be able to easily reproduce this. > > * Fresh CentOS 8.4 install > * Choose "Minimal" base environment > * Defaults for everything else You can debug further with: http://www.postfix.org/DEBUG_README.html#auto_trace http://www.postfix.org/DEBUG_README.html#screen > # yum -y update > # yum -y install postfix mailx > # systemctl start postfix > # echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases > # echo "test" | mail somealias@localhost > # ls /tmp/somefile The upstream Postfix distribution does not claim to have delivered messages to a file without delivering them to that file. If your vendor modified Postfix, or your OS discards writes for security reasons, or ... that's not a result of upstream Postfix behaviour. On my machine (latest snapshot, but the local(8) mailbox delivery code has not changed in ages): $ postconf mail_version mail_version = 3.7-20210605 $ postmap -q bogusalias $(postconf -xh alias_maps) /tmp/bogusalias Jun 16 22:40:02 amnesiac postfix/pickup[8135]: B4A3FC7196: uid=0 from=<...@...> Jun 16 22:40:02 amnesiac postfix/cleanup[9089]: B4A3FC7196: message-id=<20210617024002.B4A3FC7196@amnesiac.local> Jun 16 22:40:02 amnesiac postfix/qmgr[76221]: B4A3FC7196: from=<...@...>, size=295, nrcpt=1 (queue active) Jun 16 22:40:02 amnesiac postfix/local[9091]: B4A3FC7196: to=, relay=local, delay=0.06, delays=0.04/0.02/0/0, dsn=2.0.0, status=sent (delivered to file: /tmp/bogusalias) Jun 16 22:40:02 amnesiac postfix/qmgr[76221]: B4A3FC7196: removed $ cat /tmp/bogusalias From ...@... Wed Jun 16 22:40:02 2021 Return-Path: <...@...> X-Original-To: bogusalias@amnesiac.local Delivered-To: bogusalias@amnesiac.local Received: by amnesiac.local (Postfix, from userid 0) id B4A3FC7196; Wed, 16 Jun 2021 22:40:02 -0400 (EDT) To: bogusalias@amnesiac.local From: ...@... Subject: test Message-Id: <20210617024002.B4A3FC7196@amnesiac.local> Date: Wed, 16 Jun 2021 22:40:02 -0400 (EDT) hi -- Viktor.
Re: Mail not being sent to file
- Message from Jeremiah Rothschild - Date: Wed, 16 Jun 2021 17:59:16 -0700 From: Jeremiah Rothschild Subject: Re: Mail not being sent to file To: Postfix users On Wed, Jun 16, 2021 at 04:48:09PM -0700, Jeremiah Rothschild wrote: On Wed, Jun 16, 2021 at 07:13:18PM -0400, Wietse Venema wrote: > Is the 'lost file' problem reproducible? Yes, the time gap is a red herring. First the issue was noticed in production then I tested with this VM. To triple check my sanity, I created a brand new VM and confirmed the behavior. So anyone should be able to easily reproduce this. * Fresh CentOS 8.4 install * Choose "Minimal" base environment * Defaults for everything else # yum -y update # yum -y install postfix mailx # systemctl start postfix # echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases # echo "test" | mail somealias@localhost # ls /tmp/somefile j - End message from Jeremiah Rothschild - Confirmed and reproducible. On RHEL 8: [root@emp87 ~]# echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases [root@emp87 ~]# echo "test" | mail somealias@localhost [root@emp87 ~]# ls /tmp/somefile ls: cannot access '/tmp/somefile': No such file or directory Jun 17 12:38:57 emp87 postfix/local[2333723]: B92E199511: to=, relay=local, delay=0.02, delays=0.01/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to file: /tmp/somefile) On CentOS 7: [root@emp75 ~]# echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases [root@emp75 ~]# echo "test" | mail somealias@localhost [root@emp75 ~]# ls /tmp/somefile /tmp/somefile (contents as expected) Simon. -- Simon Wilson M: 0400 12 11 16
Re: Mail not being sent to file
On Wed, Jun 16, 2021 at 04:48:09PM -0700, Jeremiah Rothschild wrote: > On Wed, Jun 16, 2021 at 07:13:18PM -0400, Wietse Venema wrote: > > Is the 'lost file' problem reproducible? > > Yes, the time gap is a red herring. First the issue was noticed in > production then I tested with this VM. To triple check my sanity, I created a brand new VM and confirmed the behavior. So anyone should be able to easily reproduce this. * Fresh CentOS 8.4 install * Choose "Minimal" base environment * Defaults for everything else # yum -y update # yum -y install postfix mailx # systemctl start postfix # echo "somealias: /tmp/somefile" >> /etc/aliases && newaliases # echo "test" | mail somealias@localhost # ls /tmp/somefile j
Re: Mail not being sent to file
On Wed, Jun 16, 2021 at 07:13:18PM -0400, Wietse Venema wrote: > Jeremiah Rothschild: > > /tmp is a separate filesystem: > > [root@c8vm ~]# grep tmp /etc/fstab > > /dev/mapper/rootvg-tmp /tmpext4defaults1 2 > > [root@c8vm ~]# df -h /tmp > > Filesystem Size Used Avail Use% Mounted on > > /dev/mapper/rootvg-tmp 2.0G 6.1M 1.8G 1% /tmp > > > > and it appears the same as a root and non-root user: > > [root@c8vm ~]# id > > uid=0(root) gid=0(root) groups=0(root) > > [root@c8vm ~]# touch /tmp/testfile > > Postfix did not create that file as 'root'. You should use the same > user as when Postfix delivered the file. User nobody isn't a normal user with a normal environment but I went ahead and temporarily assigned it a shell for testing: [root@c8vm ~]# su - nobody [nobody@c8vm /]$ touch /tmp/testfile [nobody@c8vm /]$ ls -l $_ -rw-rw-r-- 1 nobody nobody 0 Jun 16 16:33 /tmp/testfile [nobody@c8vm /]$ logout [root@c8vm ~]# su - jeremiah Last login: Wed Jun 16 16:34:32 PDT 2021 on pts/1 [jeremiah@c8vm ~]$ ls -l /tmp/testfile -rw-rw-r-- 1 nobody nobody 0 Jun 16 16:33 /tmp/testfile > Is the 'lost file' problem reproducible? Your pastebin had a large > time gap between delivery and looking with 'ls'. Yes, the time gap is a red herring. First the issue was noticed in production then I tested with this VM. On Wed, Jun 16, 2021 at 05:43:07PM -0600, Bob Proulx wrote: > Jeremiah Rothschild wrote: > > * OS: CentOS 8.4.2105 x64 (fully updated) > > I tested this on CentOS 7 and it worked okay for me. No problem. I > don't know anything about CentOS 8. Nod. I also tested this under CentOS 7 without issue. Thanks for confirming. > > [root@c8vm ~]# ls -l /tmp/somefile > > ls: cannot access '/tmp/somefile': No such file or directory > > Is your postfix running inside of a container with a different /tmp > than the one outside the container? No containers. > All appearances are that it is writing to /tmp/somefile and if it is > not there later then either it is getting removed or it is a different > /tmp. I also have the same problem when choosing a filesystem other than /tmp -- such as /home.
Re: Mail not being sent to file
Jeremiah Rothschild wrote: > * OS: CentOS 8.4.2105 x64 (fully updated) I tested this on CentOS 7 and it worked okay for me. No problem. I don't know anything about CentOS 8. > [root@c8vm ~]# ls -l /tmp/somefile > ls: cannot access '/tmp/somefile': No such file or directory Is your postfix running inside of a container with a different /tmp than the one outside the container? All appearances are that it is writing to /tmp/somefile and if it is not there later then either it is getting removed or it is a different /tmp. Bob
Re: Mail not being sent to file
Jeremiah Rothschild: > /tmp is a separate filesystem: > [root@c8vm ~]# grep tmp /etc/fstab > /dev/mapper/rootvg-tmp /tmpext4defaults1 2 > [root@c8vm ~]# df -h /tmp > Filesystem Size Used Avail Use% Mounted on > /dev/mapper/rootvg-tmp 2.0G 6.1M 1.8G 1% /tmp > > and it appears the same as a root and non-root user: > [root@c8vm ~]# id > uid=0(root) gid=0(root) groups=0(root) > [root@c8vm ~]# touch /tmp/testfile Postfix did not create that file as 'root'. You should use the same user as when Postfix delivered the file. Is the 'lost file' problem reproducible? Your pastebin had a large time gap between delivery and looking with 'ls'. Wietse
Re: Mail not being sent to file
On Wed, Jun 16, 2021 at 05:33:33PM -0400, Viktor Dukhovni wrote: > On Wed, Jun 16, 2021 at 01:51:37PM -0700, Jeremiah Rothschild wrote: > > > I have an alias that is supposed to write to a file but it is not. > > > > * OS: CentOS 8.4.2105 x64 (fully updated) > > * Kernel: 4.18.0-305.3.1.el8.x86_64 > > * Postfix: 3.5.8-1.el8.x86_64 (default config w/ verbose logging) > > > > Very basic /etc/aliases: > > [root@c8vm ~]# cat /etc/aliases > > somealias: /tmp/somefile > > > > I send a test which looks successful: > > Jun 16 13:21:23 c8vm postfix/local[57869]: 72F0380292: > > to=, relay=local, delay=0.13, delays=0.09/0.01/0/0.02, > > dsn=2.0.0, status=sent (delivered to file: /tmp/somefile) > > > > but it was not: > > [root@c8vm ~]# ls -l /tmp/somefile > > ls: cannot access '/tmp/somefile': No such file or directory > > [root@c8vm ~]# ls -ld /tmp > > 4 drwxrwxrwt. 10 root root 4096 Jun 16 13:38 /tmp/ > > Delivery to files in "/tmp" is of course not a good idea, but in any > case looks like the file was deleted some time after delivery, it > was present or freshly created at time of delivery. Hmm, the window for deletion is literally seconds since I am looking for the file immediately after delivery. What sort of further debugging could I do to verify your theory that the file is actually being placed on the filesystem? I suppose I could use something like inotify(). > > The full verbose maillog can be viewed @ https://pastebin.com/raw/hAi1gCBA. > > > > The `postconf -n` and `postconf -Mf` outputs can be viewed @ > > https://pastebin.com/raw/MDGB05CB. > > Paste bins are a nuisance, attaching the content is preferred. My bad. Noted. > -- > Viktor.
Re: Mail not being sent to file
On Wed, Jun 16, 2021 at 05:23:20PM -0400, Wietse Venema wrote: > Jeremiah Rothschild: > > Hello, > > > > I have an alias that is supposed to write to a file but it is not. > > > > * OS: CentOS 8.4.2105 x64 (fully updated) > > * Kernel: 4.18.0-305.3.1.el8.x86_64 > > * Postfix: 3.5.8-1.el8.x86_64 (default config w/ verbose logging) > > > > Very basic /etc/aliases: > > [root@c8vm ~]# cat /etc/aliases > > somealias: /tmp/somefile > > > > I send a test which looks successful: > > Jun 16 13:21:23 c8vm postfix/local[57869]: 72F0380292: > > to=, relay=local, delay=0.13, delays=0.09/0.01/0/0.02, > > dsn=2.0.0, status=sent (delivered to file: /tmp/somefile) > > > > but it was not: > > [root@c8vm ~]# ls -l /tmp/somefile > > ls: cannot access '/tmp/somefile': No such file or directory > > [root@c8vm ~]# ls -ld /tmp > > 4 drwxrwxrwt. 10 root root 4096 Jun 16 13:38 /tmp/ > > According to your logs, Postfix delivers the file as (uid 65534 > gid 65534). HOWEVER, you are looking at /tmp as a different user. Thanks for the reply! Yes, postfix delivers as user nobody (id 65534). > Postfix assumes that /tmp is shared, that is, when Postfix writes > a file to /tmp, then some other user (you) can access that same > file by the same name. > > I suspect that your system may have per-user tmpfs. /tmp is a separate filesystem: [root@c8vm ~]# grep tmp /etc/fstab /dev/mapper/rootvg-tmp /tmpext4defaults1 2 [root@c8vm ~]# df -h /tmp Filesystem Size Used Avail Use% Mounted on /dev/mapper/rootvg-tmp 2.0G 6.1M 1.8G 1% /tmp and it appears the same as a root and non-root user: [root@c8vm ~]# id uid=0(root) gid=0(root) groups=0(root) [root@c8vm ~]# touch /tmp/testfile [root@c8vm ~]# su jeremiah [jeremiah@c8vm /root]$ ls -l /tmp/testfile -rw-r--r-- 1 root root 0 Jun 16 14:30 /tmp/testfile Am I misunderstanding your idea? > Wietse > > > The full verbose maillog can be viewed @ https://pastebin.com/raw/hAi1gCBA. > > > > The `postconf -n` and `postconf -Mf` outputs can be viewed @ > > https://pastebin.com/raw/MDGB05CB. > > > > Thanks for any help! > > > > j > >
Re: Mail not being sent to file
On Wed, Jun 16, 2021 at 01:51:37PM -0700, Jeremiah Rothschild wrote: > I have an alias that is supposed to write to a file but it is not. > > * OS: CentOS 8.4.2105 x64 (fully updated) > * Kernel: 4.18.0-305.3.1.el8.x86_64 > * Postfix: 3.5.8-1.el8.x86_64 (default config w/ verbose logging) > > Very basic /etc/aliases: > [root@c8vm ~]# cat /etc/aliases > somealias: /tmp/somefile > > I send a test which looks successful: > Jun 16 13:21:23 c8vm postfix/local[57869]: 72F0380292: > to=, relay=local, delay=0.13, delays=0.09/0.01/0/0.02, > dsn=2.0.0, status=sent (delivered to file: /tmp/somefile) > > but it was not: > [root@c8vm ~]# ls -l /tmp/somefile > ls: cannot access '/tmp/somefile': No such file or directory > [root@c8vm ~]# ls -ld /tmp > 4 drwxrwxrwt. 10 root root 4096 Jun 16 13:38 /tmp/ Delivery to files in "/tmp" is of course not a good idea, but in any case looks like the file was deleted some time after delivery, it was present or freshly created at time of delivery. > The full verbose maillog can be viewed @ https://pastebin.com/raw/hAi1gCBA. > > The `postconf -n` and `postconf -Mf` outputs can be viewed @ > https://pastebin.com/raw/MDGB05CB. Paste bins are a nuisance, attaching the content is preferred. -- Viktor.
Re: Mail not being sent to file
Jeremiah Rothschild: > Hello, > > I have an alias that is supposed to write to a file but it is not. > > * OS: CentOS 8.4.2105 x64 (fully updated) > * Kernel: 4.18.0-305.3.1.el8.x86_64 > * Postfix: 3.5.8-1.el8.x86_64 (default config w/ verbose logging) > > Very basic /etc/aliases: > [root@c8vm ~]# cat /etc/aliases > somealias: /tmp/somefile > > I send a test which looks successful: > Jun 16 13:21:23 c8vm postfix/local[57869]: 72F0380292: > to=, relay=local, delay=0.13, delays=0.09/0.01/0/0.02, > dsn=2.0.0, status=sent (delivered to file: /tmp/somefile) > > but it was not: > [root@c8vm ~]# ls -l /tmp/somefile > ls: cannot access '/tmp/somefile': No such file or directory > [root@c8vm ~]# ls -ld /tmp > 4 drwxrwxrwt. 10 root root 4096 Jun 16 13:38 /tmp/ According to your logs, Postfix delivers the file as (uid 65534 gid 65534). HOWEVER, you are looking at /tmp as a different user. Postfix assumes that /tmp is shared, that is, when Postfix writes a file to /tmp, then some other user (you) can access that same file by the same name. I suspect that your system may have per-user tmpfs. Wietse > The full verbose maillog can be viewed @ https://pastebin.com/raw/hAi1gCBA. > > The `postconf -n` and `postconf -Mf` outputs can be viewed @ > https://pastebin.com/raw/MDGB05CB. > > Thanks for any help! > > j >
Mail not being sent to file
Hello, I have an alias that is supposed to write to a file but it is not. * OS: CentOS 8.4.2105 x64 (fully updated) * Kernel: 4.18.0-305.3.1.el8.x86_64 * Postfix: 3.5.8-1.el8.x86_64 (default config w/ verbose logging) Very basic /etc/aliases: [root@c8vm ~]# cat /etc/aliases somealias: /tmp/somefile I send a test which looks successful: Jun 16 13:21:23 c8vm postfix/local[57869]: 72F0380292: to=, relay=local, delay=0.13, delays=0.09/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to file: /tmp/somefile) but it was not: [root@c8vm ~]# ls -l /tmp/somefile ls: cannot access '/tmp/somefile': No such file or directory [root@c8vm ~]# ls -ld /tmp 4 drwxrwxrwt. 10 root root 4096 Jun 16 13:38 /tmp/ The full verbose maillog can be viewed @ https://pastebin.com/raw/hAi1gCBA. The `postconf -n` and `postconf -Mf` outputs can be viewed @ https://pastebin.com/raw/MDGB05CB. Thanks for any help! j