我目前正在部署另一个Postfix MTA,这次我想减lessmaster.cf并禁用不需要的服务来减less潜在的攻击面,并在此过程中更好地理解它。
MTA应该收到虚拟用户的电子邮件,将它们交付给合适的maildir,最后从经过validation的用户转发邮件。
切换到OpenSMTPd(用我的整个configuration可以在一个单一的15行文件中)是不可能的,因为现在(没有更多的支持),所以我坚持使用Postfix。
有问题的恐怖:
# ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (no) (never) (100) # ========================================================================== smtp inet n - n - - smtpd #submission inet n - n - - smtpd pickup unix n - n 60 1 pickup cleanup unix n - n - 0 cleanup qmgr unix n - n 300 1 qmgr tlsmgr unix - - n 1000? 1 tlsmgr rewrite unix - - n - - trivial-rewrite bounce unix - - n - 0 bounce defer unix - - n - 0 bounce trace unix - - n - 0 bounce verify unix - - n - 1 verify flush unix n - n 1000? 0 flush proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap smtp unix - - n - - smtp relay unix - - n - - smtp showq unix n - n - - showq error unix - - n - - error retry unix - - n - - error discard unix - - n - - discard local unix - nn - - local virtual unix - nn - - virtual lmtp unix - - n - - lmtp anvil unix - - n - 1 anvil scache unix - - n - 1 scache
没有任何描述最小configuration的手册页,并且每个服务的手册页并没有真正地说明是否需要一个模块(对于某些人来说很容易弄清楚,对其他人来说,无尽的试验和错误)。
我目前失败的尝试是以下(提交端口省略,现在我只是试图让邮件传递工作):
smtp inet n - - - - smtpd cleanup unix n - - - 0 cleanup qmgr unix - - - 300 1 qmgr rewrite unix - - - - - trivial-rewrite proxymap unix - - - - - proxymap virtual unix - n - - - virtual anvil unix - - - - 1 anvil local unix - n - - - local
这有点作用,除了所有收到的邮件只有在重新启动Postfix交付(maildir),我敢肯定它是不完整的,不能处理反弹,所以我仍然在寻找答案。
我并不build议你从默认的 master.cf中删除服务。 当您尝试极简configuration时,您已经被它咬了。
为什么postfix有很多服务的一个原因是安全性 。 其中一个优势是postfix通过单独的守护进程/服务运行来完成特定的任务。 所以,postfix master可以调整每个postfix服务的权限和权限。 例如qmgr(8)守护进程不会与外界通信,并且可以在chrooted环境中以固定的低权限运行。
无论如何,我没有时间做无休止的尝试和错误,以了解什么是可以禁用的后缀服务。 所以我给你一些关于一些服务的信息,并把它分成几组。
# INPUT SERVICE smtp inet n - n - - smtpd #submission inet n - n - - smtpd pickup unix n - n 60 1 pickup # PROCESSING SERVICE cleanup unix n - n - 0 cleanup qmgr unix n - n 300 1 qmgr rewrite unix - - n - - trivial-rewrite # OUTPUT SERVICE error unix - - n - - error retry unix - - n - - error discard unix - - n - - discard local unix - nn - - local virtual unix - nn - - virtual lmtp unix - - n - - lmtp smtp unix - - n - - smtp relay unix - - n - - smtp # HELPER # Generate bounce bounce unix - - n - 0 bounce defer unix - - n - 0 bounce trace unix - - n - 0 bounce # For postfix recipient/sender verification See www.postfix.org/ADDRESS_VERIFICATION_README.html verify unix - - n - 1 verify # Outgoing Connection manager scache unix - - n - 1 scache # TLS Cache Manager tlsmgr unix - - n 1000? 1 tlsmgr # maintains statistics about client connection counts or client request rates anvil unix - - n - 1 anvil # Needed by mailq command showq unix n - n - - showq # Needed by postqueue -f flush unix n - n 1000? 0 flush # Proxymap proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap