[精华] 【原创】postfix(ldap)邮件系统

来源:互联网 发布:java中无法加载主类 编辑:程序博客网 时间:2024/05/21 09:22

 


http://www.chinaunix.net 作者:anstan  发表于:2007-05-25 11:47:27【发表评论】【查看原文】【Mail服务器讨论区】【关闭
RHAS4+postfix+cyrus-sasl+ldap+courier-imap+courier-maildrop+jamm+squirrelmail


转载请注明出处
2005年7月24日完成

1.openldap

2.cyrus-sasl

3.postfix

4.courier-authlib

5.courier-imap

6.courier-maildrop

7.管理工具 

8.测试 

9.webmail 


实现功能:smtp认证、pop3和imap、虚拟域和虚拟用户、web管理用户(phpldapadmin+jamm)、webmail(squirrelmail)、邮箱quota

创建vmail用户和组 
# groupadd vmail -g 5000 
# useradd vmail -u 5000 -g 5000 -s/sbin/nologin -d/dev/null 
# mkdir /var/mailbox 
# chown vmail:vmail /var/mailbox
# chmod -R ug+rwx,o-rwx /var/mailbox

1.安装openldap 2.2.26
# wget ftp://ftp.openldap.org/pub/OpenLDAP/openldap-stable/openldap-stable-20050429.tgz
# tar zxvf openldap-stable-20050429.tgz
# cd openldap-2.2.26
# ./configure --prefix=/usr/local/openldap --enable-ldbm=yes --enable-bdb=no --enable-ipv6=no
# make depend 
# make 
# make test 
# make install

# wget http://jaist.dl.sourceforge.net/sourceforge/jamm/jamm-0.9.7-rc1.tar.gz
# tar zxvf jamm-0.9.7-rc1.tar.gz
# cp jamm-0.9.7-rc1/src/schema/jamm.schema /usr/local/openldap/etc/openldap/schema/

先获得rootpw的加密密码,注意每次都不一样。你也可以用明文的
# /usr/local/openldap/sbin/slappasswd
New password: 12345 
Re-enter new password: 12345 
{SSHA}eBmoJWzMhMGgC48iqHHQyX4Q4CGhzZxO

# vi /usr/local/openldap/etc/openldap/slapd.conf
include         /usr/local/openldap/etc/openldap/schema/core.schema
include         /usr/local/openldap/etc/openldap/schema/cosine.schema
include         /usr/local/openldap/etc/openldap/schema/nis.schema
include         /usr/local/openldap/etc/openldap/schema/jamm.schema

allow bind_v2

pidfile /usr/local/openldap/var/run/slapd.pid
argsfile /usr/local/openldap/var/run/slapd.args

database ldbm
directory /usr/local/openldap/var/openldap-data
suffix "dc=test,dc=com"

rootdn "cn=Manager,dc=test,dc=com"
rootpw {SSHA}eBmoJWzMhMGgC48iqHHQyX4Q4CGhzZxO
#rootpw 12345 

index objectClass pres,eq
index mail,cn eq,sub

access to dn.regex=".*,jvd=([^,]+),o=hosting,dc=test,dc=com"
      attr=userPassword
    by self write
    by group/jammPostmaster/roleOccupant.expand="cn=postmaster,jvd=$1,o=hosting,dc=test,dc=com" write
    by anonymous auth
    by * none

access to dn.regex=".*jvd=([^,]+),o=hosting,dc=test,dc=com"
    by self write
    by group/jammPostmaster/roleOccupant.expand="cn=postmaster,jvd=$1,o=hosting,dc=test,dc=com" write
    by * read

access to *
    by * read

启动ldap
# /usr/local/openldap/libexec/slapd -d 256
出现slapd starting说明启动成功了,建议调试的时候以这种方式启动dlap

# vi /usr/local/openldap/etc/openldap/base.ldif
dn: dc=test, dc=com
objectClass: top
objectClass: domain
domainComponent: test

dn: cn=Manager, dc=test, dc=com
objectClass: top
objectClass: organizationalRole
cn: Manager

dn: o=hosting, dc=test, dc=com
objectClass: top
objectClass: organization
o: hosting

# /usr/local/openldap/bin/ldapadd -x -D "cn=Manager,dc=test,dc=com" -W -f /usr/local/openldap/etc/openldap/base.ldif
Enter LDAP Password:12345
adding new entry "dc=test, dc=com"
adding new entry "cn=Manager, dc=test, dc=com"
adding new entry "o=hosting, dc=test, dc=com"

2.安装cyrus-sasl 2.1.21
as4默认已经安装了,给它改个文件名吧,如果把rpm包删除之后配置跟我的肯定不一样
# mv /usr/lib/sasl /usr/lib/sasl.OFF
# mv /usr/lib/sasl2 /usr/lib/sasl2.OFF

