歡迎您光臨本站 註冊首頁

postfix(ldap)郵件系統

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0


  RHAS4+postfix+cyrus-sasl+ldap+courier-imap+courier-maildrop+jamm+squirrelmail
 
 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*
 
 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*
 |-2*
 
 檢查埠,應該有如下埠打開:
 # 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"
 

;
 Options Indexes FollowSymLinks
 AllowOverride None
 Order allow,deny
 Allow from all
 

;
 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
 把
 

;
 改成
 ;
 並在這行后加一行
 ;
 
 重新啟動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
 

[火星人 ] postfix(ldap)郵件系統已經有870次圍觀

http://coctec.com/docs/service/show-post-15468.html