Email
Postfix 使用 virtual.db 文件而不是 mysql 表
我已經指定
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
了,但我仍然收到類似的錯誤警告:hash:/etc/postfix/virtual 不可用。打開數據庫/etc/postfix/virtual.db:沒有這樣的文件或目錄
如果我創建 virtual 和 virtual.db 文件,一切正常,但我希望我的虛擬使用者帳戶儲存在 DB 中,而不是文件。
為什麼 postfix 使用 virtual.db 文件而不是 db 表?
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
實際上我在master.cf中有/etc/postfix/virtual:
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
問題是
-o smtpd_sender_login_maps=hash:/etc/postfix/virtual
master.cf 中的行。我忘了看那裡,因為這個確切的配置在我的另一台伺服器上執行了幾個月。
我通過修改以下行解決了這個問題
etc/postfix/main.cf
:virtual_alias_maps = hash:/etc/postfix/virtual
到
virtual_alias_maps = hash:/etc/aliases
(或者作為替代方案,只需創建
etc/postfix/virtual
包含內容的文件):your_linux_username: your_email@gmail.com
然後重新啟動 postfix:
sudo systemctl restart postfix
然後發送郵件。