编译安装cyrus-sasl2.1.21
# wget ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.21.tar.gz
# tar zxvf cyrus-sasl-2.1.21.tar.gz
# cd cyrus-sasl-2.1.21

密码验证方式为saslauthd编译方法 
# ./configure --disable-anon -enable-plain --enable-login --enable-ldapdb --with-ldap=/usr/local/openldap --with-saslauthd=/var/run/saslauthd --sysconfdir=/etc
密码验证方式为authdaemond的编译方法
# ./configure --disable-anon -enable-plain --enable-login --enable-ldapdb --with-ldap=/usr/local/openldap --with-authdaemond=/usr/local/var/spool/authdaemon/socket

# make
# make install

为了让postfix能找到sasl,请运行如下命令:
# echo "/usr/local/lib" >;>; /etc/ld.so.conf
# ldconfig

# ln -s /usr/local/lib/sasl2 /usr/lib/sasl2

密码验证方式为saslauthd的配置方法
# vi /usr/local/lib/sasl2/smtpd.conf
pwcheck_method: saslauthd
mech_list: login plain

# vi /etc/saslauthd.conf
ldap_servers: ldap://127.0.0.1
ldap_search_base: o=hosting,dc=test,dc=com
ldap_filter: (&(objectClass=JammMailAccount)(mail=%u@%r)(accountActive=TRUE)(delete=FALSE))

# vi /etc/sysconfig/saslauthd 
MECH=ldap

密码验证方式为auxprop的配置方法(计划中)

密码验证方式为authdaemond的配置方法
# vi /usr/local/lib/sasl2/smtpd.conf 
pwcheck_method:authdaemond
log_level:3
mech_list:PLAIN LOGIN
authdaemond_path: /usr/local/var/spool/authdaemon/socket

3.安装postfix 2.2.4
如果你的系统上原来有sendmail,先将其停止并将其文件改名:
# /etc/init.d/sendmail stop
# chkconfig --level 0123456 sendmail off
# mv /usr/bin/newaliases /usr/bin/newaliases.orig
# mv /usr/bin/mailq /usr/bin/mailq.orig
# mv /usr/sbin/sendmail /usr/sbin/sendmail.orig

开始安装
# groupadd -g 12345 postfix
# useradd -u 12345 -g 12345 -c postfix -d/dev/null -s/sbin/nologin postfix
# groupadd -g 54321 postdrop
# wget ftp://postfix.cn99.com/postfix/official/postfix-2.2.4.tar.gz
# tar -zxvf postfix-2.2.4.tar.gz
# cd postfix-2.2.4
# echo /usr/local/openldap/lib >;>; /etc/ld.so.conf 
# ldconfig 
# make -f Makefile.init makefiles \
'CCARGS=-DHAS_LDAP -I/usr/local/openldap/include -DUSE_SASL_AUTH -I/usr/local/include/sasl' \
'AUXLIBS=-L/usr/local/openldap/lib -lldap -llber -L/usr/local/lib -lsasl2' 
# make install 

# vi /etc/postfix/main.cf
#=====================BASE========================= 
myhostname = www.test.com 
mydomain = test.com 
myorigin = $mydomain 
mydestination = $myhostname localhost localhost.$mydomain 
mynetworks = 127.0.0.0/8 
inet_interfaces = all 

virtual_mailbox_base = /var/mailbox 
virtual_minimum_uid = 5000 
virtual_uid_maps = static:5000 
virtual_gid_maps = static:5000 

#virtual_transport = virtual
virtual_transport = maildrop
maildrop_destination_recipient_limit = 1

virtual_mailbox_domains = ldap:domains
virtual_maps = ldap:aliases, ldap:accountsmap
virtual_mailbox_maps = ldap:accounts 

domains_server_host = localhost 
domains_search_base = o=hosting,dc=test,dc=com 
domains_query_filter = (&(objectClass=JammVirtualDomain)(jvd=%s)(accountActive=TRUE)(delete=FALSE)) 
domains_result_attribute = jvd 
domains_bind = no 
domains_scope = one

aliases_server_host = localhost 
aliases_search_base = o=hosting,dc=test,dc=com 
aliases_query_filter = (&(objectClass=JammMailAlias)(mail=%s)(accountActive=TRUE)) 
aliases_result_attribute = maildrop 
aliases_bind = no

accounts_server_host = localhost 
accounts_search_base = o=hosting,dc=test,dc=com 
accounts_query_filter = (&(objectClass=JammMailAccount)(mail=%s)(accountActive=TRUE)(delete=FALSE)) 
accounts_result_attribute = mailbox 
accounts_bind = no 

