Chinaunix首页 | 论坛 | 博客
  • 博客访问: 705408
  • 博文数量: 181
  • 博客积分: 2548
  • 博客等级: 少校
  • 技术积分: 1739
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-29 16:36
个人简介

爱咋咋地

文章分类

全部博文(181)

文章存档

2023年(17)

2022年(19)

2021年(3)

2020年(1)

2018年(1)

2017年(1)

2014年(1)

2013年(4)

2012年(11)

2011年(19)

2010年(22)

2009年(71)

2008年(5)

分类: LINUX

2009-08-18 11:41:10

  • COMPILE CONFIG:

1.openssl:

./config --prefix=/usr --openssldir=/usr/local/openssl

2.BerkeleyDB-4.7.25

 ../dist/configure --prefix=/usr

3.cyrus-sasl:
./configure --enable-checkapop --enable-login --enable-auth-sasldb
 
注意:
1).因为cyrus-sasl-2.1.23 现在的configure只支持到db-4.4,而rhel5.3里面内置了db-4.3,并且放在了/lib下,所以就算是装了bdb-4.7,链接时也会链接到bdb-4.3。这也许还不够得上一个bug,谁让rhel5.3内置bdb-4.3那,但最好还是能像(cyrus-imap里面一样,添加一个 --with-bdb 的配置选项,那样比较智能了)
改正方法:用 find .|xargs grep db-4.3,然后会查到很多configure或者.m4文件,在每个for后面都添加上db-4.7,大概修改7-8个文件,然后再configure就可以了。
2).--enable-auth-sasldb这个选项在根目录下configure --help中并没有说明,是在saslauthd中的configure --help中提示的,如果不加这个选项将不能用bdb(也就是/etc/sasldb2)作为用户认证数据库来用。
3)。Reportedly, Microsoft Outlook (Express) requires the non-standard LOGIN authentication method. To enable this authentication method, specify ``./configure --enable-login''
 
make;make install完就可以测试了,
1。用saslpasswd2 -c 来创建一个用户。
2.用sasldblistusers2 来dump出用户名来看是否一致
3.saslauthd 是个认证服务程序,运行:saslauthd -a sasldb
4.用testsaslauthd -u -p 来测试,如果都成功,就成功了。
如果不成功,错误日志在/var/log/message中
4.cyrus-imap:
./configure --with-bdb=db-4.7 --with-openssl=/usr/local/openssl
 
make; make install
然后进入perl/imap目录 ,按照README来做
        perl Makefile.PL
        make
        make test       # or see below
        make install
make test 没弄明白是什么,可以不做啦
 
 
然后添加cyrus用户,并且设置密码:useradd cyrus;passwd cyrus
然后用saslpasswd2 创建 cyrus用户,不然会出现后面的错误的。
saslpasswd2  cyrus
 
创建/etc/imap.conf配置文件,内容从cyrus-imap主页上抄的.
   configdirectory: /var/imap
   partition-default: /var/spool/imap
   admins: curtj abell
   sasl_pwcheck_method: saslauthd
然后拷贝master/normal.conf 为/etc/cyrus.conf

在用cyrus -u cyrus localhost
>cm user.
千万记住前面的user. 不然很麻烦
 
4.postfix
1). make tidy
2). make makefiles CCARGS="-DHAS_MYSQL -DHAS_DB -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -DUSE_TLS -I/usr/include/sasl/ -I/usr/include/mysql " AUXLIBS="-L/usr/local/lib/sasl2 -lsasl2 -ldb-4.7 -lssl -lcrypto -L/usr/lib/mysql -lmysqlclient -lz -lm"
3). make
 
 
小心系统自带的saslauthd,系统自带的这个版本(我的是22)用的本地socket是/var/run/saslauthd/mux,
而自己编译的saslauthd和libsasl2用的是/var/state/saslauthd/mux,如果弄混了就会出现连不上的情况。
chmod 666 /etc/sasldb2
 
这个文件是smtpd的认证配置文件,有些文档里面写的应该放在/usr/lib/sasl/目录下,这样也可以,cyrus-sasl2的源码中明确说明了新版本的默认搜索目录变为/usr/lib/sasl2:/etc/sasl2。
/etc/sasl2/smtpd.conf
 
smtpd.conf的内容:
pwcheck_method: saslauthd
mech_list: plain login
 
5.php5:
./configure --prefix=/usr/local/php --with-apxs2=/usr/ali/apache2/bin/apxs --enable-gd-native-ttf -with-zlib --enable-magic-quotes --with-iconv --enable-mbstring --enable-ftp --with-pear=/usr/local/php/pear  --with-gettext --with-imap=/root/mail/IMP/imap-2007e --with-imap-ssl --with-gd --with-mcrypt --with-openssl --with-mysql=/usr/local/include/mysql --with-mime-magic

  • ISSUE:
