邮件服务器Postfix+LDAP验证--FAQ

Written by ray on 2008/01/10 14:03
| |
最近在搭建邮件服务器,其包括Postfix, Amavisd-new, ClamAV, ExtMail 和ExtMan, Courier系列软件,数据库用的是LDAP。搭建方法具体网上也有介绍,也就重复了,这里只是遇到的一些问题和解决方案,给遇到相同问题的人一些参考。
FAQ
1.authldap.so 模块在courier-authlib-ldap包里,这个包在EMOS的iso里有
2.10024端口是amavisd端口
3.原来是在main.cf文件中myhostname与mydomain不能一样,要不然
虚拟域和main.cf中设的域名一样就会出现问题:
myhostname = xxx.com.cn
mydomain = xxxx.com.cn
修改如下:
myhostname = mail.xxx.com.cn
mydomain = xxxx.com.cn

4.authldap: TEMPFAIL - no more modules will be tried
5.authldaplib: refuse to authenticate abc@glfsoft.com: uid=0, gid=0 (zero uid or gid not permitted)
文本格式问题,字段前面不要用空格,uid gid 用数字(如:1000)
authmysqlrc authldaprc
注意:确认在这个文件中不能用空格键,只能用tab键。
确认只使用单引号,比如:'/var/mailbox/','UID','GID'
localhost不能用单引号
确认你的/etc/hosts文件中有localhost
编译时如果支持Ipv6可能导致错误
MYSQL_GID_FIELD 和MYSQL_UID_FIELD是maildrop的UID和GID,而不是MySQL的。
如果想使用md5密码,把MYSQL_CLEAR_PWFIELD password改成MYSQL_CRYPT_PWFIELD password

6.Jan  9 13:35:47 ray postfix/smtpd[11946]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Jan  9 13:35:47 ray postfix/smtpd[11946]: warning: cannot get certificate from file /etc/postfix/ssl/glfmailcert.pem
Jan  9 13:35:47 ray postfix/smtpd[11946]: warning: TLS library problem: 11946:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:644:Expecting: CERTIFICATE:
Jan  9 13:35:47 ray postfix/smtpd[11946]: warning: TLS library problem: 11946:error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib:ssl_rsa.c:727:
Jan  9 13:35:47 ray postfix/smtpd[11946]: cannot load RSA certificate and key data
证书生成有问题,重新生成

7.extman的验证码无法显示的问题 google一下这个包
rpm -ivh perl-GD-2.35-1.el5.rf.i386.rpm

8.warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory
/etc/postfix/main.cf 文件格式 /usr/lib/sasl2/smtpd.conf 格式 (smtp用的是courier的smtp)

9.给smtp加密
分三个步骤
一.创建证书
1.自己创建 CA
/etc/pki/tls/misc
./CA -newca
2.产生服务器端证书
openssl req -new -nodes -keyout mailkey.pem -out mailreq.pem -days 365

-new表示你想产生公私钥与CSR
-nodes表示选项不加密
-keyout 表示私钥文件
-out 表示CSR文件

签发证书
openssl ca -out mail_signed_cert.pem -infiles mailreq.pem

至此一个证书就制作成功了
考虑到私钥的重要性,还需要做相关设置
chown root mailkey.pem
chmod 400 mailkey.pem

二.编辑main.cf文件
smtpd_tls_auth_only = no
smtp_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtp_tls_session_cache_database = btree:/var/spool/postfix/smtp_tls_session_cache
smtp_use_tls = yes
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_cert_file = /etc/postfix/ssl/tanocert.pem
smtpd_tls_key_file = /etc/postfix/ssl/tanokey.pem
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = btree:/var/spool/postfix/smtpd_tls_session_cache
tls_random_source = dev:/dev/urandom
# Postfix 2.3 and later
smtpd_tls_security_level = may
# Obsolete, but still supported
smtpd_use_tls = yes

三.编辑master.cf

smtps     inet  n       -       n       -       -       smtpd -v
 -o smtpd_tls_wrappermode=yes
 -o smtpd_sasl_auth_enable=yes
 -o smtpd_client_restrictions=permit_sasl_authenticated,reject

验证
telnet localhost 25
echo mailserver.com
STARTTLS
如果出现
220 2.0.0 Ready to start TLS
说明配置成功

pop3的证书使用courier-imap自带的mkpop3dcert来制作

其他说明:
打开smtpd的debug功能,master.conf中, smtpd -v
打开authdaemon的debug功能,在authdamonrc
Tags: , ,
系统 » Linux | 评论(0) | 引用(0) | 阅读(747)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]