accountsmap_server_host = localhost 
accountsmap_search_base = o=hosting,dc=test,dc=com 
accountsmap_query_filter = (&(objectClass=JammMailAccount)(mail=%s)(accountActive=TRUE)(delete=FALSE)) 
accountsmap_result_attribute = mail 
accountsmap_cache = yes 
accountsmap_bind = no 

#============== ldap Quota ============ 
message_size_limit = 14336000
virtual_mailbox_limit_size = 20971520
virtual_mailbox_limit_override=yes 
virtual_maildir_extended = yes 
virtual_create_maildirsize = yes 

virtual_mailbox_limit_maps = ldap:quota
quota_server_host = localhost 
quota_search_base = o=hosting,dc=example,dc=com 
quota_query_filter = (&(&(objectClass=JammMailAccount)(mail=%s))(accountActive=TRUE)(delete=FALSE)) 
quota_result_attribute = quota 
quota_cache = no 
quota_bind = no 

#====================SASL======================== 
broken_sasl_auth_clients = yes
#In order to allow mail relaying by authenticated clients
smtpd_recipient_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_invalid_hostname,
  reject_non_fqdn_hostname,
  reject_unknown_sender_domain,
  reject_non_fqdn_sender,
  reject_non_fqdn_recipient,
  reject_unknown_recipient_domain,
  reject_unauth_pipelining,
  reject_unauth_destination,
  permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sasl_application_name = smtpd
smtpd_banner=$myhostname ESMTP "Version not Available"

启动postfix
# postfix start 

4.安装Courier-authlib 0.56
新版本的imap不再包含authentication library,必须先安装 Courier authentication library 
# wget http://www.courier-mta.org/beta/courier-authlib/courier-authlib-0.56.20050709.tar.bz2
# tar jxvf courier-authlib-0.56.20050709.tar.bz2
# cd courier-authlib-0.56.20050709
# ./configure \
--with-redhat \
--with-authldap=yes \
--with-mailuser=vmail --with-mailgroup=vmail
# make
# make install
# make install-configure

# vi /usr/local/etc/authlib/authdaemonrc
authmodulelist="authldap"
authmodulelistorig="authldap"

# vi /usr/local/etc/authlib/authldaprc
LDAP_SERVER    localhost 
LDAP_PORT 389 
LDAP_PROTOCOL_VERSION 3 
LDAP_BASEDN dc=test,dc=com 
LDAP_AUTHBIND 1 
LDAP_MAIL mail 
LDAP_FILTER (objectClass=JammMailAccount)(accountActive=TRUE)(delete=FALSE) 
LDAP_GLOB_UID vmail 
LDAP_GLOB_GID vmail 
LDAP_HOMEDIR homeDirectory 
LDAP_MAILDIR mailbox 
LDAP_DEFAULTDELIVERY defaultDelivery 
LDAP_MAILDIRQUOTA quota 
LDAP_FULLNAME cn
LDAP_CRYPTPW userPassword
#LDAP_CLEARPW clearPassword 
LDAP_DEREF never 
LDAP_TLS 0

注意:确认在这个文件中不能用空格键(包括行尾),只能用tab键

设置自启动
# cp courier-authlib.sysvinit /etc/rc.d/init.d/courier-authlib
# chmod 755 /etc/rc.d/init.d/courier-authlib
# chkconfig --level 0123456 courier-authlib on

手动启动服务:
# authdaemond start

测试courier-authlib
检查进程: 
# pstree |grep authdaemond 
|-authdaemond.mys---5*[authdaemond.mys]

5.安装Courier-imap 4.0.3
# wget http://www.courier-mta.org/beta/imap/courier-imap-4.0.3.20050702.tar.bz2
# tar jxvf courier-imap-4.0.3.20050702.tar.bz2
# cd courier-imap-4.0.3.20050702
# ./configure \
--prefix=/usr/local/imap \
--with-redhat \
--disable-root-check \
--enable-unicode=utf-8,iso-8859-1,gb2312,gbk,gb18030 \
--with-trashquota \
--with-dirsync
# make
# make install-strip (先install-strip,如果失败,再make install)
# make install-configure

# vi /usr/local/imap/etc/pop3d
将POP3DSTART=NO改为POP3DSTART=YES

# vi /usr/local/imap/etc/imapd
将IMAPDSTART=NO改为IMAPDSTART=YES

让imap自启动:
# cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imap
# chmod 755 /etc/rc.d/init.d/courier-imap
# chkconfig --level 0123456 courier-imap on
手动启动服务:
# /usr/local/imap/libexec/pop3d.rc start
# /usr/local/imap/libexec/imapd.rc start

测试courier-imap
检查进程:
# pstree |grep courier 
|-2*[courierlogger]
|-2*[couriertcpd]

