1

I have specified virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf, but still I got errors like

warning: hash:/etc/postfix/virtual is unavailable. open database /etc/postfix/virtual.db: No such file or directory

If I create the virtual and virtual.db files, everything works fine, but I want my virtual user account to be stored in DB, not if a file.

Why does postfix use the virtual.db file instead of db table?

postconf -n:

alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
dovecot_destination_recipient_limit = 1
inet_interfaces = all
inet_protocols = ipv4
milter_default_action = accept
milter_protocol = 2
mydestination = localhost
non_smtpd_milters = unix:/var/run/opendkim/opendkim.sock
smtp_tls_note_starttls_offer = yes
smtpd_milters = unix:/var/run/opendkim/opendkim.sock
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = example.tst
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/dovecot/dovecot.pem
smtpd_tls_key_file = /etc/dovecot/private/dovecot.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = dovecot

Actually I have /etc/postfix/virtual in master.cf:

submission inet n - - - - smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_sasl_type=dovecot
  -o smtpd_sasl_path=private/auth
  -o smtpd_sasl_security_options=noanonymous
  -o smtpd_sasl_local_domain=$myhostname
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  -o smtpd_sender_login_maps=hash:/etc/postfix/virtual
  -o smtpd_sender_restrictions=reject_sender_login_mismatch
  -o smtpd_recipient_restrictions=reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject
asmisha
  • 21
  • 1
  • 5

2 Answers2

1

The problem was the line -o smtpd_sender_login_maps=hash:/etc/postfix/virtual in master.cf. I forgot to look there, because this exact configuration was running fine for months on another my server.

asmisha
  • 21
  • 1
  • 5
0

I've solved that by modifying the line in etc/postfix/main.cf :

virtual_alias_maps = hash:/etc/postfix/virtual

to

virtual_alias_maps = hash:/etc/aliases

(or as an alternative, just create the etc/postfix/virtual file with content):

your_linux_username:  your_email@gmail.com

then restart postfix: sudo systemctl restart postfix and then mails were sent.

T.Todua
  • 214
  • 1
  • 4
  • 14