命令行手册

Man » postfix 在线手册 - postfix 手册页的详细在线文档

🌍
postfix - Postfix 控制程序

概要

postfix [-Dv] [-c config_dir] 命令

描述

此命令保留给超级用户。要提交邮件,请使用 Postfix 的 sendmail(1) 命令。

postfix(1) 命令用于控制 Postfix 邮件系统的操作:启动或停止 master(8) 守护进程,执行健康检查和其他维护任务。

默认情况下,postfix(1) 命令会设置一个标准化的环境,并运行 postfix-script 脚本来执行实际工作。

但是,当配置了对多个 Postfix 实例的支持时,postfix(1) 将执行 multi_instance_wrapper 配置参数中指定的命令。此命令将为每个适用的 Postfix 实例执行该命令。

以下命令已实现:

check 警告目录/文件的所有权或权限是否不正确,并创建缺少的目录。

start 启动 Postfix 邮件系统。这还会运行上述配置检查。

start-fg

类似于 start,但将 master(8) 守护进程在前景中运行,并在作为 PID 1 运行时启用 master(8) 的“init”模式。 此命令要求禁用多实例支持(即,multi_instance_directories 参数的值必须为空)。

当在容器内运行 Postfix 时,请参阅 MAILLOG_README,了解如何将日志记录到标准输出。 Postfix 默认记录到 syslog,这需要:a) 在容器内运行 syslogd 进程,或 b) 将容器主机的 /dev/log 套接字挂载到容器内(示例:“docker run -v /dev/log:/dev/log ...”),以及 c) 一个不同的 Postfix“syslog_name”前缀,用于标识来自 Postfix 实例的日志记录。

stop 以有条不紊的方式停止 Postfix 邮件系统。如果可能,正在运行的进程将被允许在最早的时间终止。

注意:为了在配置更改后刷新 Postfix 邮件系统,不要连续使用 start 和 stop 命令。而是使用 reload 命令。

abort 突然停止 Postfix 邮件系统。正在运行的进程会被发出信号以立即停止。

flush 强制交付:尝试交付延迟邮件队列中的每条消息。通常,尝试交付延迟邮件会在定期的时间间隔内发生,每次失败的尝试之后的时间间隔都会翻倍。

警告:频繁地刷新无法交付的邮件会导致所有其他邮件的交付性能下降。

reload 重新读取配置文件。正在运行的进程将在最早的时间终止。

status 指示 Postfix 邮件系统当前是正在运行(退出状态为零)还是已停止(退出状态为非零)。

set-permissions [name=value ...]

设置 Postfix 相关文件和目录的所有权和权限,如 postfix-files 文件中指定。

通过 name=value 形式指定,可以覆盖并更新特定的 main.cf 配置文件参数。例如,可以使用它来更改已安装的 Postfix 系统的 mail_ownersetgid_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,并管理 Postfix SMTP 服务器 TLS 私钥和证书。有关文档,请参阅 postfix-tls(1)

此功能在 Postfix 3.1 及更高版本中可用。

upgrade-configuration [name=value ...]

使用 Postfix 运行所需的信息(例如,添加或更新服务以及添加或更新配置参数设置)更新 main.cfmaster.cf 文件。

通过 name=value 形式指定,可以覆盖并更新特定的 main.cf 配置文件参数。

此功能在 Postfix 2.1 及更高版本中可用。对于 Postfix 2.0 及更早版本,请使用 $config_directory/post-install upgrade-configuration

以下选项已实现:

-c config_dir

读取指定目录中的 main.cfmaster.cf 配置文件,而不是默认的配置文件目录。使用此选项可以在同一主机上区分多个 Postfix 实例。

对于 Postfix 2.6 及更高版本,此选项强制 postfix(1) 命令仅对指定的 Postfix 实例进行操作。此行为由作为当前进程后代的 postfix(1) 命令继承。

-D(仅适用于 `postfix start`)

在由 debugger_command 配置文件参数指定的调试器下运行每个 Postfix 守护程序。

-v     启用详细日志记录,用于调试目的。多个 `-v` 选项会使软件的日志记录越来越详细。

环境

^ ostfix(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' 的输出)

Postfi main.cf 和 master.cf 配置文件默认位置。

command_directory (请参阅 'postconf -d' 的输出)

所有 Postfix 管理命令的位置。

daemon_directory (请参阅 'postconf -d' 的输出)

包含 Postfix 支持程序和守护程序程序目录。

html_directory (请参阅 'postconf -d' 的输出)

Postfix HTML 文件的位置,这些文件描述了如何构建、配置或操作特定的 Postfix 子系统或功能。

mail_owner (postfix)

拥有 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 文件的位置,这些文件描述了如何构建、配置或操作特定的 Postfix 子系统或功能。

sendmail_path (请参阅 'postconf -d' 的输出)

Sendmail 兼容性功能,用于指定 Postfix sendmail(1) 命令的位置。

setgid_group (postdrop)

设置 gid 的 Postfix 命令以及组可写的 Postfix 目录的组所有权。

在 Postfix 版本 2.5 及更高版本中可用:

data_directory (请参阅 'postconf -d' 的输出)

包含 Postfix 可写数据文件的目录(例如:缓存、伪随机数)。

在 Postfix 版本 3.0 及更高版本中可用:

compatibility_level (0)

安全网,可在升级到较新的 Postfix 版本后,使 Postfix 运行具有向后兼容的默认设置。

meta_directory (请参阅 'postconf -d' 的输出)

包含在多个 Postfix 实例之间共享的非可执行文件的位置,例如 postfix-files、dynamicmaps.cf 以及 multi-instance 模板文件 main.cf.proto 和 master.cf.proto。

shlib_directory (请参阅 'postconf -d' 的输出)

Postfix 动态链接库(libpostfix-*.so)的位置,以及 Postfix 数据库插件(postfix-*.so)的默认位置,这些插件在 dynamicmaps.cf 文件中具有相对路径名。

在 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 实例,这些实例与默认 Postfix 实例共享 Postfix 可执行文件和文档,并且与默认 Postfix 实例一起启动、停止等。

multi_instance_wrapper (空)

当 multi_instance_directories 参数值不为空时,postfix(1) 命令调用的多实例管理器的路径。

multi_instance_group (空)

此 Postfix 实例的可选实例组名称。

multi_instance_name (空)

此 Postfix 实例的可选实例名称。

multi_instance_enable (no)

允许通过多实例管理器启动、停止等此 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)

master.cf 中 postlogd(8) 服务条目的名称。

文件

在 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 文件

使用“postconf readme_directory”或“postconf html_directory”来查找此信息。 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 Research P.O. Box 704 Yorktown Heights, NY 10598, USA

Wietse Venema Google, Inc. 1118th Avenue New York, NY 10011, USA

TLS 支持:

Lutz Jaenicke Brandenburg University of Technology Cottbus, Germany

Victor Duchovni Morgan Stanley

SASL 支持最初由:

Till Franke SuSE Rhein/Main AG 65760Eschborn, Germany

LMTP 支持最初由:

Philip A. Prindeville Mirapoint, Inc. USA.

Amos Gouaux University of Texas at Dallas P.O. Box 830688, MC34 Richardson, TX 75083, USA

IPv6 支持最初由:

Mark Huizer, Eindhoven University, The Netherlands Jun-ichiro 'itojun' Hagino, KAME project, Japan The Linux PLD project Dean Strik, Eindhoven University, The Netherlands