检查端口,应该有如下端口打开:
# netstat -an |grep LISTEN
tcp  0  0 0.0.0.0:110  0.0.0.0:*  LISTEN
tcp  0  0 0.0.0.0:143  0.0.0.0:*  LISTEN

6.安装Courier-maildrop 1.8.1
# wget http://ufpr.dl.sourceforge.net/sourceforge/courier/maildrop-1.8.1.tar.bz2
# tar jxvf maildrop-1.8.1.tar.bz2
# cd maildrop-1.8.1
# ./configure \
--prefix=/usr/local/maildrop \
--enable-sendmail=/usr/sbin/sendmail \
--enable-trusted-users='root vmail' \
--enable-syslog=1 \
--enable-maildirquota \
--enable-maildrop-uid=5000 \
--enable-maildrop-gid=5000 \
--with-trashquota \
--with-dirsync
# make
# make install
# cp /usr/local/maildrop/bin/maildrop /usr/bin
# chmod a+rx /usr/bin/maildrop

运行maildrop -v应该有如下提示信息: 
maildrop 1.8.0 Copyright 1998-2004 Double Precision, Inc.
GDBM extensions enabled.
Courier Authentication Library extension enabled.
Maildir quota extension enabled.
This program is distributed under the terms of the GNU General Public
License. See COPYING for additional information.

新建/etc/maildroprc文件
# vi /etc/maildroprc
logfile "/var/mailbox/maildrop.log" 
to "$HOME/$DEFAULT"

# chmod a+r /etc/maildroprc

配置Postfix
# vi /etc/postfix/main.cf
virtual_transport = maildrop 
maildrop_destination_recipient_limit = 1 

# vi /etc/postfix/master.cf
maildrop unix - n n - - pipe 
flags=DRhu user=vmail:vmail argv=/usr/local/maildrop/bin/maildrop -w 90 -d ${recipient}

7.管理工具

安装apache 2.0.54 
# wget http://apache.freelamp.com/httpd/httpd-2.0.54.tar.bz2 
# tar jxvf httpd-2.0.54.tar.bz2 
# cd httpd-2.0.54 
# ./configure --prefix=/usr/local/apache 
# make 
# make install 

设置自启动 
# cp support/apachectl /etc/init.d/httpd 

修改/etc/init.d/httpd 
# vi /etc/init.d/httpd (前面部分修改成这样) 
#!/bin/sh 

# Startup script for the Apache Web Server 
# chkconfig: - 85 15 
# description: Apache is a World Wide Web server. It is used to serve \ 
# HTML files and CGI. 
# processname: httpd 
# pidfile: /usr/local/apache/log/httpd.pid 
# config: /usr/local/apache/conf/httpd.conf 

# chkconfig --add httpd 
# chmod 755 /etc/init.d/httpd 
# chkconfig httpd on

# vi /usr/local/apache/conf/httpd.conf
DocumentRoot "/var/www" 
<Directory "/var/www">; 
Options Indexes FollowSymLinks 
AllowOverride None 
Order allow,deny
Allow from all 
</Directory>;
User vmail
Group vmail

创建web根目录
# mkdir /var/www 

启动服务
# /usr/local/apache/bin/apachectl start 
或 
# service httpd start

安装jamm

安装jdk
从sun网站下载(下载页面)j2sdk-1_4_2_08-linux-i586.bin,下载前要注册
# chmod 755 j2sdk-1_4_2_08-linux-i586.bin
# ./j2sdk-1_4_2_08-linux-i586.bin
# mv j2sdk1.4.2_08 /usr/local
# ln -s /usr/local/j2sdk1.4.2_08 /usr/local/j2sdk

安装resin
# wget http://www.caucho.com/download/resin-3.0.14.tar.gz
# tar zxvf resin-3.0.14.tar.gz
# mv resin-3.0.14 /usr/local/j2sdk

设置JDK变量环境
# vi /etc/profile 
JAVA_HOME=/usr/local/j2sdk
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
CLASSPATH=.:$JAVA_HOME/lib
export PATH JAVA_HOME CLASSPATH

# source /etc/profile

启动resin
# /usr/local/j2sdk/resin-3.0.14/bin/httpd.sh start

现在就能够从http://192.168.1.100:8080上能看到resin的页面,这也就表示单独的resin运行成功了。然后,为了整合resin和apache,我们需要重新编译一下,以生成mod_caucho给apache调用
# cd /usr/local/j2sdk/resin-3.0.14/
# ./configure --with-apache=/usr/local/apache
# make 
# make install

