I want to create a postmaster alias for a virtual domain (example.ua), mail for a non-existent virtual user postmaster@example.ua came to the box of an existing virtual user user@example.ua

Some lines from postconf

 alias_maps = hash:/etc/aliases compatibility_level = 2 local_recipient_maps = $alias_maps mydestination = localhost.$mydomain, localhost mydomain = $myhostname relay_domains = $mydestination, hash:/etc/postfix/relay setgid_group = maildrop smtpd_helo_required = yes smtpd_helo_restrictions = permit_sasl_authenticated, reject_unknown_hostname smtpd_recipient_restrictions = permit_sasl_authenticated, reject_unauth_destination, reject_unknown_client, reject_invalid_hostname, reject_non_fqdn_hostname, reject_unknown_hostname, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unverified_recipient smtpd_relay_restrictions = permit_sasl_authenticated, reject_unauth_destination, reject_unknown_client, reject_invalid_hostname, reject_non_fqdn_hostname, reject_unknown_hostname, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unverified_recipient smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_path = private/auth smtpd_sasl_type = dovecot smtpd_sender_restrictions = permit_sasl_authenticated, reject_unauth_destination, reject_unknown_client, reject_invalid_hostname, reject_non_fqdn_hostname, reject_unknown_hostname, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unverified_recipient strict_rfc821_envelopes = yes virtual_alias_domains = $myhostname virtual_alias_maps = hash:/etc/postfix/virtual virtual_gid_maps = static:303 virtual_mailbox_base = /srv/vmail virtual_mailbox_domains = $myhostname, subdom.$myhostname virtual_mailbox_lock = fcntl virtual_minimum_uid = 303 virtual_transport = lmtp:unix:private/dovecot-lmtp virtual_uid_maps = static:303 

/ etc / postfix / virtual

 postmaster@example.ua user@example.ua 

sudo postmap / etc / postfix / virtual

But when sending mail to postmaster@example.ua postfix rejects it with the message that such user does not exist.

 NOQUEUE: reject: RCPT from forward7m.cmail.yandex.net[5.255.216.200]: 450 4.1.1 <postmaster@example.ua>: Recipient address rejected: unverified address: host example.ua[private/dovecot-lmtp] said: 550 5.1.1 <postmaster@example.ua> User doesn't exist: postmaster@example.ua (in reply to RCPT TO command); from=<user@yandex.ua> to=<postmaster@example.ua> proto=ESMTP helo=<forward7m.cmail.yandex.net> 

Can I do without creating a user and a box in /etc/dovecot/users ?

  • 2
    probably, you need to specify the type: postmap hash:/etc/postfix/virtual instead of postmap /etc/postfix/virtual (the type can not be specified explicitly only if it matches the default_database_type ). // and then with the same postmap check: postfix.org/VIRTUAL_README.html#local_vs_database - aleksandr barakin
  • Thank. :-) Maybe it was even the case. virtual_alias_domains = $ myhostname removed smtpd_sender_restrictions = changed / etc / postfix / virtual abuse@example.ua user@example.ua postmaster@example.ua user@example.ua postmap hash: / etc / postfix / virtual And now everything gets great, even with smtpd_reject_unlisted_sender = yes options smtpd_reject_unlisted_recipient = yes and reject_unverified_sender abuse@subdom.example.ua user@example.ua postmaster@subdom.example.ua user@example.ua - Ilya Indigo

1 answer 1

