Topic: Alias not working - Postfix sends alias to dovecot for quota query
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.0-beta2
- Deployed with iRedMail Easy or the downloadable installer?: downloadable installer
- Linux/BSD distribution name and version: Debian 10
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hi
I am setting up a mailserver, which works fine for mailboxes itselves (sending and receiving). If I receive an email for an alias (per-user alias or domain alias), things go wrong. The sender gets a "User unknown" error.
I tried to debug and have already found out that:
- problem isn't in Postfix sql query lookups
- Postfix is performing some policy queries, and one of them is getting back "REJECT Unknown user"
- I think this query is the quota query to Dovecot service
- Postfix sends the alias-address to Dovecot and not the mailbox-address
- Just before Postfix does this query, it checked the mailbox-address, so Postfix is aware of mailbox-address
tail -f /var/log/maillog
postfix/smtpd[23176]: >>> START Recipient address RESTRICTIONS <<<
postfix/smtpd[23176]: generic_checks: name=reject_non_fqdn_recipient
postfix/smtpd[23176]: reject_non_fqdn_address: alias@domain.com
postfix/smtpd[23176]: generic_checks: name=reject_non_fqdn_recipient status=0
postfix/smtpd[23176]: generic_checks: name=reject_unlisted_recipient
postfix/smtpd[23176]: >>> CHECKING Recipient address VALIDATION MAPS <<<
postfix/smtpd[23176]: ctable_locate: move existing entry key gmailaddress@gmail.com?alias@domain.com
postfix/smtpd[23176]: maps_find: recipient_canonical_maps: alias@domain.com: not found
postfix/smtpd[23176]: match_string: mydestination: domain.com ~? server.gmailaddress.be
postfix/smtpd[23176]: match_string: mydestination: domain.com ~? localhost
postfix/smtpd[23176]: match_string: mydestination: domain.com ~? localhost.localdomain
postfix/smtpd[23176]: match_list_match: domain.com: no match
postfix/smtpd[23176]: maps_find: recipient_canonical_maps: @domain.com: not found
postfix/smtpd[23176]: mail_addr_find: alias@domain.com -> (not found)
postfix/smtpd[23176]: maps_find: canonical_maps: alias@domain.com: not found
postfix/smtpd[23176]: match_string: mydestination: domain.com ~? server.gmailaddress.be
postfix/smtpd[23176]: match_string: mydestination: domain.com ~? localhost
postfix/smtpd[23176]: match_string: mydestination: domain.com ~? localhost.localdomain
postfix/smtpd[23176]: match_list_match: domain.com: no match
postfix/smtpd[23176]: maps_find: canonical_maps: @domain.com: not found
postfix/smtpd[23176]: mail_addr_find: alias@domain.com -> (not found)
postfix/smtpd[23176]: send attr request = lookup
postfix/smtpd[23176]: send attr table = mysql:/etc/postfix/mysql/virtual_alias_maps.cf
postfix/smtpd[23176]: send attr flags = 524352
postfix/smtpd[23176]: send attr key = alias@domain.com
postfix/proxymap[23167]: master_notify: status 0
postfix/proxymap[23167]: proxymap socket: wanted attribute: request
postfix/proxymap[23167]: input attribute name: request
postfix/proxymap[23167]: input attribute value: lookup
postfix/proxymap[23167]: proxymap socket: wanted attribute: table
postfix/proxymap[23167]: input attribute name: table
postfix/proxymap[23167]: input attribute value: mysql:/etc/postfix/mysql/virtual_alias_maps.cf
postfix/proxymap[23167]: proxymap socket: wanted attribute: flags
postfix/proxymap[23167]: input attribute name: flags
postfix/proxymap[23167]: input attribute value: 524352
postfix/proxymap[23167]: proxymap socket: wanted attribute: key
postfix/proxymap[23167]: input attribute name: key
postfix/proxymap[23167]: input attribute value: alias@domain.com
postfix/proxymap[23167]: proxymap socket: wanted attribute: (list terminator)
postfix/proxymap[23167]: input attribute name: (end)
postfix/proxymap[23167]: proxy_map_find: mysql:/etc/postfix/mysql/virtual_alias_maps.cf:
postfix/proxymap[23167]: dict_mysql_get_active: found active connection to host 127.0.0.1:3306
postfix/proxymap[23167]: mysql:/etc/postfix/mysql/virtual_alias_maps.cf: successful query result from host 127.0.0.1:3306
postfix/proxymap[23167]: dict_mysql_lookup: retrieved 1 rows
postfix/proxymap[23167]: send attr status = 0
postfix/proxymap[23167]: send attr value = mailbox@domain.com
postfix/proxymap[23167]: master_notify: status 1
postfix/smtpd[23176]: private/proxymap socket: wanted attribute: status
postfix/smtpd[23176]: input attribute name: status
postfix/smtpd[23176]: input attribute value: 0
postfix/smtpd[23176]: private/proxymap socket: wanted attribute: value
postfix/smtpd[23176]: input attribute name: value
postfix/smtpd[23176]: input attribute value: mailbox@domain.com
postfix/smtpd[23176]: private/proxymap socket: wanted attribute: (list terminator)
postfix/smtpd[23176]: input attribute name: (end)
postfix/smtpd[23176]: dict_proxy_lookup: table=mysql:/etc/postfix/mysql/virtual_alias_maps.cf flags=lock|utf8_request key=alias@domain.com -> status=0 result=mailbox@domain.com
postfix/smtpd[23176]: maps_find: virtual_alias_maps: proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf(0,lock|fold_fix|utf8_request): alias@domain.com = mailbox@domain.com
postfix/smtpd[23176]: mail_addr_find: alias@domain.com -> mailbox@domain.com
postfix/smtpd[23176]: generic_checks: name=reject_unlisted_recipient status=0
postfix/smtpd[23176]: generic_checks: name=check_policy_service
postfix/smtpd[23176]: trying... [127.0.0.1]
postfix/smtpd[23176]: auto_clnt_open: connected to 127.0.0.1:7777
postfix/smtpd[23176]: send attr request = smtpd_access_policy
postfix/smtpd[23176]: send attr protocol_state = RCPT
postfix/smtpd[23176]: send attr protocol_name = ESMTP
postfix/smtpd[23176]: send attr client_address = 209.85.160.171
postfix/smtpd[23176]: send attr client_name = mail-qt1-f171.google.com
postfix/smtpd[23176]: send attr client_port = 43317
postfix/smtpd[23176]: send attr reverse_client_name = mail-qt1-f171.google.com
postfix/smtpd[23176]: send attr server_address = IP.IP.IP.IP
postfix/smtpd[23176]: send attr server_port = 25
postfix/smtpd[23176]: send attr helo_name = mail-qt1-f171.google.com
postfix/smtpd[23176]: send attr sender = gmailaddress@gmail.com
postfix/smtpd[23176]: send attr recipient = alias@domain.com
postfix/smtpd[23176]: send attr recipient_count = 0
postfix/smtpd[23176]: send attr queue_id =
postfix/smtpd[23176]: send attr instance = 5a88.5db4b6a8.dce0e.0
postfix/smtpd[23176]: send attr size = 2262
postfix/smtpd[23176]: send attr etrn_domain =
postfix/smtpd[23176]: send attr stress =
postfix/smtpd[23176]: send attr sasl_method =
postfix/smtpd[23176]: send attr sasl_username =
postfix/smtpd[23176]: send attr sasl_sender =
postfix/smtpd[23176]: send attr ccert_subject =
postfix/smtpd[23176]: send attr ccert_issuer =
postfix/smtpd[23176]: send attr ccert_fingerprint =
postfix/smtpd[23176]: send attr ccert_pubkey_fingerprint =
postfix/smtpd[23176]: send attr encryption_protocol = TLSv1.3
postfix/smtpd[23176]: send attr encryption_cipher = TLS_AES_128_GCM_SHA256
postfix/smtpd[23176]: send attr encryption_keysize = 128
postfix/smtpd[23176]: send attr policy_context =
postfix/smtpd[23176]: 127.0.0.1:7777: wanted attribute: action
postfix/smtpd[23176]: input attribute name: action
postfix/smtpd[23176]: input attribute value: DUNNO
postfix/smtpd[23176]: 127.0.0.1:7777: wanted attribute: (list terminator)
postfix/smtpd[23176]: input attribute name: (end)
postfix/smtpd[23176]: check_table_result: inet:127.0.0.1:7777 DUNNO policy query
postfix/smtpd[23176]: generic_checks: name=check_policy_service status=0
postfix/smtpd[23176]: generic_checks: name=permit_mynetworks
postfix/smtpd[23176]: permit_mynetworks: mail-qt1-f171.google.com 209.85.160.171
postfix/smtpd[23176]: match_hostname: mynetworks: mail-qt1-f171.google.com ~? 127.0.0.1
postfix/smtpd[23176]: match_hostaddr: mynetworks: 209.85.160.171 ~? 127.0.0.1
postfix/smtpd[23176]: match_list_match: mail-qt1-f171.google.com: no match
postfix/smtpd[23176]: match_list_match: 209.85.160.171: no match
postfix/smtpd[23176]: generic_checks: name=permit_mynetworks status=0
postfix/smtpd[23176]: generic_checks: name=permit_sasl_authenticated
postfix/smtpd[23176]: generic_checks: name=permit_sasl_authenticated status=0
postfix/smtpd[23176]: generic_checks: name=reject_unauth_destination
postfix/smtpd[23176]: reject_unauth_destination: alias@domain.com
postfix/smtpd[23176]: permit_auth_destination: alias@domain.com
postfix/smtpd[23176]: ctable_locate: leave existing entry key gmailaddress@gmail.com?alias@domain.com
postfix/smtpd[23176]: generic_checks: name=reject_unauth_destination status=0
postfix/smtpd[23176]: generic_checks: name=check_policy_service
postfix/smtpd[23176]: trying... [127.0.0.1]
postfix/smtpd[23176]: auto_clnt_open: connected to 127.0.0.1:12340
postfix/smtpd[23176]: send attr request = smtpd_access_policy
postfix/smtpd[23176]: send attr protocol_state = RCPT
postfix/smtpd[23176]: send attr protocol_name = ESMTP
postfix/smtpd[23176]: send attr client_address = 209.85.160.171
postfix/smtpd[23176]: send attr client_name = mail-qt1-f171.google.com
postfix/smtpd[23176]: send attr client_port = 43317
postfix/smtpd[23176]: send attr reverse_client_name = mail-qt1-f171.google.com
postfix/smtpd[23176]: send attr server_address = IP.IP.IP.IP
postfix/smtpd[23176]: send attr server_port = 25
postfix/smtpd[23176]: send attr helo_name = mail-qt1-f171.google.com
postfix/smtpd[23176]: send attr sender = gmailaddress@gmail.com
postfix/smtpd[23176]: send attr recipient = alias@domain.com
postfix/smtpd[23176]: send attr recipient_count = 0
postfix/smtpd[23176]: send attr queue_id =
postfix/smtpd[23176]: send attr instance = 5a88.5db4b6a8.dce0e.0
postfix/smtpd[23176]: send attr size = 2262
postfix/smtpd[23176]: send attr etrn_domain =
postfix/smtpd[23176]: send attr stress =
postfix/smtpd[23176]: send attr sasl_method =
postfix/smtpd[23176]: send attr sasl_username =
postfix/smtpd[23176]: send attr sasl_sender =
postfix/smtpd[23176]: send attr ccert_subject =
postfix/smtpd[23176]: send attr ccert_issuer =
postfix/smtpd[23176]: send attr ccert_fingerprint =
postfix/smtpd[23176]: send attr ccert_pubkey_fingerprint =
postfix/smtpd[23176]: send attr encryption_protocol = TLSv1.3
postfix/smtpd[23176]: send attr encryption_cipher = TLS_AES_128_GCM_SHA256
postfix/smtpd[23176]: send attr encryption_keysize = 128
postfix/smtpd[23176]: send attr policy_context =
postfix/smtpd[23176]: 127.0.0.1:12340: wanted attribute: action
postfix/smtpd[23176]: input attribute name: action
postfix/smtpd[23176]: input attribute value: REJECT Unknown user
postfix/smtpd[23176]: 127.0.0.1:12340: wanted attribute: (list terminator)
postfix/smtpd[23176]: input attribute name: (end)
postfix/smtpd[23176]: check_table_result: inet:127.0.0.1:12340 REJECT Unknown user policy query
postfix/smtpd[23176]: NOQUEUE: reject: RCPT from mail-qt1-f171.google.com[209.85.160.171]: 554 5.7.1 <alias@domain.com>: Recipient address rejected: Unknown user; from=<gmailaddress@gmail.com> to=<alias@domain.com> proto=ESMTP helo=<mail-qt1-f171.google.com>
postfix/smtpd[23176]: generic_checks: name=check_policy_service status=2
postfix/smtpd[23176]: >>> END Recipient address RESTRICTIONS <<<
tail -f /var/log/dovecot/dovecot.log
dovecot: quota-status(alias@domain.com)<23180><>: Debug: Loading modules from directory: /usr/lib/dovecot/modules
dovecot: quota-status(alias@domain.com)<23180><>: Debug: Module loaded: /usr/lib/dovecot/modules/lib01_acl_plugin.so
dovecot: quota-status(alias@domain.com)<23180><>: Debug: Module loaded: /usr/lib/dovecot/modules/lib10_quota_plugin.so
dovecot: quota-status(alias@domain.com)<23180><>: Debug: Module loaded: /usr/lib/dovecot/modules/lib15_notify_plugin.so
dovecot: quota-status(alias@domain.com)<23180><>: Debug: Module loaded: /usr/lib/dovecot/modules/lib20_mail_log_plugin.so
dovecot: quota-status(alias@domain.com)<23180><>: Debug: Module loaded: /usr/lib/dovecot/modules/lib20_mailbox_alias_plugin.so
dovecot: auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
dovecot: auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/lib20_auth_var_expand_crypt.so
dovecot: auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
dovecot: auth: Debug: Read auth token secret from /var/run/dovecot/auth-token-secret.dat
dovecot: auth: Debug: passwd-file /etc/dovecot/dovecot-master-users: Read 1 users in 0 secs
dovecot: auth: Debug: master in: USER#0111#011alias@domain.com#011service=quota-status
dovecot: auth-worker(23182): Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
dovecot: auth-worker(23182): Debug: Module loaded: /usr/lib/dovecot/modules/auth/lib20_auth_var_expand_crypt.so
dovecot: auth-worker(23182): Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
dovecot: auth-worker(23182): Debug: passwd-file /etc/dovecot/dovecot-master-users: Read 1 users in 0 secs
dovecot: auth-worker(23182): Debug: sql(alias@domain.com): SELECT LOWER('alias@domain.com') AS master_user, LOWER(CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir)) AS home, CONCAT(mailbox.mailboxformat, ':~/', mailbox.mailboxfolder, '/') AS mail, CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule FROM mailbox,domain WHERE mailbox.username='alias@domain.com' AND mailbox.`enablequota-status`=1 AND mailbox.active=1 AND mailbox.domain=domain.domain AND domain.backupmx=0 AND domain.active=1
dovecot: auth-worker(23182): sql(alias@domain.com): unknown user
dovecot: auth: Debug: userdb out: NOTFOUND#0111
dovecot: quota-status(alias@domain.com)<23180><>: Debug: auth USER input:
I have tried multiple things, and read multiple topics. I thought it could be this problem (no_address_mappings parameter), but I tried the solution without solving the problem.
PS: i have changed code blocks to quote blocks so I can highlight the interesting parts
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.