安装配置jamm
# mkdir /var/www/jamm
# wget http://peterhost.dl.sourceforge.net/sourceforge/jamm/jamm-0.9.6-bin.tar.gz
# tar zxvf jamm-0.9.6-bin.tar.gz
# mkdir /var/www/jamm 
# cp jamm-0.9.6/jamm-0.9.6.war /var/www/jamm/
# cd /var/www/jamm
# jar -xf jamm-0.9.6.war
# cd WEB-INF/
# cp jamm.properties.dist jamm.properties
# vi jamm.properties
jamm.ldap.search_base = o=hosting,dc=test,dc=com
jamm.ldap.root_dn = cn=Manager,dc=test,dc=com

# vi /usr/local/j2sdk/resin-3.0.14/conf/resin.conf
把 
<web-app id='/' document-directory="webapps/ROOT"/>; 
改成
<web-app id='' document-directory="."/>; 
并在这行后加一行
<web-app id='/jamm' document-directory="/var/www/jamm"/>; 

重新启动apache和resin
# /usr/local/j2sdk/resin-3.0.14/bin/httpd.sh restart
# service httpd restart

安装php 5.0.4 
# wget http://cn.php.net/get/php-5.0.4.tar.bz2/from/this/mirror
# tar jxvf php-5.0.4.tar.bz2
# cd php-5.0.4
# ./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-ldap=/usr/local/openldap \
--disable-ipv6
# make 
# make install 
# cp php.ini-dist /usr/local/php/lib/php.ini 

# vi /usr/local/php/lib/php.ini 
找到
;default_charset = "iso-8859-1" 
在这行下面加一行 
default_charset = "gbk" 

# vi /usr/local/apache/conf/httpd.conf 
加两行
AddType application/x-httpd-php .php 
AddType application/x-httpd-php-source .phps 
找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php,把index.jsp也加上去吧
DirectoryIndex index.html index.html.var index.php 

安装phpldapadmin 0.9.6c
本来jamm已经非常好了,可是不能修改quota和homedirectory,可能是我不知道再哪里改吧,只好又装了个phpldapadmin
# wget http://jaist.dl.sourceforge.net/sourceforge/phpldapadmin/phpldapadmin-0.9.6c.tar.gz
# tar zxvf phpldapadmin-0.9.6c.tar.gz -C /var/www
# mv /var/www/phpldapadmin-0.9.6c /var/www/phpldapadmin
# cd /var/www/phpldapadmin 
# cp config.php.example config.php
# vi /var/www/phpldapadmin/config.php
$blowfish_secret = 'any'
$servers[$i]['name'] = 'LDAP Server';
$servers[$i]['host'] = 'localhost';
$servers[$i]['base'] = 'dc=test,dc=com';
$servers[$i]['auth_type'] = 'cookie';
$language = 'zh-tw';

重启apache
# service httpd restart 

现在可以添加用户了
登陆jamm
http://192.168.1.100/jamm/index.jsp
用户名:root
密码:12345

在jamm中建一域:test.com,并在该域下建一用户:test,密码:12345。然后到phpldapadmin中把该用户的homeDirectory改成/var/mailbox,并新增此用户一属性quota,将其值设为100000000S(就是100M)

创建该用户maildir
新建/usr/sbin/maildirmake.sh文件
# vi /usr/sbin/maildirmake.sh 
#!/bin/bash
set -e
if [ ! -d /var/mailbox/$1 ]
then
mkdir /var/mailbox/$1
fi 
chown -R vmail:vmail /var/mailbox/$1
cd "/var/mailbox/$1"
/usr/local/imap/bin/maildirmake $2
chown -R vmail:postfix /var/mailbox/$1/$2
chmod -R g=s /var/mailbox/$1/$2

# chmod 755 /usr/sbin/maildirmake.sh

# maildirmake.sh test.com test 

8.测试

发现邮件系统在安装过程中会碰到各式各样的问题,于是把测试部分单独列出来,请注意看日志目录下的maillog和message。

测试smtp
启动saslauthd
# chkconfig saslauthd on
# service saslauthd start 

如果你的密码验证方式为authdaemond,就不用启动saslauthd了,但是要
#chmod +x /usr/local/var/spool/authdaemon

# perl -MMIME::Base64 -e 'print encode_base64("test\@test.com");'
dGVzdEB0ZXN0LmNvbQ==
# perl -MMIME::Base64 -e 'print encode_base64("12345");'
MTIzNDU=

# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 www.test.com ESMTP "Version not Available"
ehlo www.test.com
250-www.test.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME
auth login
334 VXNlcm5hbWU6
dGVzdEB0ZXN0LmNvbQ==
334 UGFzc3dvcmQ6
MTIzNDU=
235 Authentication successful

测试POP3和IMAP
# telnet localhost 110
+OK Hello there 
user test@test.com 
+OK Password required. 
pass 12345 
+OK Logged in. 
QUIT
+OK bye-bye

