POSTFIX(1) POSTFIX(1)
名称
postfix - Postfix 控制程序
概要
postfix [-Dv] [-c config_dir] command
描述
本命令需由超级用户执行。普通用户提交邮件应使用 Postfix 的 sendmail(1) 命令。
postfix(1) 命令用于控制 Postfix 邮件系统的运行:启动或停止 master(8) 守护进程、执行健康检查及其他维护操作。
默认情况下,postfix(1) 命令会设置标准化环境,并通过执行 postfix-script shell 脚本来完成实际操作。
当系统配置支持多实例时(即配置了多个 Postfix 实例),postfix(1) 会执行由 multi_instance_wrapper 配置参数指定的命令。该命令会为每个适用的 Postfix 实例执行指定的 command。
支持以下命令:
check 检查目录/文件权限及所有权问题,并创建缺失的目录。
start 启动 Postfix 邮件系统(同时会执行上述检查操作)。
start-fg
与 start 类似,但使 master(8) 守护进程在前台运行,且在作为 PID 1 运行时启用 master(8) 的"init"模式。
注意:使用此命令时必须禁用多实例支持(即 multi_instance_directories 参数值必须为空)。
在容器中运行 Postfix 时,请参考 MAILLOG_README 了解如何将日志输出到 stdout。Postfix 默认记录到 syslog,这需要:
a) 在容器内运行 syslogd 进程;或
b) 将容器主机的 /dev/log 套接字挂载到容器内(例如:"docker run -v /dev/log:/dev/log ...");以及
c) 配置独特的 Postfix "syslog_name" 前缀以标识该实例的日志。
stop 优雅地停止 Postfix 邮件系统。尽可能让正在运行的进程完成当前操作后退出。
注意:修改配置后如需刷新 Postfix 邮件系统,请不要连续使用 start 和 stop 命令,而应使用 reload 命令。
abort 强制停止 Postfix 邮件系统。立即终止所有运行中的进程。
flush 强制投递:尝试发送延迟队列中的所有邮件。通常系统会按固定间隔尝试投递延迟邮件,且每次失败后间隔时间会加倍。
警告:频繁强制投递无法送达的邮件会导致其他邮件的投递性能下降。
reload 重新读取配置文件。运行中的进程将在完成当前操作后退出。
status 显示 Postfix 邮件系统当前状态:运行中(返回 0)或已停止(返回非 0)。
set-permissions [name=value ...]
根据 postfix-files 文件中的定义,设置 Postfix 相关文件和目录的权限及所有权。
可通过 name=value 参数覆盖并更新特定的 main.cf 配置参数。例如,可用此修改已安装 Postfix 系统的 mail_owner 或 setgid_group 设置。
本功能自 Postfix 2.1 起可用。Postfix 2.0 及更早版本请使用:
"$config_directory/post-install set-permissions"。
logrotate
按 $maillog_file 参数指定的日志文件,添加格式为 $maillog_file_rotate_suffix 的时间戳后缀进行轮转,并使用 $maillog_file_compressor 指定的命令压缩日志文件。注意:不会轮转 /dev/* 设备文件。
本功能自 Postfix 3.4 起可用。
tls subcommand
在 Postfix SMTP 客户端或服务器中启用机会型 TLS,并管理 SMTP 服务器的 TLS 私钥和证书。详情参见 postfix-tls(1)。
本功能自 Postfix 3.1 起可用。
upgrade-configuration [name=value ...]
更新 main.cf 和 master.cf 文件,添加 Postfix 运行所需的信息:添加或更新服务配置,添加或更新参数设置。
可通过 name=value 参数覆盖并更新特定的 main.cf 配置参数。
本功能自 Postfix 2.1 起可用。Postfix 2.0 及更早版本请使用:
"$config_directory/post-install upgrade-configuration"。
支持以下选项:
-c config_dir
指定配置目录(而非默认目录)来读取 main.cf 和 master.cf 文件。用于区分同一主机上的多个 Postfix 实例。
自 Postfix 2.6 起,此选项会强制 postfix(1) 命令仅操作指定的 Postfix 实例。该行为会传递给当前进程的所有子 postfix(1) 命令。
-D (仅与 postfix start 配合使用)
根据 debugger_command 配置参数的设置,在调试器控制下运行每个 Postfix 守护进程。
-v 启用详细日志记录用于调试。多次指定此选项可进一步提高日志详细程度。
环境变量
postfix(1) 命令在执行 postfix-script 文件前会设置以下环境变量:
MAIL_CONFIG
当使用 -c 命令行选项时设置此变量。
自 Postfix 2.6 起,此环境变量会强制 postfix(1) 命令仅操作指定的 Postfix 实例。该行为会传递给当前进程的所有子 postfix(1) 命令。
MAIL_VERBOSE
当使用 -v 命令行选项时设置此变量。
MAIL_DEBUG
当使用 -D 命令行选项时设置此变量。
当启用内部日志服务(通过设置非空的 maillog_file 参数值)时,postfix(1) 命令会导出一些设置,这些设置会在子进程处理 main.cf 或命令行参数前被使用:
POSTLOG_SERVICE
公共 postlog 服务的端点名称。
POSTLOG_HOSTNAME
预置到内部日志中的主机名。
配置参数
以下 main.cf 配置参数会作为同名环境变量导出:
config_directory (参见 'postconf -d' 输出)
Postfix main.cf 和 master.cf 配置文件的默认位置。
command_directory (参见 'postconf -d' 输出)
所有 Postfix 管理命令的安装目录。
daemon_directory (参见 'postconf -d' 输出)
Postfix 支持程序和守护程序的安装目录。
html_directory (参见 'postconf -d' 输出)
包含 Postfix 各子系统及功能构建、配置和操作说明的 HTML 文件目录。
mail_owner (postfix)
拥有 Postfix 队列和大多数守护进程的 UNIX 系统账户。
mailq_path (参见 'postconf -d' 输出)
用于 Sendmail 兼容性,指定 Postfix mailq(1) 命令的安装路径。
manpage_directory (参见 'postconf -d' 输出)
Postfix 手册页的安装目录。
newaliases_path (参见 'postconf -d' 输出)
用于 Sendmail 兼容性,指定 newaliases(1) 命令的位置。
queue_directory (参见 'postconf -d' 输出)
Postfix 顶级队列目录的位置。
readme_directory (参见 'postconf -d' 输出)
包含 Postfix 各子系统及功能构建、配置和操作说明的 README 文件目录。
sendmail_path (参见 'postconf -d' 输出)
用于 Sendmail 兼容性,指定 Postfix sendmail(1) 命令的位置。
setgid_group (postdrop)
设置 set-gid 的 Postfix 命令及组可写目录的组所有权。
Postfix 2.5 及更高版本新增:
data_directory (参见 'postconf -d' 输出)
包含 Postfix 可写数据文件(如缓存、伪随机数)的目录。
Postfix 3.0 及更高版本新增:
compatibility_level (0)
安全机制:升级到新版 Postfix 后,此参数可使系统保持向后兼容的默认设置。
meta_directory (参见 'postconf -d' 输出)
多个 Postfix 实例共享的非可执行文件目录,包括 postfix-files、dynamicmaps.cf 以及多实例模板文件 main.cf.proto 和 master.cf.proto。
shlib_directory (参见 'postconf -d' 输出)
Postfix 动态链接库(libpostfix-*.so)的位置,以及 dynamicmaps.cf 文件中使用相对路径的 Postfix 数据库插件(postfix-*.so)的默认位置。
Postfix 3.1 及更高版本新增:
openssl_path (openssl)
OpenSSL 命令行工具 openssl(1) 的路径。
其他配置参数:
import_environment (参见 'postconf -d' 输出)
特权 Postfix 进程从非 Postfix 父进程继承的环境变量列表,或 name=value 形式的环境变量覆盖设置。
syslog_facility (mail)
Postfix 日志的 syslog 设施。
syslog_name (参见 'postconf -d' 输出)
预置到 syslog 记录中进程名称前的前缀(例如:"smtpd" 会变为 "prefix/smtpd")。
Postfix 2.6 及更高版本新增:
multi_instance_directories (空)
非默认 Postfix 配置目录的可选列表。这些目录属于额外的 Postfix 实例,这些实例与默认实例共享可执行文件和文档,并与默认实例一起启动、停止等。
multi_instance_wrapper (空)
当 multi_instance_directories 参数非空时,postfix(1) 命令调用的多实例管理器命令路径。
multi_instance_group (空)
本 Postfix 实例的可选实例组名。
multi_instance_name (空)
本 Postfix 实例的可选实例名。
multi_instance_enable (否)
是否允许多实例管理器启动、停止本 Postfix 实例。
Postfix 3.4 及更高版本新增:
maillog_file (空)
由 Postfix postlogd(8) 服务写入的日志文件名。
maillog_file_compressor (gzip)
执行"postfix logrotate"后用于压缩 $maillog_file 的程序。
maillog_file_prefixes (/var, /dev/stdout)
maillog_file 参数值的允许前缀列表。
maillog_file_rotate_suffix (%Y%m%d-%H%M%S)
执行"postfix logrotate"时附加到 $maillog_file 的时间戳后缀格式。
postlog_service_name (postlog)
postlogd(8) 服务在 master.cf 中的名称。
文件
在 Postfix 2.6 之前,以下所有文件都位于 $config_directory。现在部分文件移至 $daemon_directory 或 $meta_directory,以便多个运行相同 Postfix 版本的实例共享。
使用命令"postconf config_directory"或"postconf daemon_directory"可查看实际路径。
$config_directory/main.cf, Postfix 配置参数
$config_directory/master.cf, Postfix 守护进程配置
$daemon_directory/postfix-script, 管理命令
$daemon_directory/post-install, 安装后配置
$meta_directory/dynamicmaps.cf, 插件式数据库客户端
$meta_directory/postfix-files, 文件/目录权限设置
参见
命令:
postalias(1), 创建/更新/查询别名数据库
postcat(1), 查看 Postfix 队列文件内容
postconf(1), Postfix 配置工具
postdrop(1), Postfix 邮件投递工具
postfix(1), Postfix 控制程序
postfix-tls(1), Postfix TLS 管理工具
postkick(1), 触发 Postfix 守护进程
postlock(1), Postfix 兼容的锁机制
postlog(1), Postfix 兼容的日志工具
postmap(1), Postfix 查询表管理工具
postmulti(1), Postfix 多实例管理器
postqueue(1), Postfix 邮件队列控制工具
postsuper(1), Postfix 维护工具
mailq(1), Sendmail 兼容接口
newaliases(1), Sendmail 兼容接口
sendmail(1), Sendmail 兼容接口
Postfix 配置:
bounce(5), Postfix 退信模板
master(5), Postfix master.cf 文件语法
postconf(5), Postfix main.cf 文件语法
postfix-wrapper(5), Postfix 多实例 API
表驱动机制:
access(5), Postfix SMTP 访问控制表
aliases(5), Postfix 本地别名机制
canonical(5), Postfix 输入地址重写规则
generic(5), Postfix 输出地址重写规则
header_checks(5), body_checks(5), Postfix 内容检查规则
relocated(5), 已迁移用户数据库
transport(5), Postfix 路由表
virtual(5), Postfix 虚拟别名机制
表查询机制:
cidr_table(5), CIDR 模式与值关联
ldap_table(5), Postfix LDAP 客户端
lmdb_table(5), Postfix LMDB 数据库驱动
memcache_table(5), Postfix memcache 客户端
mongodb_table(5), Postfix MongoDB 客户端
mysql_table(5), Postfix MySQL 客户端
nisplus_table(5), Postfix NIS+ 客户端
pcre_table(5), PCRE 模式与值关联
pgsql_table(5), Postfix PostgreSQL 客户端
regexp_table(5), POSIX 正则表达式与值关联
socketmap_table(5), Postfix socketmap 客户端
sqlite_table(5), Postfix SQLite 数据库驱动
tcp_table(5), Postfix 客户端-服务器表查询
守护进程:
anvil(8), Postfix 连接/频率限制
bounce(8), defer(8), trace(8), 投递状态报告
cleanup(8), 规范化和排队消息
discard(8), Postfix 丢弃投递代理
dnsblog(8), DNS 允许/拒绝列表记录器
error(8), Postfix 错误投递代理
flush(8), Postfix 快速 ETRN 服务
local(8), Postfix 本地投递代理
master(8), Postfix 主守护进程
oqmgr(8), 旧版 Postfix 队列管理器
pickup(8), Postfix 本地邮件收取
pipe(8), 投递邮件到非 Postfix 命令
postlogd(8), Postfix 内部日志服务
postscreen(8), Postfix 僵尸拦截器
proxymap(8), Postfix 查询表代理服务器
qmgr(8), Postfix 队列管理器
qmqpd(8), Postfix QMQP 服务器
scache(8), Postfix 连接缓存管理器
showq(8), 列出 Postfix 邮件队列
smtp(8), lmtp(8), Postfix SMTP+LMTP 客户端
smtpd(8), Postfix SMTP 服务器
spawn(8), 运行非 Postfix 服务器
tlsmgr(8), Postfix TLS 缓存和随机数管理器
tlsproxy(8), Postfix TLS 代理服务器
trivial-rewrite(8), Postfix 地址重写
verify(8), Postfix 地址验证
virtual(8), Postfix 虚拟投递代理
其他:
syslogd(8), 系统日志服务
README 文件
OVERVIEW, Postfix 命令和进程概述
BASIC_CONFIGURATION_README, Postfix 基础配置
ADDRESS_REWRITING_README, Postfix 地址重写
SMTPD_ACCESS_README, SMTP 中继/访问控制
CONTENT_INSPECTION_README, Postfix 内容检查
QSHAPE_README, Postfix 队列分析
许可证
本软件必须随附 Secure Mailer 许可证。
作者
Wietse Venema
IBM T.J. Watson 研究中心
邮政信箱 704
美国纽约州约克镇高地 10598
Wietse Venema
谷歌公司
纽约第八大道 111 号
美国纽约 10011
TLS 支持:
Lutz Jaenicke
勃兰登堡理工大学
德国科特布斯
Victor Duchovni
摩根士丹利
SASL 原始支持:
Till Franke
SuSE Rhein/Main AG
德国埃施博恩 65760
LMTP 原始支持:
Philip A. Prindeville
Mirapoint 公司
美国
Amos Gouaux
德克萨斯大学达拉斯分校
邮政信箱 830688, MC34
美国德克萨斯州理查森 75083
IPv6 原始支持:
Mark Huizer, 荷兰埃因霍温大学
Jun-ichiro 'itojun' Hagino, 日本 KAME 项目
Linux PLD 项目
Dean Strik, 荷兰埃因霍温大学
POSTFIX(1)