Hi, I'm just changing over from after-queue content filter to before-queue and it mostly works. However messages sent from the server localhost using mailx (I assume that's sendmail) do not have addresses rewritten from virtual_alias_maps. I was wondering what the recommended way to fix this was.
I attach relevant bits of log file showing the sequence of events when sending a message: I assume with after-queue that because the message goes through smtp on the way back from content filter that the addresses get rewritten. I'm a bit puzzled because I thought cleanup did address rewriting. I'd appreciate some clues. Thanks Dick
// with before-queue filter Jan 18 09:29:36 hagrid postfix/pickup[28199]: 5C8E045F1B95: uid=0 from=<root> Jan 18 09:29:36 hagrid postfix/cleanup[28218]: 5C8E045F1B95: message-id=<20170118092936.5c8e045f1...@mail.mydom.net> Jan 18 09:29:36 hagrid postfix/qmgr[28198]: 5C8E045F1B95: from=<root@hagrid.mylocal>, size=442, nrcpt=1 (queue active) Jan 18 09:29:36 hagrid postfix/lmtp[28220]: 5C8E045F1B95: to=<ad...@mydom.net>, relay=mail.mydom.net[private/dovecot-lmtp], delay=0.25, delays=0.1/0.01/0.01/0.12, dsn=5.1.1, status=bounced (host mail.mydom.net[private/dovecot-lmtp] said: 550 5.1.1 <ad...@mydom.net> User doesn't exist: ad...@mydom.net (in reply to RCPT TO command)) // ad...@mydom.net is an alias so it's not found // Whereas for the after-filter configuration: Jan 18 09:29:59 hagrid postfix/pickup[28253]: 579DE45F1B95: uid=0 from=<root> Jan 18 09:29:59 hagrid postfix/cleanup[28261]: 579DE45F1B95: message-id=<20170118092959.579de45f1...@mail.mydom.net> Jan 18 09:29:59 hagrid postfix/qmgr[28252]: 579DE45F1B95: from=<root@hagrid.mylocal>, size=442, nrcpt=1 (queue active) // This is where it goes to content filter (spampd) Jan 18 09:29:59 hagrid postfix/smtpd[28264]: connect from localhost[127.0.0.1] Jan 18 09:29:59 hagrid postfix/smtpd[28264]: 6CC8945F1B64: client=localhost[127.0.0.1] Jan 18 09:29:59 hagrid spampd[621]: processing message <20170118092959.579de45f1...@mail.mydom.net> for <ad...@mydom.net> ORCPT=rfc822;ad...@mydom.net Jan 18 09:29:59 hagrid spampd[621]: clean message <20170118092959.579de45f1...@mail.mydom.net> (-0.00/4.50) from <root@hagrid.mylocal> for <ad...@mydom.net> ORCPT=rfc822;ad...@mydom.net in 0.35s, 442 bytes. // Here message comes back from content filter Jan 18 09:29:59 hagrid postfix/cleanup[28261]: 6CC8945F1B64: message-id=<20170118092959.579de45f1...@mail.mydom.net> Jan 18 09:29:59 hagrid postfix/qmgr[28252]: 6CC8945F1B64: from=<ad...@mylocal.com>, size=869, nrcpt=1 (queue active) Jan 18 09:29:59 hagrid postfix/smtp[28263]: 579DE45F1B95: to=<ad...@mydom.net>, relay=127.0.0.1[127.0.0.1]:10125, delay=0.66, delays=0.12/0.01/0.02/0.5, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 6CC8945F1B64) Jan 18 09:29:59 hagrid postfix/smtpd[28264]: disconnect from localhost[127.0.0.1] Jan 18 09:29:59 hagrid postfix/qmgr[28252]: 579DE45F1B95: removed Jan 18 09:30:00 hagrid postfix/lmtp[28265]: 6CC8945F1B64: to=<b...@mydom.net>, orig_to=<ad...@mydom.net>, relay=mail.mydom.net[private/dovecot-lmtp], delay=0.6, delays=0.5/0.01/0/0.09, dsn=2.0.0, status=sent (250 2.0.0 <b...@mydom.net> vUOmGoA1f1g9bgAA2TmNZA Saved) Jan 18 09:30:00 hagrid postfix/qmgr[28252]: 6CC8945F1B64: removed // here ad...@mydom.net is rewritten b...@mydom.net which is real so it works.
address_verify_map = btree:${data_directory}/verify address_verify_sender = postmas...@mydom.net alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases anvil_status_update_time = 1800 body_checks = pcre:/etc/postfix/local.d/body_checks.pcre bounce_notice_recipient = postmas...@mydom.net bounce_template_file = /etc/postfix/bounce.cf canonical_maps = pcre:/etc/postfix/local.d/canonical.pcre command_directory = /usr/sbin config_directory = /etc/postfix data_directory = /var/lib/postfix debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xxgdb $daemon_directory/$process_name $process_id & sleep 5 delay_notice_recipient = postmas...@mydom.net delay_warning_time = 4h disable_vrfy_command = yes error_notice_recipient = postmas...@mydom.net ext_generic_maps = pcre:/etc/postfix/local.d/generic.pcre greylist = check_policy_service unix:private/tumgreyspf header_checks = pcre:/etc/postfix/local.d/header_checks.pcre html_directory = no inet_interfaces = 91.135.5.234, 192.168.46.7, localhost local_recipient_maps = local_transport = error: local mail delivery disabled mail_name = Postfix at MydomNet mail_owner = postfix mail_spool_directory = /var/mail mailq_path = /usr/bin/mailq manpage_directory = /usr/local/man masquerade_exceptions = root mydestination = mydomain = mylocal myhostname = mail.mydom.net mynetworks = cidr:/etc/postfix/local.d/mynetworks.cidr myorigin = hagrid.mylocal newaliases_path = /usr/bin/newaliases queue_directory = /var/spool/postfix ratecheck = check_policy_service inet:127.0.0.1:10040 readme_directory = no receive_override_options = no_address_mappings remote_header_rewrite_domain = domain.invalid sample_directory = /etc/postfix sendmail_path = /usr/sbin/sendmail setgid_group = postdrop smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_data_restrictions = reject_unauth_pipelining, permit smtpd_helo_required = yes smtpd_recipient_restrictions = reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_recipient_domain, ratecheck, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_recipient_access pcre:/etc/postfix/local.d/recipient_checks.pcre, check_helo_access hash:/etc/postfix/local.d/helo_checks, check_client_access cidr:/etc/postfix/local.d/internal_networks.cidr, check_sender_access mysql:/etc/postfix/local.d/sender_checks.mysql, check_sender_access pcre:/etc/postfix/local.d/persistent-senders.pcre, reject_unlisted_recipient, reject_unverified_recipient, permit_dnswl_client list.dnswl.org, check_policy_service inet:127.0.0.1:12525, permit smtpd_reject_unlisted_sender = yes smtpd_restriction_classes = using_my_domain, using_my_master, greylist, ratecheck smtpd_sasl_auth_enable = yes smtpd_sasl_path = private/auth smtpd_sasl_type = dovecot smtpd_timeout = 900s smtpd_tls_CApath = /etc/ssl/cacerts smtpd_tls_cert_file = /etc/ssl/server/mail.mydom.net_bundle.crt smtpd_tls_key_file = /etc/ssl/private/mail.mydom.net.key smtpd_tls_loglevel = 1 smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache transport_maps = hash:/etc/postfix/local.d/transport unknown_address_reject_code = 550 unknown_client_reject_code = 504 unknown_local_recipient_reject_code = 550 unverified_sender_reject_code = 550 using_my_domain = check_sender_access hash:/etc/postfix/local.d/domain_as_sender, reject using_my_master = check_sender_access hash:/etc/postfix/local.d/not_master_as_sender, reject_unverified_sender, permit virtual_alias_maps = hash:/etc/postfix/local.d/valiases virtual_gid_maps = static:5000 virtual_mailbox_base = /home/vmail virtual_mailbox_domains = hash:/etc/postfix/local.d/vdomains virtual_mailbox_limit = 102400000 virtual_mailbox_maps = mysql:/etc/postfix/local.d/vusers.mysql virtual_transport = lmtp:unix:private/dovecot-lmtp virtual_uid_maps = mysql:/etc/postfix/local.d/vguid.mysql