测试maildrop
# maildrop -V 9 -d test@test.com
maildrop: authlib: groupid=1001
maildrop: authlib: userid=1001
maildrop: authlib: logname=test@test.com, home=/var/mailbox/, mail=test.com/test/
maildrop: Changing to /var/mailbox/

ctrl+c退出

9.安装squirrelmail 1.4.5
下载squirrelmail及中文包
# wget http://heanet.dl.sourceforge.net/sourceforge/squirrelmail/squirrelmail-1.4.5.tar.bz2
# wget http://heanet.dl.sourceforge.net/sourceforge/squirrelmail/zh_CN-1.4.5-20050713.tar.bz2
把squirreelmail解压到/var/www目录下。
# tar jxvf squirrelmail-1.4.5.tar.bz2 -C /var/www
# mv /var/www/squirrelmail-1.4.5 /var/www/squirrelmail
解压中文包
# tar jxvf zh_CN-1.4.5-20050713.tar.bz2 -C /var/www/squirrelmail/

在配置squirrelmail之前先下载插件:
Quota Usage Version 1.3
# wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fquota_usage-1.3-1.2.7.tar.gz

Compatibility 2.0.1
# wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fcompatibility-2.0.1.tar.gz

Change LDAP Password 1.8 
# wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fchange_ldappass-1.8.tar.gz 

把插件解压到squirrelmail的plugin目录下
# tar zxvf quota_usage-1.3-1.2.7.tar.gz -C /var/www/squirrelmail/plugins/
# tar zxvf compatibility-2.0.1.tar.gz -C /var/www/squirrelmail/plugins/
# tar zxvf change_ldappass-1.8.tar.gz -C /var/www/squirrelmail/plugins/

配置Quota Usage
# cd /var/www/squirrelmail/plugins/quota_usage
# cp config.php.sample config.php

配置Change LDAP Password
# cd /var/www/squirrelmail/plugins/change_ldappass
# cp config.php.sample config.php
# vi /var/www/squirrelmail/plugins/change_ldappass/config.php
$ldap_server = "localhost"; 
$ldap_password_field = "userpassword"; 
$ldap_user_field = "mail"; 
$ldap_base_dn = "dc=test,dc=com"; 


配置squirrelmail
# cd /var/www/squirrelmail
# ./configure
进入10. Languages
把1. Default Language : 的en_US改成zh_CN。
进入8. Plugins,添加这三个插件

打开浏览器输入http://192.168.1.100/squirrelmail/,用test@test.com登陆,成功!

结束,还有防病毒和防垃圾部分请参考我的另一篇文章(点这里),终于告一段落了,休息几天先。

主要参考文章
http://jamm.sourceforge.net/howto/single-html/mailserver.html
http://wanderingbarque.com/howtos/mailserver/mailserver.html
http://www.freebsdchina.org/forum/topic_21506.html
https://bugzilla.andrew.cmu.edu/cgi-bin/cvsweb.cgi/src/sasl/saslauthd/LDAP_SASLAUTHD?rev=1.11&content-type=text/x-cvsweb-markup

heracai@126.com



我是大宇 回复于:2005-07-24 20:18:42

多谢楼主了!明天参考这篇文章试试。


hefish 回复于:2005-07-24 21:12:34

openldap安装部分好像抄错了,
作者自称用的是bdb, 例子是用的是ldbm, 嘿嘿。。。。


anstan 回复于:2005-07-24 21:14:38

引用:原帖由 "hefish" 发表:
openldap安装部分好像抄错了,
作者自称用的是bdb, 例子是用的是ldbm, 估计是抄了部分我那篇《手把手》, 嘿嘿。。。。


对了,不好意思,看了你的文章,我还以为用ldbm也要berkeley-db呢,改改,^_^


万里北国 回复于:2005-07-24 22:29:48

这一篇和楼主的那一篇《postfix集成系统》相比,有什么不同?
是应用不同,还是另有优点?


anstan 回复于:2005-07-24 22:45:58

引用:原帖由 "万里北国" 发表:
这一篇和楼主的那一篇《postfix集成系统》相比,有什么不同?
是应用不同,还是另有优点?



那篇是基于mysql的,这篇是ldap的。


hongfengyue 回复于:2005-07-25 08:50:16

支持楼主!


chaohu 回复于:2005-07-25 11:21:55

也采用偶的postfix SMTP加密认证方法哟!!偶原先也试过使用jamm,但在freebsd系统下使用java不方便。再说jamm只是一个后台管理系统,自己写一个就行了。再说域名不是很多的情况下,不用放在openldap数据中,会加大查询量的。

选择openldap就是考虑它的查询能力好,是基于百万级用户量的,一般的企业邮局,域名多,用户量少,还是基于mysql比较好。


