Linux操作系统邮件服务器的搭建过程解析
2008-03-05
eNet&Ciweek
7)SMTP的配置
为了告诉postfix采用sasl来进行SMTP的用户认证,我们必须在/etc/postfix/main.cf文件的最后添加以下几行:
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_sasl_authenticated
permit_auth_destination reject
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
说明如下:
smtpd_sasl_auth_enable:告诉SMTP客户,该SMTP服务器需要进行用户认证。
smtpd_recipient_restrictions = permit_sasl_authenticated
permit_auth_destination reject
仅仅中继通过SMTP认证的客户端邮件,以及接收本postfix为最后一站的邮件。
broken_sasl_auth_clients = yes
有一些Microsoft 的SMTP客户端,比如Outlook Express 4.X采用的是非标准的SMTP认证协议,将该选项设置为yes可以解决这类不兼容问题。
smtpd_sasl_security_options = noanonymous
控制本地SMTP认证所采用的机制,这里是允许任何非匿名认证方法。
9.配置SASL
进入/usr/lib/sasl/目录,用touch新建这样一个文件:
[root@test sasl]# touch smtpd.conf
在该文件中加入以下内容:
[root@test sasl]# more smtpd.conf
pwcheck_method:pam
也就是指定通过PAM来进行用户认证。
10.配置PAM
进入/etc/pam.d/目录,用touch新建这样一个文件:
[root@test pam.d]# touch smtp
在该文件中加入如下内容:
[root@test pam.d]# more smtp
#%PAM-1.0
auth required /lib/security/pam_stack.so service=system-auth
account required /lib/security/pam_stack.so service=system-auth
也即和/etc/pam.d/pop文件的内容是一致的。
11.修改/etc/shadow文件权限
因为PAM最终要去读取/etc/shadow文件的内容来进行用户认证,但是/etc/shadow文件
权限是设置为只有root用户可以读写,而我们的postfix是运行在postfix用户权限之下,所以我们要合理的设置/etc/shadow文件权限,以便让pam可以读取其内容。
执行以下命令,让root组也可以读取shadow:
[root@test /etc]# chmod 640 /etc/shadow
然后再将postfix用户加入root组,采用以下命令:
[root@test /etc]# usermod -G root postfix
12.编辑postfix的主要配置文件/etc/postfix/master.cf
# ========================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ========================================
smtp inet n - n - - smtpd
这里开始
#smtps inet n - n - - smtpd
# -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#submission inet n - n - - smtpd
# -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
这里结束
#628 inet n - n - - qmqpd
把我标的注释部分去掉即可。
13.配置pop3
RedHat7.0已经使用xinetd代替了以前的inetd,为了使pop3服务启动,我们编辑
/etc/xinetd.d/ipop3文件,将其中的disable = yes改为disable = no 以便启动pop3
服务。
为了使改动生效,执行以下命令:
/etc/rc.d/init.d/xinetd reload
14.启动postfix
执行以下命令启动postfix:
/etc/rc.d/init.d/postfix start
这样,一个支持SMTP认证的postfix邮件服务器就配好了。
您对本文或本站有任何意见,请在下方提交,谢谢!