Some postconf -n options in which the empty option is virtual_alias__domains which should be, in most cases empty if we don’t want to specifically create a domain in which there will be only virtual aliases. And if we just want to add an alias for domains in which we already have virtual users, we need to specify them only in virtual_mailbox_domains , and they should not be repeated in mydestination and virtual_alias_domains .

 compatibility_level = 2 stress = yes biff = no disable_vrfy_command = yes strict_rfc821_envelopes = yes smtputf8_autodetect_classes = bounce myhostname = example.ua mydomain = $myhostname mydestination = localhost.$mydomain, localhost inet_interfaces = all inet_protocols = ipv4 smtpd_recipient_restrictions = permit_inet_interfaces, permit_sasl_authenticated, reject_unauth_destination, 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, reject_unknown_helo_hostname, reject_unknown_client_hostname, reject_rbl_client zen.spamhaus.org smtpd_relay_restrictions = permit_inet_interfaces, permit_sasl_authenticated, reject_unauth_destination smtpd_data_restrictions = reject_unauth_pipelining, reject_multi_recipient_bounce smtpd_etrn_restrictions = reject smtp_use_tls = yes smtp_enforce_tls = yes smtp_tls_security_level = encrypt smtp_helo_timeout = 10s smtp_rcpt_timeout = 10s smtp_tls_CAfile = /etc/ssl/ca-bundle.pem smtp_tls_CApath = /etc/ssl/certs smtp_tls_cert_file = /etc/apache2/ssl.crt/example.ua.crt smtp_tls_key_file = /etc/apache2/ssl.key/example.ua.key smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache smtp_tls_session_cache_timeout = 1d smtpd_use_tls = yes smtpd_enforce_tls = yes smtpd_helo_required = yes smtpd_tls_auth_only = yes smtpd_tls_security_level = encrypt smtpd_recipient_limit = 100 smtpd_reject_unlisted_recipient = yes smtpd_reject_unlisted_sender = yes smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_path = private/auth smtpd_sasl_type = dovecot smtpd_tls_CAfile = /etc/ssl/ca-bundle.pem smtpd_tls_CApath = /etc/ssl/certs smtpd_tls_cert_file = /etc/apache2/ssl.crt/example.ua.crt smtpd_tls_key_file = /etc/apache2/ssl.key/example.ua.key smtpd_tls_received_header = yes smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache smtpd_tls_session_cache_timeout = 1d virtual_alias_domains = virtual_alias_maps = hash:/etc/postfix/virtual virtual_mailbox_domains = $myhostname, subdomain.$myhostname virtual_mailbox_base = /srv/vmail virtual_mailbox_lock = fcntl virtual_minimum_uid = 303 virtual_uid_maps = static:303 virtual_gid_maps = static:303 virtual_transport = lmtp:unix:private/dovecot-lmtp 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, reject_unknown_helo_hostname, reject_unknown_client_hostname, reject_rbl_client zen.spamhaus.org compatibility_level = 2 stress = yes biff = no disable_vrfy_command = yes strict_rfc821_envelopes = yes smtputf8_autodetect_classes = bounce myhostname = example.ua mydomain = $myhostname mydestination = localhost.$mydomain, localhost inet_interfaces = all inet_protocols = ipv4 smtpd_recipient_restrictions = permit_inet_interfaces, permit_sasl_authenticated, reject_unauth_destination, 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, reject_unknown_helo_hostname, reject_unknown_client_hostname, reject_rbl_client zen.spamhaus.org smtpd_relay_restrictions = permit_inet_interfaces, permit_sasl_authenticated, reject_unauth_destination smtpd_data_restrictions = reject_unauth_pipelining, reject_multi_recipient_bounce smtpd_etrn_restrictions = reject smtp_use_tls = yes smtp_enforce_tls = yes smtp_tls_security_level = encrypt smtp_helo_timeout = 10s smtp_rcpt_timeout = 10s smtp_tls_CAfile = /etc/ssl/ca-bundle.pem smtp_tls_CApath = /etc/ssl/certs smtp_tls_cert_file = /etc/apache2/ssl.crt/example.ua.crt smtp_tls_key_file = /etc/apache2/ssl.key/example.ua.key smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache smtp_tls_session_cache_timeout = 1d smtpd_use_tls = yes smtpd_enforce_tls = yes smtpd_helo_required = yes smtpd_tls_auth_only = yes smtpd_tls_security_level = encrypt smtpd_recipient_limit = 100 smtpd_reject_unlisted_recipient = yes smtpd_reject_unlisted_sender = yes smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_path = private/auth smtpd_sasl_type = dovecot smtpd_tls_CAfile = /etc/ssl/ca-bundle.pem smtpd_tls_CApath = /etc/ssl/certs smtpd_tls_cert_file = /etc/apache2/ssl.crt/example.ua.crt smtpd_tls_key_file = /etc/apache2/ssl.key/example.ua.key smtpd_tls_received_header = yes smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache smtpd_tls_session_cache_timeout = 1d virtual_alias_domains = virtual_alias_maps = hash:/etc/postfix/virtual virtual_mailbox_domains = $myhostname, subdomain.$myhostname virtual_mailbox_base = /srv/vmail virtual_mailbox_lock = fcntl virtual_minimum_uid = 303 virtual_uid_maps = static:303 virtual_gid_maps = static:303 virtual_transport = lmtp:unix:private/dovecot-lmtp 

/ etc / postfix / virtual

 # example.ua postmaster@example.ua user@example.ua abuse@example.ua user@example.ua # subdomain.example.ua postmaster@subdomain.example.ua user@example.ua abuse@subdomain.example.ua user@example.ua 

sudo postmap hash: / etc / postfix / virtual

And after that, the mail sent to the addresses postmaster@example.ua , abuse@example.ua , postmaster@subdomain.example.ua , abuse@subdomain.example.ua comes to the virtual user user@example.ua , as intended.