anstan 回复于:2005-07-25 14:04:01

引用:原帖由 "chaohu"]也采用偶的postfix SMTP加密认证方法哟!!偶原先也试过使用jamm,但在freebsd系统下使用java不方便。再说jamm只是一个后台管理系统,自己写一个就行了。再说域名不是很多的情况下,不用放在openldap数据中,会加大查..........
发表:


我把两种smtp认证方法都列出来了,一种是authdaemond,是看你的文章的;另一种是saslauthd,是看了网上的文章的。本来还想把auxprop认证也弄出来,可是水平有限,只好作罢,等待日后再来。


anstan 回复于:2005-07-25 21:56:38

html版本:http://anstan.go.nease.net/redhat/postfix(redhat.ldap).htm

花了我这么多精力的文章,版主怎么不加精呢!


chinesecai 回复于:2005-07-31 21:40:52

/usr/local/openldap/bin/ldapadd -x -D "cn=Manager,dc=test,dc=com" -W -f /usr/local/openldap/etc/openldap/base.ldif
Enter LDAP Password: 
adding new entry "dc=test, dc=com "
ldap_add: Invalid syntax (21)
        additional info: objectClass: value #0 invalid per syntax


出错,?


我菜我怕谁 回复于:2005-08-01 11:50:52

要是bsd下的就好了. :) 建议精华!


chinesecai 回复于:2005-08-01 23:37:17

上面问题已经解决,主要是楼主那个文件好像多了什么东西,后来重新复制,就ok了。


chinesecai 回复于:2005-08-01 23:38:43

还有一个问题,,,#chmod +x /var/run/authdaemond 

这一步过不去,查看后发现 authdaemond没有
进程里面也没有,难道我没有装,麻烦指导一下。


anstan 回复于:2005-08-02 08:53:16

引用:原帖由 "chinesecai" 发表:
还有一个问题,,,#chmod +x /var/run/authdaemond 

这一步过不去,查看后发现 authdaemond没有
进程里面也没有,难道我没有装,麻烦指导一下。



应该是
# chmod +x /usr/local/var/spool/authdaemon


chinesecai 回复于:2005-08-02 12:23:06

也没有这个文件,难道没有。
find / -name authdaemond

查不到


anstan 回复于:2005-08-02 13:05:44

引用:原帖由 "chinesecai" 发表:
也没有这个文件,难道没有。
find / -name authdaemond

查不到


是authdaemon,不是authdaemond。
find / -name authdaemond
如果你编译courier-authlib的时候,没有指定socket的位置,那默认的应该在
/usr/local/var/spool/authdaemon/


ericfung 回复于:2005-08-02 16:36:36

引用:原帖由 "chinesecai" 发表:
/usr/local/openldap/bin/ldapadd -x -D "cn=Manager,dc=test,dc=com" -W -f /usr/local/openldap/etc/openldap/base.ldif
Enter LDAP Password: 
adding new entry "dc=test, dc=com "
ldap_add: Invalid syntax..........


你好,我也遇到这样的问题,怎样解决啊?


ericfung 回复于:2005-08-02 17:36:39

这问题解决了,原来是我的是.cn域名,我改用.com就这错误没有了,但有一个新的错误
-------------------
conn=7 op=1 RESULT tag=105 err=21 text=objectClass: value #0 invalid per syntax
ldap_add: Invalid syntax (21)
        additional info: objectClass: value #0 invalid per syntax
--------------------
请问这是什么问题?objectClass是organizationalRole,没有错吧?
还有我怎样才能用会.cn域名啊?是否改schema文件啊?怎样改啊?


chinesecai 回复于:2005-08-02 19:22:52

搂住,还是不行,已经pm了。


ericfung 回复于:2005-08-03 10:05:07

知道什么问题了,原来是后面的空格,一定要删除,否则...


zhangfanhua1234 回复于:2005-08-03 15:56:43

搂主,我们在做到第一步make depend实显示以下信息make: *** No rule to make target 'depend'. stop.

以后就无法继续进行。望给与指教


ericfung 回复于:2005-08-03 16:06:00

# ./configure --disable-anon -enable-plain --enable-login --enable-ldapdb --with-ldap=/usr/local/openldap --with-saslauthd=/var/run/saslauthd --sysconfdir=/etc
怎么我configure的时候出现
---------------------------------
checking for ldap_initialize in -lldap... no
configure: error: Cannot enable LDAPDB plugin: Could not locate OpenLDAP
---------------------------------
我的openldap就是装在/usr/local/openldap,怎么会找不到呢?


ericfung 回复于:2005-08-03 16:12:44

