Ubuntu 和 Postfix 配置问题

Ubuntu 和 Postfix 配置问题

我最近在 Ubuntu Natty 上安装了 postfix。我在配置方面遇到了问题。

首先这是我的 postfix 配置文件:

# 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)
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

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

mydomain = $myorigin
myhostname = mail.nairanode.com

alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
# this specifies where the virtual mailbox folders will be located
virtual_mailbox_base = /var/spool/mail/virtual
# this specifies where the virtual mailbox folders will be located
virtual_mailbox_base = /var/spool/mail/virtual
# this is for the mailbox location for each user
virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf
# and this is for aliases
virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf
# and this is for domain lookups
virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf
# this is how to connect to the domains (all virtual, but the option is there)
# not used yet
# transport_maps = mysql:/etc/postfix/mysql_transport.cf
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

mydestination = $myorigin, $myhostname, localhost.localdomain, , 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
#mynetworks_style = host

# ADDITIONAL
unknown_local_recipient_reject_code = 550
maximal_queue_lifetime = 7d
minimal_backoff_time = 1000s
maximal_backoff_time = 8000s
smtp_helo_timeout = 60s
smtpd_recipient_limit = 16
smtpd_soft_error_limit = 3
smtpd_hard_error_limit = 12

# Requirements for the HELO statement
smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit
# Requirements for the sender details
smtpd_sender_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_$
# Requirements for the connecting server
smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client dnsbl.n$
# Requirement for the recipient address
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_do$

# require proper helo at connections
smtpd_helo_required = yes
# waste spammers time before rejecting them
smtpd_delay_reject = yes
disable_vrfy_command = yes

这也是我的 /etc/postfix/aliases:

# See man 5 aliases for format
postmaster:    root

这也是我的 /etc/mailname:

nairanode.com

我还将主机名更新为 nairanode.com

但是,当我运行时,postalias /etc/postfix/aliases我得到以下信息:

postalias: warning: valid_hostname: invalid character 47(decimal): /etc/mailname
postalias: fatal: file /etc/postfix/main.cf: parameter mydomain: bad parameter value: /etc/mailname

我是不是做错了什么?!我注意到,当我在 postfix 配置中替换myorigin = /etc/mailname为时myorigin = nairanode.com,调用 postalias 后就看不到任何错误了。这是 bug 还是其他什么?!

答案1

您无权指定

mydomain = $myorigin

您可以完全删除该设置,也可以指定一个有效条目,例如 mail.nairanode.com。但您不能使用 $myorigin 之类的变量!

如果你希望它可以通过外部文件“动态”配置,那么你必须删除mydomain myhostname完全。在这种情况下,将从主机名中提取域,并从中提取主机名/etc/hosts(更好:通过 gethostname() 系统调用)


看看你的前三行,main.cf为什么你现在遇到了 Debian-Postfix“错误”。但 Debian/Ubuntu 故意破解 Postfix 以允许这种愚蠢的事情。但他们没有考虑通过 Postfix $variables 使用此破解的后果。向 Debian 投诉,而不是 Postfix!

相关内容