我正在运行 Ubuntu 20.04 LEMP 服务器。它是一个电子邮件和 Web 服务器。我的 postconf 消息中出现了一个令人费解的警告,需要帮助修复。
当我运行命令时
postconf default_process_limit
它返回警告信息:
postconf: warning: /etc/postfix/main.cf: undefined parameter: mail
下面是我的/etc/postfix/main.cf
文件。
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
#smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_banner = $myhostname ESMTP
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2
# TLS parameters
# Don't use self-signed certificates
#smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
#smtpd_tls_security_level=may
### Linuxbabe
# Enable TLS Encryption when Postfix receives incoming emails
smtpd_tls_cert_file=/etc/letsencrypt/live/mail.facl.xyz/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/mail.facl.xyz/privkey.pem
smtpd_tls_security_level=may
smtpd_tls_loglevel = 1
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
### Linuxbabe
#Enable TLS Encryption when Postfix sends outgoing emails
smtp_tls_security_level = may # Original by Linuxbabe. Use this if emails break.
#smtp_tls_security_level = encrypt
smtp_tls_loglevel = 1
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
### Linuxbabe
#Enforce TLSv1.3 or TLSv1.2
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
# Default 3 = uncommented
#smtp_tls_CApath=/etc/ssl/certs
#smtp_tls_security_level=may
#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# The below line prevents you from being an open relay, which means that your mail server wont forward email on behalf of anyone towards any destination, like open relays do.
# This line tells Postfix to forward email only from clients in trusted networks, from clients that have authenticated with SASL, or to domains that are configured as authorized relay destinations.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
message_size_limit = 104857600
#### Linuxbabe
# Tell Postfix to deliver incoming emails to local message store via the Dovecot LMTP server.
mailbox_transport = lmtp:unix:private/dovecot-lmtp
# Disable SMTPUTF8 in Postfix, because Dovecot-LMTP doesn't support this email extension
smtputf8_enable = no
### Linuxbabe Chapter 3
virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps =
proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
virtual_alias_maps =
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
### Linuxbabe chapter 3
virtual_transport = lmtp:unix:private/dovecot-lmtp
### Linuxbabe Chapter 3
# The first line defines the base location of mail files. The remaining 3 lines
# define which user ID and group ID Postfix will use when delivering incoming
# emails to the mailbox. We use the user ID 2000 and group ID 2000.
virtual_mailbox_base = /var/vmail
virtual_minimum_uid = 2000
virtual_uid_maps = static:2000
virtual_gid_maps = static:2000
### Linuxbabe Chapter 3 Ending
# By default, any local user can use the sendmail binary to submit outgoing emails.
# Now that your mail server is using virtual mailboxes, you might want to restrict
# access to the sendmail binary to trusted local users only, so a malicious user
# can’t use it to send a large volume of emails to damage your mail server’s reputation
authorized_submit_users = root,www-data,ubuntu,netdata
# deliver emails to local message store via the dovecot LMTP server (roundcube tutorial, sieve section, linuxbabe)
mailbox_transport = lmtp:unix:private/dovecot-lmtp
# disables SMTPUTF8 in Postfix, because Dovecot-LMTP doesn’t support this email extension (roundcube tutorial, seive section, linuxbabe)
smtputf8_enable = no
### Linuxbabe, rouncube tutorial, sieve section
# Help remove sensitive info (such as roundcube version number) from email headers
# This line is overridden by smtp_header_checks line at bottom of page
#smtp_header_checks = regexp:/etc/postfix/smtp_header_checks
### LINUXBABE CHAPTER 4
# The first line specifies the Postfix policy agent timeout setting. The following lines will impose a restriction on incoming emails by rejecting unauthorized email and checking SPF record.
policyd-spf_time_limit = 3600
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
check_policy_service unix:private/policyd-spf,
### LinuxBabe Chapter "7 Effective Tips for Blocking Email Spam with Postfix SMTP Server"
# Make Postfix use the Postgrey policy server.
check_policy_service inet:127.0.0.1:10023,
# Tip #6, Whitelisting
check_client_access hash:/etc/postfix/rbl_override,
### LinuxBabe Chapter ""7 Effective Tips for Blocking Email Spam with Postfix SMTP Server"
# Tip #6: Using Public Realtime Blacklists
reject_rhsbl_helo dbl.spamhaus.org,
reject_rhsbl_reverse_client dbl.spamhaus.org,
reject_rhsbl_sender dbl.spamhaus.org,
# The single line below is for public whitelisting, with dnswl whitelisting by ip address
permit_dnswl_client list.dnswl.org=127.0.[0..255].[1..3],
# The single line below is for whitelisting, however, if using spamhaus.org for blacklisting, then you don't need this on a whitelist as it is impossible for an IP address to be listed in Spamhaus whitelist and blacklist at the same time.
#permit_dnswl_client swl.spamhaus.org,
reject_rbl_client zen.spamhaus.org
### LINUXBABE CHAPTER 4
# Milter configuration for Postfix to be able to call OpenDKIM via the milter protocol.
#milter_default_action = accept
#milter_protocol = 6
#smtpd_milters = local:opendkim/opendkim.sock
#non_smtpd_milters = $smtpd_milters
### Linuxbabe Chapter "7 Effective Tips for Blocking Email Spam with Postfix SMTP Server"
## Tip #1
smtpd_sender_restrictions =
permit_mynetworks
permit_sasl_authenticated
## Tip #4
# Add the following line to reject email if the domain name of the address supplied with the MAIL FROM command has neither MX record nor A record.
reject_unknown_sender_domain
# This directive rejects an email if the client IP address has no PTR Record.
reject_unknown_reverse_client_hostname
## Tip #3
# A legitimate email server should have an IP address returned from an A record, that matches the IP address of the email server.
# To filter out emails from hosts that don't have a valid A record (IP doesnt match that of the server) add the following two lines below.
#reject_unknown_reverse_client_hostname # Duplicate from above.
reject_unknown_client_hostname
# ^^^ NOTE: reject_unknown_client_hostname does not require HELO from SMTP client. It will fetch the hostname from PTR record, then check the A record.
## Tip #2
# Add the following line to require the client to provide a HELO/EHLO hostname.
smtpd_helo_required = yes
# Add the following 3 lines to enable smtpd_helo_restrictions
smtpd_helo_restrictions =
permit_mynetworks
permit_sasl_authenticated
# Ocasionally, a legitimate mail server doesn't have a valid A record for the HELO/EHLO hostname. You need to whitelist them with the line below ("check_helo_access" directive).
# Don't forget to add whitelisted domains the the helo_access whitelist file, located at /etc/postfix/helo_access
check_helo_access hash:/etc/postfix/helo_access
# Use the following line to reject clients who provide malformed HELO/EHLO hostname.
reject_invalid_helo_hostname
# Use the following line to reject non-fully qualified HELO/EHLO hostname.
reject_non_fqdn_helo_hostname
# Use the following line to reject emails when the HELO/EHLO hostname has neither DNS A records nor MX Records.
reject_unknown_helo_hostname
### Linuxbabe, Chapter "Block Email Spam with Postfix and SpamAssassin Content Filter"
# Use header checks with PCRE
header_checks = pcre:/etc/postfix/header_checks
body_checks = pcre:/etc/postfix/body_checks
# Milter configuration (Note: Order of these matters. Don't change the order.)
# https://www.linuxbabe.com/mail-server/block-email-spam-check-header-body-with-postfix-spamassassin
milter_default_action = accept
milter_protocol = 6
smtpd_milters = local:opendkim/opendkim.sock,local:opendmarc/opendmarc.sock,local:spamass/spamass.sock
# If you haven't configured openDmarc you should remove local:opendmarc/opendmarc.sock from smtpd_milters in /etc/postfix/main.cf
#smtpd_milters = local:opendkim/opendkim.sock,local:spamass/spamass.sock
non_smtpd_milters = $smtpd_milters
### LInuxbabe "Spamassassin and Sieve Chapter"
# You can use smtp_header_checks to delete email headers that could show sensitive information.
# smtp_header_checks are only applied when Postfix is acting as an SMTP client, so it won’t affect incoming emails.
# You might not want the recipient to know that you are using SpamAssassin on your mail server.
# So add the following line, which tells Postfix to delete the X-Spam-Status and X-Spam-Checker-Version header
# from the email message when sending emails
smtp_header_checks = pcre:/etc/postfix/smtp_header_checks
### Linuxbabe "Postfix-amavis" chapter
# This tells Postfix to turn on content filtering by sending every incoming email message to Amavis, which listens on 127.0.0.1:10024.
content_filter = smtp-amavis:[127.0.0.1]:10024
# This will delay Postfix connection to content filter until the entire email message has been received, which can prevent content filters from wasting time and resources for slow SMTP clients.
smtpd_proxy_options = speed_adjust
# This setting was added by admin to fix "SPF: HELO does not publish an SPF Record" on mail-tester.com
smtp_helo_name = $mail.example.com
此警告是什么意思?我该如何修复它?我的 Postfix 文件中是否存在错误?我到底应该查找什么?
谢谢你的帮助!
答案1
你的最后一句话是
smtp_helo_name = $mail.example.com
但是您没有$mail
定义任何变量。请使用邮件主机的实际 DNS 名称,而不是变量。
答案2
/etc/postfix/main.cf
文件中的最后一行是smtp_helo_name = $mail.example.com
,但我没有定义 $mail 变量。由于我的邮件主机实际上是调用的,所以mail.example.com
我只需删除$
邮件主机的实际 DNS 名称之前的 。此后,我的行从以下内容更改为:
smtp_helo_name = $mail.example.com
更改为:
smtp_helo_name = mail.example.com
然后原帖子中的警告就不再出现。