J'ai récemment dû diagnostiquer un couple de serveurs utilisant Postfix qui envoyait par courriel les résultats des cronjobs rsync lorsqu'ils retournaient une valeur non-OK.
Pendant que Postfix envoyait un email aux destinataires en cas d'échec de rsync, j'ai remarqué que le STDOUT du cronjob n'était pas relayé localement et correctement vers le mail root. Il s'agit de la vieille boîte Ubuntu exécutant Postfix 2 :
Dec 3 09:30:01 server01 postfix/pickup[10499]: B5A2B780C7F: uid=0 from=<root>
Dec 3 09:30:01 server01 postfix/cleanup[23133]: B5A2B780C7F: message-id=<20181205093001.B5A2B780C7F@server.fqdn.tld>
Dec 3 09:30:01 server01 postfix/qmgr[23780]: B5A2B780C7F: from=<root@server.fqdn.tld>, size=1969, nrcpt=1 (queue active)
Dec 3 09:30:02 server01 postfix/smtp[23135]: B5A2B780C7F: to=<root@localhost.fqdn.tld>, orig_to=<root>, relay=smtp.fqdn.tld[1.2.3.4]:25, delay=0.7, delays=0.26/0.01/0.02/0.42, dsn=2.6.0, status=sent (250 2.6.0 <20181205093001.B5A2B780C7F@server.fqdn.tld> [InternalId=244571470] Queued mail for delivery)
Dec 3 09:30:02 server01 postfix/qmgr[23780]: B5A2B780C7F: removed
Dec 3 10:00:06 server01 postfix/pickup[15878]: 5D0B8780C7F: uid=0 from=<root>
Dec 3 10:00:06 server01 postfix/cleanup[22344]: 5D0B8780C7F: message-id=<20181205100006.5D0B8780C7F@server.fqdn.tld>
Dec 3 10:00:06 server01 postfix/qmgr[23780]: 5D0B8780C7F: from=<root@server.fqdn.tld>, size=2198, nrcpt=1 (queue active)
L'autre serveur, une nouvelle version de CentOS avec Postfix 3, enregistrait les erreurs de manière légèrement différente :
Dec 3 22:02:48 server02 postfix/pickup[20144]: 9491960138: uid=0 from=<root>
Dec 3 22:02:48 server02 postfix/cleanup[26411]: 9491960138: message-id=<20181203220248.9491960138@server02.fqdn.tld>
Dec 3 22:02:48 server02 postfix/qmgr[21628]: 9491960138: from=<root@fqdn.tld>, size=2541, nrcpt=1 (queue active)
Dec 3 22:02:48 server02 postfix/cleanup[26411]: 98BF0600D6: message-id=<20181203220248.9491960138@server02.fqdn.tld>
Dec 3 22:02:48 server02 postfix/qmgr[21628]: 98BF0600D6: from=<root@fqdn.tld>, size=2689, nrcpt=1 (queue active)
Dec 3 22:02:48 server02 postfix/local[26414]: 9491960138: to=<root@localhost>, orig_to=<root>, relay=local, delay=167, delays=167/0.01/0/0, dsn=2.0.0, status=sent (forwarded as 98BF0600D6)
Dec 3 22:02:48 server02 postfix/qmgr[21628]: 9491960138: removed
Dec 3 22:02:48 server02 postfix/local[26414]: 98BF0600D6: to=<root@localhost>, orig_to=<root>, relay=local, delay=0.02, delays=0/0/0/0.01, dsn=5.4.6, status=bounced (mail forwarding loop for root@localhost)
Dec 3 22:02:48 server02 postfix/cleanup[26411]: 9D80F60139: message-id=<20181203220248.9D80F60139@server02.fqdn.tld>
Dec 3 22:02:48 server02 postfix/qmgr[21628]: 9D80F60139: from=<>, size=4684, nrcpt=1 (queue active)
Dec 3 22:02:48 server02 postfix/cleanup[26411]: 9E9ED6013A: message-id=<20181203220248.9D80F60139@server02.fqdn.tld>
Dec 3 22:02:48 server02 postfix/bounce[26416]: 98BF0600D6: sender non-delivery notification: 9D80F60139
Dec 3 22:02:48 server02 postfix/qmgr[21628]: 98BF0600D6: removed
Dec 3 22:02:48 server02 postfix/qmgr[21628]: 9E9ED6013A: from=<>, size=4832, nrcpt=1 (queue active)
Dec 3 22:02:48 server02 postfix/local[26415]: 9D80F60139: to=<root@localhost>, orig_to=<root@fqdn.tld>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (forwarded as 9E9ED6013A)
Dec 3 22:02:48 server02 postfix/qmgr[21628]: 9D80F60139: removed
Dec 3 22:02:48 server02 postfix/local[26414]: 9E9ED6013A: to=<root@localhost>, orig_to=<root@fqdn.tld>, relay=local, delay=0.01, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail forwarding loop for root@localhost)
Dec 3 22:02:48 server02 postfix/qmgr[21628]: 9E9ED6013A: removed
Dec 3 22:30:05 server02 postfix/pickup[20144]: C776360138: uid=0 from=<root>
Dec 3 22:30:05 server02 postfix/cleanup[10175]: C776360138: message-id=<20181203223005.C776360138@server02.fqdn.tld>
Dec 3 22:30:05 server02 postfix/qmgr[21628]: C776360138: from=<root@fqdn.tld>, size=2172, nrcpt=1 (queue active)
Dec 3 22:30:05 server02 postfix/cleanup[10175]: CBB5D600D6: message-id=<20181203223005.C776360138@server02.fqdn.tld>
Dec 3 22:30:05 server02 postfix/qmgr[21628]: CBB5D600D6: from=<root@fqdn.tld>, size=2320, nrcpt=1 (queue active)
Dec 3 22:30:05 server02 postfix/local[10178]: C776360138: to=<root@localhost>, orig_to=<root>, relay=local, delay=4.1, delays=4.1/0.01/0/0, dsn=2.0.0, status=sent (forwarded as CBB5D600D6)
Dec 3 22:30:05 server02 postfix/qmgr[21628]: C776360138: removed
Dec 3 22:30:05 server02 postfix/local[10178]: CBB5D600D6: to=<root@localhost>, orig_to=<root>, relay=local, delay=0.02, delays=0/0/0/0.01, dsn=5.4.6, status=bounced (mail forwarding loop for root@localhost)
Dec 3 22:30:05 server02 postfix/cleanup[10175]: D04C460139: message-id=<20181203223005.D04C460139@server02.fqdn.tld>
Dec 3 22:30:05 server02 postfix/qmgr[21628]: D04C460139: from=<>, size=4315, nrcpt=1 (queue active)
Dec 3 22:30:05 server02 postfix/cleanup[10175]: D14146013A: message-id=<20181203223005.D04C460139@server02.fqdn.tld>
Dec 3 22:30:05 server02 postfix/bounce[10180]: CBB5D600D6: sender non-delivery notification: D04C460139
Dec 3 22:30:05 server02 postfix/qmgr[21628]: CBB5D600D6: removed
Dec 3 22:30:05 server02 postfix/qmgr[21628]: D14146013A: from=<>, size=4463, nrcpt=1 (queue active)
Dec 3 22:30:05 server02 postfix/local[10179]: D04C460139: to=<root@localhost>, orig_to=<root@fqdn.tld>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (forwarded as D14146013A)
Dec 3 22:30:05 server02 postfix/qmgr[21628]: D04C460139: removed
Dec 3 22:30:05 server02 postfix/local[10178]: D14146013A: to=<root@localhost>, orig_to=<root@fqdn.tld>, relay=local, delay=0.01, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail forwarding loop for root@localhost)
Dec 3 22:30:05 server02 postfix/qmgr[21628]: D14146013A: removed
Ces installations Postfix étaient en mesure d'envoyer des e-mails via un relais SMTP aux utilisateurs du domaine de l'entreprise. Mais comment réparer les rapports de la racine locale qui ne sont pas livrés localement ?