Postfix /etc/postfix/main.cf

原始 📋 Ubuntu 18.04 LTS (Bionic Beaver) 44 行
/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)
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
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.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = 6990019712b2
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, 6990019712b2, 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
inet_protocols = all

复制粘贴

curl:
curl https://exampleconfig.com/api/v1/config/original/12bd48b9ef7ed2bbcfcc9be1e0ec0e17?hint=main.cf
wget:
wget -O main.cf https://exampleconfig.com/api/v1/config/original/12bd48b9ef7ed2bbcfcc9be1e0ec0e17?hint=main.cf

给 AI Agent 用

<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/12bd48b9ef7ed2bbcfcc9be1e0ec0e17?hint=main.cf' /><config><app>Postfix</app><os>Ubuntu 18.04 LTS (Bionic Beaver)</os><location>/etc/postfix/main.cf</location><lines>44</lines><md5>12bd48b9ef7ed2bbcfcc9be1e0ec0e17</md5><sha256>791e99b400a97a72af4f379bea03ac27322a64382ba509ce28f5d709441d9f8b</sha256></config></prompt>

粘贴到 Claude、ChatGPT 或任何 AI 助手里。

安装 Postfix

Alpine Linux

sudo apk add postfix

Debian

sudo apt update && sudo apt install postfix

Red Hat Enterprise Linux

sudo yum install postfix

Ubuntu

sudo apt update && sudo apt install postfix

文件位置

文件路径
/etc/postfix/main.cf
目录
/etc/postfix/
用途
系统级配置目录
说明
/etc/ 里的文件是系统级配置,影响所有用户。

FAQ

什么时候该用这个 main.cf?

用来恢复缺失的默认文件、确认发行版本带了什么,或拿你的 Postfix config 做 diff。

怎么恢复 Postfix 的默认配置?

下载文件,把 /etc/postfix/main.cf 里的当前配置备份好,替换掉,然后 reload 或 restart Postfix。

main.cf 适合直接上生产吗?

这是 Ubuntu 18.04 LTS (Bionic Beaver) 的厂商默认配置,只能当基线。上生产前请检查安全和性能设置。

和其他 OS 版本有什么不同?

默认值会随发行版和版本变化,这份对应 Ubuntu 18.04 LTS (Bionic Beaver)。

我可以用它来排查 Postfix 吗?

可以。和你的配置做 diff 找出漂移,然后只恢复需要的段落。