yum-cron 电子邮件发送给 root 用户而不是指定用户

yum-cron 电子邮件发送给 root 用户而不是指定用户

我有几台 RHEL 6 服务器,我已配置 yum-cron 在这些服务器上运行。我已将它们配置为将电子邮件输出发送到我的地址。问题是,除了一台服务器之外,其他所有服务器仍在向 root 发送邮件。我肯定我漏掉了一些简单的东西,但我还是想找出是什么。有什么建议吗?

在下面的配置和日志中,ServerOne 将消息传递到正确的地址,而 ServerTwo 则没有。

以下是来自 ServerOne 的邮件日志:

May 11 04:51:43 ServerOne postfix/pickup[31719]: 8093C29EBD5: uid=0 from=<root>
May 11 04:51:43 ServerOne postfix/cleanup[53080]: 8093C29EBD5: message-id=<[email protected]>
May 11 04:51:43 ServerOne postfix/qmgr[6134]: 8093C29EBD5: from=<[email protected]>, size=29582, nrcpt=1 (queue active)
May 11 04:51:44 ServerOne postfix/smtp[53089]: 8093C29EBD5: to=<[email protected]>, relay=10.1.0.7[10.1.0.7]:25, delay=1.2, delays=0.29/0.01/0.01/0.9, dsn=2.6.0, status=sent (250 2.6.0 <[email protected]> [InternalId=6452520] Queued mail for delivery)
May 11 04:51:44 ServerOne postfix/qmgr[6134]: 8093C29EBD5: removed

记下收件人地址[电子邮件保护]。现在,这是来自 ServerTwo 的邮件日志:

May 10 03:55:13 ServerTwo postfix/pickup[27828]: 0A93C29F4AA: uid=0 from=<root>
May 10 03:55:13 ServerTwo postfix/cleanup[36376]: 0A93C29F4AA: message-id=<[email protected]>
May 10 03:55:13 ServerTwo postfix/qmgr[5934]: 0A93C29F4AA: from=<[email protected]>, size=15519, nrcpt=1 (queue active)
May 10 03:55:13 ServerTwo postfix/cleanup[36376]: 2EBA629F07B: message-id=<[email protected]>
May 10 03:55:13 ServerTwo postfix/qmgr[5934]: 2EBA629F07B: from=<[email protected]>, size=15685, nrcpt=1 (queue active)
May 10 03:55:13 ServerTwo postfix/local[36378]: 0A93C29F4AA: to=<[email protected]>, orig_to=<root>, relay=local, delay=0.27, delays=0.19/0.06/0/0.02, dsn=2.0.0, status=sent (forwarded as 2EBA629F07B)
May 10 03:55:13 ServerTwo postfix/qmgr[5934]: 0A93C29F4AA: removed
May 10 03:55:13 ServerTwo postfix/smtp[36379]: 2EBA629F07B: to=<[email protected]>, orig_to=<root>, relay=10.1.0.7[10.1.0.7]:25, delay=0.27, delays=0.02/0.06/0.01/0.18, dsn=2.6.0, status=sent (250 2.6.0 <[email protected]> [InternalId=6432387] Queued mail for delivery)

并记下收件人地址[电子邮件保护]

以下是我为 ServerOne 准备的 yum-cron 文件:

YUM_PARAMETER="--security"
CHECK_ONLY=no
CHECK_FIRST=no
DOWNLOAD_ONLY=no
ERROR_LEVEL=1
DEBUG_LEVEL=1
RANDOMWAIT="1"
MAILTO="[email protected]" 
SYSTEMNAME="Server One" 
CLEANDAY="0"
SERVICE_WAITS=yes
SERVICE_WAIT_TIME=300

以下是 ServerTwo 的 yum-cron:

YUM_PARAMETER="--security"
CHECK_ONLY=no
CHECK_FIRST=no
DOWNLOAD_ONLY=no
ERROR_LEVEL=1
DEBUG_LEVEL=1
RANDOMWAIT="1"
MAILTO="[email protected]"
SYSTEMNAME="Server Two"
CLEANDAY="0"
SERVICE_WAITS=yes
SERVICE_WAIT_TIME=300

以下是 ServerOne 的 postfix main.cf 文件:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = serverone.something.com
mydomain = something.com
inet_interfaces = localhost
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
relayhost = 10.1.0.7
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sender_canonical_maps = hash:/etc/postfix/canonical

以下是 ServerTwo 的 main.cf:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = servertwo.something.com
mydomain = something.com
inet_interfaces = localhost
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
relayhost = 10.1.0.7
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sender_canonical_maps = hash:/etc/postfix/canonical
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES

最后,来自 ServerOne 的 Postfix 规范文件:

[email protected]       [email protected]
@something.com           [email protected]
[email protected]    [email protected]

以及来自 ServerTwo 的 postfix/canonical:

[email protected]       [email protected]
@something.com           [email protected]
[email protected]    [email protected]

答案1

找到问题了。从 yum-cron 文件中:

如果设置了 MAILTO并且邮件命令可用,mail 命令用于传递 yum 输出

在这种情况下,我必须安装 mailx yum 包。

相关内容