如何禁用SMTP明文身份validation,以坚持OS X 10.10 Yosemite的Server.app

我有一个SMTP中继服务器,最近我用运行Server.app的OS X 10.10 Yosemite取代。 它作为仅允许SMTP的中继运行,只允许来自局域网的主机通过它中继出去。 我们这样做是为了使我们的子网中的所有邮件都正确地从我们的域的经过validation的主机发送给发件人策略框架(SPF)等。

configuration中继很容易。 继苹果公司关于在OS X服务器上禁用邮件服务的文档,我做了以下工作:

sudo serveradmin settings mail:global:skip_enable_service_check = yes sudo serveradmin settings mail:imap:enable_imap = no sudo serveradmin settings mail:imap:enable_pop = no sudo serveradmin settings mail:imap:enable_sieve = no sudo serveradmin stop mail sudo serveradmin start mail 

这确保只有SMTP正在运行,并保持重新启动或重新启动邮件服务后的情况。 由于SMTP中继服务器的主机名是其中继的域中的子域,我还必须修改/Library/Server/Mail/Config/postfix/main.cf以从“mydestination”中删除$myhostname$mydomain ,结果行是如下:

 mydestination = localhost.$mydomain, localhost 

这也工作,Server.app识别并保留更改(通过运行sudo serveradmin settings mail:postfix )。 调整mynetworks行来限制接受中继的子网也是如此。

我遇到的问题是修改smtpd_pw_server_security_options行(特别是删除LOGINPLAIN身份validationtypes)将不会坚持和恢复到默认(其中包括不需要的明文身份validationtypes)启动邮件服务时。 Apple 在Mac OS X Server中关于Apple特定后缀选项的文档意味着跳过LOGINPLAIN选项应该是有效的。

我努力了:

  1. 前面对/Library/Server/Mail/Config/postfix/main.cf smtpd_pw_server_security_options修改
  2. 正如在苹果特定的后缀选项文档中提到的,运行sudo serveradmin settings mail:postfix:smtpd_use_pw_server = nomail:postfix:smtpd_use_pw_server似乎是Yosemite下的一个空字典)
  3. 运行sudo serveradmin settings postfix:smtp_sasl_auth_enable = yes (在Yosemite下它默认为'no',所以我假设苹果只是从上面的mail:postfix:smtpd_use_pw_server调用了这个选项的functionmail:postfix:smtpd_use_pw_server选项)
  4. 使用serveradminmail:postfix:smtpd_pw_server_security_options删除loginplain元素mail:postfix:smtpd_pw_server_security_options数组(例如sudo serveradmin settings mail:postfix:smtpd_pw_server_security_options:_array_index:2 = delete ),但正如Charles Edge在他的激动人心的博客文章中提到的有关删除serveradmin设置“在OS X服务器的条目 ,function似乎被打破。 而且,这些设置不会在/Library/Server/Mail/Config/MailServicesOther.plist或任何其他.plist中镜像,因此手动修改这些设置似乎不是一个选项。

我通过切换明文身份validation设置从一个部分选定的checkbox(大概是因为IMAP被禁用)到一个完全取消selectcheckbox暂时使用Server.app,但它是不一致的,重新启动邮件服务后不坚持禁用明文身份validation。

任何build议或解决scheme将不胜感激,除了build议不要在OS X上使用Server.app。这是一个全苹果店,必须狗粮食苹果产品的原因,我不能在这里进入。 当然,启用明文auth也不是明显的安全和PCI DSS遵从性原因的选项。

我可以 – 与一些futzing – 通过Server.app获取SMTP明文auth禁用,虽然它不能坚持得很好(当然不能幸免于重新启动或重新启动的邮件服务,有时甚至迷失了,而徘徊在Server.app中)。 我意识到,作为临时解决方法,我至less可以自动通知“PLAIN”和“LOGIN”纯文本SMTPauthentication是否被重新启用。

我鞭打下面这个快速的bash脚本来完成这个工作:

 #!/bin/bash # # smtp_plaintext_auth_check - check to see if plaintext auth is supported by SMTP service and warn if it is # # v0.1 2015-03-12 - Morgan Aldridge <http://serverfault.com/users/13496/morgant> # Initial version. # admin_emails="[email protected]" debug=false host=$(hostname) date=$(date +%Y-%m-%d-%H%M) plaintext_auth_enabled=false # check via serveradmin to see if plaintext auth is allowed by the SMTP server if $debug; then echo "Checking Mail service to see if SMTP plaintext auth is supported..."; fi while IFS= read -r line; do if [[ "$line" =~ (plain|login) ]]; then if $debug; then echo " Found '${BASH_REMATCH[1]}' SMTP auth method which is plaintext!"; fi plaintext_auth_enabled=true fi done <<< "$(serveradmin settings mail:postfix:smtpd_pw_server_security_options)" # if plaintext auth is enabled, notify admins if $plaintext_auth_enabled; then if $debug; then echo "Notifying admins via email that SMTP plaintext auth IS supported. That's bad!"; fi mail -s "Error on $host: SMTP plaintext auth is allowed! $date" $admin_emails <<-EOM ERROR on $host: SMTP plaintext auth appears to be allowed by the Mail service! This is a security risk and against PCI DSS compliance! Please resolve ASAP! EOM else if $debug; then echo "Phew, SMTP plaintext auth doesn't appear to be supported. That's good."; fi fi 

同样,这是一个解决方法 ,我更愿意以编程方式禁用SMTP明文身份validation。