1._sasldb_getkeyhandle has failed
我遇到的问题是因为bdb版本不兼容问题,虽然在configure配置的是dbd-4.7,但实际上链接的是bdb-4.3(rhel5.3自带bdb4.3)。解决方法是把/lib和/usr/lib下的有关libbdb-4.3的文件都删掉
 
2.ERR: USER command only available under a layer
在/etc/imap.conf中添加:
allowplaintext:yes
 
3.cyradm不能登陆,在/var/log/message中出现 “unable to tell master 1/2/3 : Broken pipe”和“perl: No worthy mechs found”错误提示
在/etc/imap.conf中添加
sasl_mech_list: PLAIN
4.Jun 17 05:01:43 localhost postfix/master[22271]: warning: process /usr/libexec/postfix/smtpd pid 22307 killed by signal 11
Jun 17 05:01:43 localhost postfix/master[22271]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
这个问题应该是postfix在编译的时候包含进去的sasl.h头文件和所链接的库文件不匹配造成的,rhel系列的系统的/usr/include/sasl.h为1.5.xx版本的,而在编译是指定了-lsasl2 则是sasl2.x.xx版本的,直接造成堆栈异常访问造成了smtpd的segmentation fault。解决方法是制定sasl2版本的头文件,这个文件在/usr/include/sasl/目录内
5.delivery failed to mailbox /var/mail/vhosts/example.com/test: error writing message: File too large
这个问题网上说的很多,大多数都是说设置“mailbox_size_limit = 0”,这么说是没错的,但应该区分是否是虚拟域用户,如果这条错误是对虚拟域用户爆出来的,应该设置virtual_mailbox_limit = 0。mailbox_size_limit配置项对虚拟域用户是不起作用的。
3.IMAP Password:
先给系统的cyrus账户添加密码,passwd cyrus
再给imap中的cyrus账户添加密码,saslpasswd2 cyrus
6.pear.php.net is using a unsupported protocal - This should never happen.
进入到php中pear的安装目录也就是/usr/local/php/pear中把.channels 删除或者改名。然后运行pear update-channels ,应该就可以了
  • CONFIG FILE

1.Cyrus-imap:

/etc/cyrus.conf
/etc/imapd.conf

2.Cyrus-sasl:

Postfix command:
postsuper -d 删除发送队列中的邮件 当message-id为ALL时为删除全部
postconf -n
 
 
  Cyrus 被设计成在一台不允许一般用户登录的服务器上运行. Cyrus 也被认为是 Unix 上的两个最普遍的 IMAP 服务器之一. 另一个是华盛顿大学的 IMAP 服务器.
  [3]ftp://ftp.cac.washington.edu/imap/imap.tar.Z
 
 
 
postfix配置:

1.最简单的系统:本机投递
main.cf:
mydomain=
mydestination=$mydomain
 
2.进阶系统:虚拟域
main.cf:
mydomain=
mydestination=$mydomain
virtual_mailbox_domains = alimail_v1.com
virtual_mailbox_base = /var/mail/vhosts
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_maps = mysql:/etc/postfix/vmailbox.sql
vmailbox.sql:
user = root
password =
dbname = postfix
query = SELECT vmailbox FROM vmailbox_table WHERE vuser='%s'
In mysql:
mysql> create database postfix;
mysql> use postfix;
mysql> create table vmailbox_table ( vuser varchar(255) not null, vmailbox varchar(1024) not null );
mysql> insert into vmailbox_table(vuser , vmailbox ) value("");
mysql> select * from vmailbox_table;
bash:
# mkdir /var/mail/vhosts
# chmod 755 /var/mail/vhosts/
# postfix reload
然后就可以用mutt进行虚拟域测试了
 
3.smtp认证
smtpd_sasl_path = smtpd
smtpd_sasl_auth_enable  = yes
=
       
       
       
#smtpd_recipient_restrictions = permit_mynetworks
#                               permit_sasl_authenticated
#                               permit_auth_destination
#                               reject
smtpd_sasl_security_options = noanonymous
 
smtpd的配置文件:
/etc/sasl2/smtpd.conf:
pwcheck_method: saslauthd
mech_list: plain login
当smtpd的配置文件不存在时默认使用libsasl库函数直接通过读取/etc/sasldb2数据进行校验。
 
 
saslpasswd2 -u alimail.com -c test
阅读(4425) | 评论(0) | 转发(0) |
0

上一篇:“手指计数”引发的思考

下一篇:Postfix

给主人留下些什么吧!~~