[CentOS] Cron sending to root after changing MAILTO

Wed Jul 19 23:30:31 UTC 2017
Alexander Dalloz <ad+lists at uni-x.org>

Am 20.07.2017 um 00:36 schrieb Chad Cordero:
> Ah.  Here you go.

It would be nice if you would avoid TOFU posting (top-posting and full 
quoting).

> # grep A5077100E776C /var/log/maillog
> 
> Jul 19 13:15:55 mailcampaign1 postfix/pickup[19675]: A5077100E776C: uid=0 from=<root>
> 
> Jul 19 13:15:55 mailcampaign1 postfix/cleanup[19797]: A5077100E776C: warning: header Subject: Cron <root at mailcampaign1> run-parts /etc/cron.hourly from local; from=<root at csusb.edu>
> 
> Jul 19 13:15:55 mailcampaign1 postfix/cleanup[19797]: A5077100E776C: message-id=<20170719201555.A5077100E776C at mailcampaign1.csusb.edu>
> 
> Jul 19 13:15:55 mailcampaign1 opendkim[2298]: A5077100E776C: DKIM-Signature field added (s=mc2-2013, d=csusb.edu)
> 
> Jul 19 13:15:55 mailcampaign1 postfix/qmgr[2388]: A5077100E776C: from=<root at csusb.edu>, size=813, nrcpt=1 (queue active)
> 
> Jul 19 13:15:56 mailcampaign1 postfix/smtp[19802]: A5077100E776C: to=<root at csusb.edu>, orig_to=<root>, relay=csusb-edu.mail.protection.outlook.com[207.46.163.106]:25, delay=896, delays=895/0.01/0.24/0.83, dsn=2.6.0, status=sent (250 2.6.0 <20170719201555.A5077100E776C at mailcampaign1.csusb.edu> [InternalId=67289252629319, Hostname=CY1PR08MB1829.namprd08.prod.outlook.com] 10710 bytes in 0.203, 51.463 KB/sec Queued mail for delivery)

That's the part to analyze.

The message took 895 seconds before entering the queue manager. So the 
mail must have been submitted via sendmail by cron quite some time 
before being picked up and processed for delivery.

The only explanation I actually have is that the cron message got 
created before you have finished your Postfix setup and Postfix was 
stopped, while $myhostname and/or system's hostname had been csusb.edu.

Now your alias definition should catch. And make sure for your MAILTO 
crontab definition to act to restart the crond.service.

> Jul 19 13:15:56 mailcampaign1 postfix/qmgr[2388]: A5077100E776C: removed
> 
> # postconf -n
> 
> alias_database = hash:/etc/aliases
> 
> alias_maps = hash:/etc/aliases
> 
> always_add_missing_headers = yes
> 
> bounce_queue_lifetime = 8h
> 
> bounce_template_file = /etc/postfix/bounce.cf
> 
> broken_sasl_auth_clients = yes
> 
> command_directory = /usr/sbin
> 
> config_directory = /etc/postfix
> 
> daemon_directory = /usr/libexec/postfix
> 
> data_directory = /var/lib/postfix
> 
> 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
> 
> default_destination_concurrency_limit = 2
> 
> default_destination_rate_delay = 1s
> 
> default_process_limit = 1000
> 
> delay_warning_time = 5m
> 
> header_checks = regexp:/etc/postfix/header_checks
> 
> home_mailbox = Maildir/
> 
> html_directory = no
> 
> inet_interfaces = all
> 
> inet_protocols = ipv4
> 
> internal_destination_concurrency_limit = 20
> 
> internal_destination_rate_delay = 0
> 
> internal_destination_recipient_limit = 50
> 
> mail_owner = postfix
> 
> mailq_path = /usr/bin/mailq.postfix
> 
> manpage_directory = /usr/share/man
> 
> maximal_backoff_time = 4h
> 
> maximal_queue_lifetime = 2d
> 
> message_size_limit = 25600000
> 
> milter_default_action = accept
> 
> milter_protocol = 2
> 
> mydestination = $myhostname, localhost.$mydomain, localhost
> 
> mydomain = csusb.edu
> 
> myhostname = mailcampaign1.csusb.edu
> 
> mynetworks = 139.182.0.0/16, 198.188.128.0/22, 10.120.76.0/24, 127.0.0.0/8
> 
> myorigin = $mydomain
> 
> newaliases_path = /usr/bin/newaliases.postfix
> 
> non_smtpd_milters = $smtpd_milters
> 
> polite_destination_concurrency_limit = 10
> 
> polite_destination_rate_delay = 0
> 
> polite_destination_recipient_limit = 5
> 
> postscreen_upstream_proxy_protocol = haproxy
> 
> queue_directory = /var/spool/postfix
> 
> readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
> 
> relay_domains =
> 
> sample_directory = /usr/share/doc/postfix-2.10.1/samples
> 
> sendmail_path = /usr/sbin/sendmail.postfix
> 
> setgid_group = postdrop
> 
> smtp_connect_timeout = 10s
> 
> smtp_helo_timeout = 50
> 
> smtp_mx_address_limit = 5
> 
> smtpd_client_connection_count_limit = 100
> 
> smtpd_milters = inet:127.0.0.1:8891
> 
> smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
> 
> smtpd_sasl_auth_enable = yes
> 
> smtpd_sasl_authenticated_header = no
> 
> smtpd_sasl_local_domain =
> 
> smtpd_sasl_security_options = noanonymous
> 
> smtpd_sasl_type = cyrus
> 
> smtpd_timeout = 10s
> 
> smtpd_tls_CAfile = /etc/pki/tls/certs/mailcampaign_csusb_edu_interm.cer
> 
> smtpd_tls_cert_file = /etc/pki/tls/certs/mailcampaign_csusb_edu_cert.cer
> 
> smtpd_tls_key_file = /etc/pki/tls/private/mailcampaign_csusb_edu.key
> 
> smtpd_tls_loglevel = 0
> 
> smtpd_tls_received_header = yes
> 
> smtpd_tls_security_level = may
> 
> smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
> 
> smtpd_tls_session_cache_timeout = 10800s
> 
> smtpd_use_tls = yes
> 
> transport_maps = hash:/etc/postfix/transport
> 
> turtle_destination_concurrency_limit = 1
> 
> turtle_destination_rate_delay = 3s
> 
> turtle_destination_recipient_limit = 2
> 
> unknown_local_recipient_reject_code = 550
> 
>   
> 
>   
> 
> 
> ---
> Chad Cordero
> Information Technology Consultant
> 
> Enterprise & Cloud Services
> 
> Information Technology Services
> 
> California State University, San Bernardino
> 5500 University Pkwy
> San Bernardino, CA 92407-2393
> Main Line: 909/537-7677
> 
> Direct Line: 909/537-7281
> 
> Fax: 909/537-7141
> 
> http://support.csusb.edu/