Postfix
postfix 和 dovecot 使用 /root/Maildir 而不是 /var/spool/mail
我有一個用於測試 dovecot 和 postfix 的郵件伺服器,這是 postfix 配置
queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix mail_owner = postfix myhostname = postfix1.test.lan mydomain = test.lan myorigin = $mydomain inet_interfaces = all inet_protocols = all mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain unknown_local_recipient_reject_code = 550 mynetworks = 10.10.0.0/24, 127.0.0.0/8 relay_domains = $mydestination relayhost = posta.test.lan alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases home_mailbox = Maildir/ mail_spool_directory = /var/spool/mail debug_peer_level = 2 debug_peer_list = 127.0.0.1 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 sendmail_path = /usr/sbin/sendmail.postfix newaliases_path = /usr/bin/newaliases.postfix mailq_path = /usr/bin/mailq.postfix setgid_group = postdrop html_directory = no manpage_directory = /usr/share/man sample_directory = /usr/share/doc/postfix-2.10.1/samples readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES smtp_use_tls=yes smtpd_use_tls=yes smtpd_tls_auth_only = yes smtpd_tls_received_header = yes smtp_tls_note_starttls_offer = yes smtpd_tls_cert_file=/etc/postfix/mycert.pem smtpd_tls_key_file=/etc/postfix/private/mykey.key smtpd_tls_ciphers= high smtpd_tls_exclude_ciphers = aNULL, DES, 3DES, MD5, DES+MD5, RC4 smtpd_tls_protocols = !SSLv2, !SSLv3 smtp_tls_protocols = !SSLv2, !SSLv3 smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous smtpd_sasl_authenticated_header = yes cyrus_sasl_config_path = /etc/sasl2/smtpd.conf virtual_transport=dovecot smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_sender, reject_sender_login_mismatch, reject_authenticated_sender_login_mismatch, reject_unauthenticated_sender_login_mismatch, reject
master.cf
smtp inet n - n - - smtpd pickup unix n - n 60 1 pickup cleanup unix n - n - 0 cleanup qmgr unix n - n 300 1 qmgr tlsmgr unix - - n 1000? 1 tlsmgr rewrite unix - - n - - trivial-rewrite bounce unix - - n - 0 bounce defer unix - - n - 0 bounce trace unix - - n - 0 bounce verify unix - - n - 1 verify flush unix n - n 1000? 0 flush proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap smtp unix - - n - - smtp relay unix - - n - - smtp showq unix n - n - - showq error unix - - n - - error retry unix - - n - - error discard unix - - n - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - n - - lmtp anvil unix - - n - 1 anvil scache unix - - n - 1 scache dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -d ${recipient} submission inet n - - - - smtpd -o syslog_name=postfix/submission -o smtpd_tls_wrappermode=no -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING -o smtpd_sasl_type=dovecot -o smtpd_sasl_path=private/auth
在 dovecot 我只改變了這條線
mail_home = maildir:/var/spool/mail/%u
我也試過
mail_location = maildir:/var/spool/mail/%u
當我嘗試發送電子郵件而不是使用 /var/spool/mail 時,它會嘗試使用(並失敗)/root/Maildir!我的conf哪裡錯了?為什麼不使用我配置的/var/spool/mail?我試過沒有 selinux 但同樣的事情.. 發行版是最新的 centos 7
找到解決方案,dovecot 配置錯誤。並刪除此行使伺服器正常工作
mynetworks = 10.10.0.0/24, 127.0.0.0/8