第 23 章 postfix
Postfix 是一个开源邮件传输代理(MTA),它支持 LDAP、SMTP AUTH(SASL)和 TLS 等协议。[22]
在 Red Hat Enterprise Linux 中 , postfix 软件包提供 Postfix。输入以下命令查看是否安装了 postfix 软件包:
~]$ rpm -q postfix
package postfix is not installed
如果没有安装,使用
yum
工具 root 安装它:
~]# yum install postfix
23.1. Postfix 和 SELinux
启用 Postfix 后,它将默认受到限制。受限制的进程在其自己的域中运行,并且与其他受限制的进程隔开。如果一个受攻击者限制的进程受到 SELinux 策略配置的影响,攻击者对资源的访问权限和可能受到的破坏会受到限制。以下示例演示了在自己的域中运行的 Postfix 和相关进程。本例假设已安装 postfix 软件包,并且 Postfix 服务已经启动:
- 运行 getenforce 命令,确认 SELinux 是否在 enforcing 模式下运行:
~]$ getenforce Enforcing
当 SELinux 处于 enforcing 模式时,命令会返回Enforcing
。 - 以 root 用户身份输入以下命令来启动
postfix
:~]# systemctl start postfix.service
确认 服务正在运行。输出中应包括以下信息(只有时间戳有所不同):~]# systemctl status postfix.service postfix.service - Postfix Mail Transport Agent Loaded: loaded (/usr/lib/systemd/system/postfix.service; disabled) Active: active (running) since Mon 2013-08-05 11:38:48 CEST; 3h 25min ago
- 运行以下命令来查看
postfix
进程:~]$ ps -eZ | grep postfix system_u:system_r:postfix_master_t:s0 1651 ? 00:00:00 master system_u:system_r:postfix_pickup_t:s0 1662 ? 00:00:00 pickup system_u:system_r:postfix_qmgr_t:s0 1663 ? 00:00:00 qmgr
在上面的输出中,与 Postfixmaster
进程关联的 SELinux 上下文为system_u:system_r:postfix_master_t:s0
。上下文的第二个最后一个部分postfix_master_t
是此进程的类型。类型定义进程的域以及文件的类型。在这种情况下,master
进程在postfix_master_t
域中运行。