引用:原帖由 "zhangfanhua12340" 发表:
搂主,我们在做到第一步make depend实显示以下信息make: *** No rule to make target 'depend'. stop.

以后就无法继续进行。望给与指教


第一步应该是
# ./configure --prefix=/usr/local/openldap --enable-ldbm=yes --enable-bdb=no --enable-ipv6=no 
你没有configure,怎可以make depend呢?


anstan 回复于:2005-08-03 19:00:43

引用:原帖由 "ericfung" 发表:
# ./configure --disable-anon -enable-plain --enable-login --enable-ldapdb --with-ldap=/usr/local/openldap --with-saslauthd=/var/run/saslauthd --sysconfdir=/etc
怎么我configure的时候出现
------------..........



这个作了吗?
# echo /usr/local/openldap/lib >;>; /etc/ld.so.conf 
# ldconfig


ericfung 回复于:2005-08-04 08:30:16

这个做了也不行,我用CentOS4.1就没问题,两台CentOS3.5都不行.


anstan 回复于:2005-08-04 08:38:28

对centos不了解,^_^


ericfung 回复于:2005-08-04 09:31:30

CentOS4.1相当于RHEL4 Update 1
CentOS3.5相当于RHEL3 Update 5
CentOS是把RHEL的原代码重新编译的项目,不用注册就可以升级的.


anstan 回复于:2005-08-04 16:59:53

有空我也装装


ericfung 回复于:2005-08-15 09:59:43

楼主, 怎么我按照你做的,现在telnet 127.0.0.1 25的时候,就会自动退出,然后查看/var/log/messages,就看到这一行,究竟是什么问题呢? Thanks
Aug 15 16:07:22 mail postfix/smtpd[3773]: auxpropfunc error invalid parameter supplied


anstan 回复于:2005-08-15 11:31:20

smtpd.conf文件对吗,内容对吗,路径对吗?


ericfung 回复于:2005-08-15 14:10:38

pwcheck_method: saslauthd
mech_list: login plain
没问题吧?


panjin11 回复于:2005-09-29 23:53:56

我用了saslauthd的认证方式
为什么在jamm中登录时,root登录不了。


xmy 回复于:2005-09-30 10:27:45

sorry,现在+精


daichuang 回复于:2005-11-18 16:43:42

ldap:/var/log#service saslauthd start
Starting saslauthd: saslauthd[17517] :set_auth_mech   : unknown authentication mechanism: ldap
                                                           [FAILED]

起不来?


law7890 回复于:2006-04-28 21:02:48

1.我按照楼上装完之后,打开浏览器,用[email]test@test.com[/email]登陆,成功!
发送邮件也没有报错,但就是收不到刚才发给自己的邮件  ????
又新建一个口令,双方互发邮件还是收不到对方的邮件.  
???

2.我用FOXmail 来收邮件的话,总是提示:
-ERR Login failed.
重新输入口令吗 ?

重新输入正确口令也还是这个提示....

郁闷~~~
高手,请指教


law7890 回复于:2006-04-29 09:32:14

telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 www.test.com ESMTP "Version not Available"
421 www.test.com Error: timeout exceeded
Connection closed by foreign host.

兄弟帮忙看一下


yuetkui 回复于:2006-05-29 12:22:23

RHAS4+postfix+cyrus-sasl+ldap+courier-imap+courier-maildrop+jamm+squirrelmail 

anstan 大哥, 我以經裝好email server.可否教教我怎樣 autoreply mail~~~


falkon 回复于:2007-05-13 00:08:14

使用后
# source /etc/profile
报错
bash: id: command not found
bash: id: command not found
bash: id: command not found
bash: [: too many arguments
bash: dircolors: command not found
bash: grep: command not found
bash: grep: command not found
bash: id: command not found
bash: [: =: unary operator expected
很多命令不指定路径不能使用了.有什么办法恢复吗?
===================================
应该是:
JAVA_HOME=/usr/local/j2sdk
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
CLASSPATH=.:$JAVA_HOME/lib
export PATH JAVA_HOME CLASSPATH
因为拷贝时由于页面的原因.导致有一部分字符没有拷过去.....所以出现问题.重新处理后OK了

[ 本帖最后由 falkon 于 2007-5-13 15:25 编辑 ]


resens 回复于:2007-05-15 18:00:33

引用:原帖由 daichuang 于 2005-11-18 16:43 发表
ldap:/var/log#service saslauthd start
Starting saslauthd: saslauthd[17517] :set_auth_mech   : unknown authentication mechanism: ldap
                                                           [FA ...


顶楼主个先,这么多内容,肯定花了不少心血。。。。感谢!
另外,我也遇到了上面这个问题,怎么回事?其他都正常哦!

 

http://www.chinaunix.net/old_jh/14/582380.html

原创粉丝点击