Hello,
I have the problem with aliases. The emails did not delivery to correct email. I send email to email: to_alias@domain.com that is valid alias and email should be sent to real email folder: to@domain.com. Dovecot creating to_alias folder and deliver the emails there. Here is the email log: / did not see to@domain.com below /
Apr 5 18:54:40 www postfix/smtpd[30547]: connect from mail-40137.protonmail.ch[185.70.40.137] Apr 5 18:54:40 www postfix/smtpd[30547]: Anonymous TLS connection established from mail-40137.protonmail.ch[185.70.40.137]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 Apr 5 18:54:52 www postfix/smtpd[30547]: 85A412E19B6: client= mail-40137.protonmail.ch[185.70.40.137] Apr 5 18:54:52 www postfix/cleanup[30556]: 85A412E19B6: message-id=<M07eijxF0PArGZ92wKYpeCndUNv5g3kSEgYljlhYwOVPxIor3AmNRxrPyNK9T8GcncG1dmxS6Lv35IfR5ompsUPEGPucNn9SjxkMxAgHzhI=@ protonmail.com> Apr 5 18:54:53 www dccifd[1856]: stat(log directory "log"): No such file or directory Apr 5 18:54:57 www postfix/qmgr[1398]: 85A412E19B6: from=< from@protonmail.com>, size=2767, nrcpt=1 (queue active) Apr 5 18:54:57 www postfix/smtpd[30547]: disconnect from mail-40137.protonmail.ch[185.70.40.137] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7 Apr 5 18:54:57 www dovecot: lmtp(30559): Connect from local Apr 5 18:54:57 www dovecot: lmtp(compiz@domain.com)<30559><U8KALFFmTGJfdwAA8oMCvw>: sieve: msgid=<M07eijxF0PArGZ92wKYpeCndUNv5g3kSEgYljlhYwOVPxIor3AmNRxrPyNK9T8GcncG1dmxS6Lv35IfR5ompsUPEGPucNn9SjxkMxAgHzhI=@ protonmail.com>: stored mail into mailbox 'INBOX' Apr 5 18:54:57 www postfix/lmtp[30558]: 85A412E19B6: to=< to_alias@domain.com>, relay=mail.domain.com[private/dovecot-lmtp], delay=17, delays=17/0.01/0.01/0.01, dsn=2.0.0, status=sent (250 2.0.0 < to_alias@domain.com> U8KALFFmTGJfdwAA8oMCvw Saved) Apr 5 18:54:57 www dovecot: lmtp(30559): Disconnect from local: Logged out (state=READY) Apr 5 18:54:57 www postfix/qmgr[1398]: 85A412E19B6: removed
I was playing with password_query but not sure did I'm on right direction.
password_query =
SELECT username AS user, password,
'/var/spool/postmail/%d/%n' AS userdb_home, 1002 AS userdb_uid, 1001 AS
userdb_gid
FROM mailbox WHERE username = (SELECT goto FROM alias WHERE address =
'%u')
I'm using dovecot --version: 2.3.18 (9dd8408c18) and my configuration is:
# 2.3.18 (9dd8408c18): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.18 (0bc28b32) # OS: Linux 5.17.0 x86_64 Slackware 15.0+ ext4 # Hostname: www.ixip.net base_dir = /var/run/dovecot/ default_login_user = nobody dict { driver = sql quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext } disable_plaintext_auth = no lda_mailbox_autocreate = yes lda_mailbox_autosubscribe = yes mail_location = maildir:/var/spool/postmail/%d/%n/Maildir mail_privileged_group = vmail managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext namespace inbox { inbox = yes list = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = type = private } passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } plugin { sieve = /var/spool/postmail/%d/%n/.dovecot.sieve sieve_dir = /var/spool/postmail/%d/%n/sieve/ sieve_global_dir = /var/lib/dovecot/sieve sieve_global_path = /var/lib/dovecot/sieve/default.sieve } protocols = imap lmtp sieve sieve service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0666 user = postfix } } service imap-login { inet_listener imap { address = 127.0.0.1 port = 143 } inet_listener imaps { address = 127.0.0.1 port = 993 } } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0600 user = postfix } user = vmail } service managesieve-login { inet_listener sieve { address = 127.0.0.1 port = 4190 } service_count = 1 vsz_limit = 64 M } ssl_cert = </etc/postfix/ssl/mail.stzbg.com.crt ssl_dh = # hidden, use -P to show it ssl_key = # hidden, use -P to show it userdb { args = uid=1002 gid=1001 home=/var/spool/postmail/%d/%n allow_all_users=yes driver = static } protocol pop3 { pop3_uidl_format = %08Xu%08Xv } protocol lmtp { mail_plugins = " sieve" } protocol lda { mail_plugins = " sieve" } protocol sieve { managesieve_implementation_string = Dovecot Pigeonhole }
# grep -v '^ *\(#.*\)\?$' dovecot-sql.conf.ext driver = mysql connect = host=localhost dbname=postfix user=postfix password=password default_pass_scheme = CRYPT password_query = SELECT username AS user, password FROM mailbox WHERE username = '%u';
Kind Regards, Chris
On 2022-04-09 16:20, John Doe wrote:
I have the problem with aliases. The emails did not delivery to correct email. I send email to email: to_alias@domain.com that is valid alias and email should be sent to real email folder: to@domain.com. Dovecot creating to_alias folder and deliver the emails there. Here is the email log: / did not see to@domain.com below /
its not a dovecot problem, problem is solved in postfix to expand alias before sending to dovecot
postconf -nf for more help here or on postfix-maillist
#me2too aswell mis that dovecot could expand alias on its own, specially usefull for dovecot quotas
Hello,
here is postoconf -nf
alias_database = hash:/etc/postfix/aliases alias_maps = hash:/etc/postfix/aliases biff = no body_checks = regexp:/etc/postfix/body_checks broken_sasl_auth_clients = yes command_directory = /usr/sbin compatibility_level = 3.6 daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix disable_vrfy_command = yes dovecot_destination_recipient_limit = 1 enable_long_queue_ids = no html_directory = no inet_interfaces = all inet_protocols = ipv4 ipv6 mail_owner = postfix mailbox_size_limit = 0 mailq_path = /usr/bin/mailq manpage_directory = /usr/local/man message_size_limit = 51200000 meta_directory = /etc/postfix milter_default_action = accept milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen} milter_protocol = 6 myhostname = mail.domain.com mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 newaliases_path = /usr/bin/newaliases non_smtpd_milters = $smtpd_milters proxy_read_maps = $local_recipient_maps $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps transport_maps $mynetworks queue_directory = /var/spool/postfix readme_directory = no receive_override_options = no_address_mappings recipient_delimiter = + relay_recipient_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf sample_directory = /etc/postfix sendmail_path = /usr/sbin/sendmail setgid_group = postdrop shlib_directory = no smtp_enforce_tls = yes smtp_sasl_security_options = noanonymous smtp_tls_cert_file = /etc/dehydrated/certs/domain.com/fullchain.pem smtp_tls_key_file = /etc/dehydrated/certs/domain.com/privkey.pem smtp_tls_security_level = may smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtp_use_tls = yes smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) smtpd_client_restrictions = cidr:/etc/postfix/cidr_client_access, permit smtpd_delay_reject = yes smtpd_discard_ehlo_keyword_address_maps = cidr:/etc/postfix/esmtp_access smtpd_helo_required = yes smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, check_helo_access hash:/etc/postfix/helo_checks, permit smtpd_milters = unix:/var/run/rspamd/milter.sock smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_helo_access hash:/etc/postfix/helo_checks, check_sender_access hash:/etc/postfix/helo_checks, check_recipient_access pcre:/etc/postfix/recipient_checks.pcre, reject_invalid_hostname, reject_unverified_recipient, reject_unauth_pipelining, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unlisted_sender, reject_unauth_destination, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_rbl_client cbl.abuseat.org, reject_rbl_client dnsbl-1.uceprotect.net, reject_rbl_client bl.spamcop.net, reject_rbl_client iadb.isipp.com, reject_rbl_client dnsbl.sorbs.net, reject_rbl_client plus.bondedsender.org, permit smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination smtpd_sasl_auth_enable = yes smtpd_sasl_authenticated_header = yes smtpd_sasl_exceptions_networks = !127.0.0.0/8 ![::ffff:127.0.0.0]/104 ![::1]/128 smtpd_sasl_path = private/auth smtpd_sasl_security_options = noanonymous smtpd_sasl_tls_security_options = noanonymous smtpd_sasl_type = dovecot smtpd_tls_auth_only = yes smtpd_tls_cert_file = /etc/dehydrated/certs/domain.com/fullchain.pem smtpd_tls_dh1024_param_file = /etc/postfix/ssl/dhparams.pem smtpd_tls_key_file = /etc/dehydrated/certs/domain.com/privkey.pem smtpd_tls_loglevel = 1 smtpd_tls_mandatory_ciphers = medium smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 smtpd_tls_received_header = yes smtpd_tls_security_level = may smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = yes strict_rfc821_envelopes = yes tls_medium_cipherlist =
ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 tls_preempt_cipherlist = no virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf virtual_gid_maps = static:1001 virtual_mailbox_base = /var/spool/postmail virtual_mailbox_domains = proxy:mysql:/etc/postfix/ mysql_virtual_domains_maps.cf virtual_mailbox_maps = proxy:mysql:/etc/postfix/ mysql_virtual_mailbox_maps.cf virtual_transport = lmtp:unix:private/dovecot-lmtp virtual_uid_maps = static:1002
and aslo here alias conf mysql_virtual_alias_maps.cf : user = postfix password = postfix hosts = localhost dbname = postfix query = SELECT goto FROM alias WHERE address='%s' AND active = '1'
and here is the test: $ postmap -q to_alias@domain.com mysql:/etc/postfix/ mysql_virtual_alias_maps.cf to@domain.com
Have a great weekend, Chris
На сб, 9.04.2022 г. в 17:42 ч. Benny Pedersen <me@junc.eu> написа:
On 2022-04-09 16:20, John Doe wrote:
I have the problem with aliases. The emails did not delivery to correct email. I send email to email: to_alias@domain.com that is valid alias and email should be sent to real email folder: to@domain.com. Dovecot creating to_alias folder and deliver the emails there. Here is the email log: / did not see to@domain.com below /
its not a dovecot problem, problem is solved in postfix to expand alias before sending to dovecot
postconf -nf for more help here or on postfix-maillist
#me2too aswell mis that dovecot could expand alias on its own, specially usefull for dovecot quotas
participants (3)
-
Alexander Dalloz
-
Benny Pedersen
-
John Doe