基于openldap邮件系统的完全ports安装

postfix+ldap+sasl2+courier-imap for freebsd完全ports安装

作者:柯贵中
网站:www.chinake.com
QQ:93606088
邮箱:[email protected]

为什么使用FREEBSD?因为它有PORTS,有什么好处,就是你安装软件时就不用再考虑软件的依赖关系,它自己会添加的。这一点就足以位列所有的UNIX,包括类UNIX之首!!!!!
本文力求使用最简单的方法,构建出高效的大容量的邮件系统。本次实践过程中得到了hefish的鼓励和帮助,基本过程是hefish的KUNMAIL系统地freebsd上的一次试验。由于新版openldap对某些字段定义的变化,kunmail.schema需要作一些变动,liut对此作些改动mail.schema,同时也使用了陈景峰的postfix.schema。其实直接使用qmail.schema就挺好。

本文旨在帮助初学者,通过基本的架设过程,理解mail系统的基本原理,所以构建的系统也是最基本的,病毒防护和垃圾过滤网上的参照文件很多,就不写了。
本文假设你对类UNIX有一定的了解,最好是架设或使用过邮件系统。本文的重点在openldap,如果你想使用mysql,请参照我的另一篇文章。
本次试验在freebsd4.10下和freebsd5.4下成功通过。SASL2认证采用courier的AUTHDAEMOND认证,认证方式简单高效,只要courier认证通过,postfix认证肯定能通过。与postfix+mysql相比,只是数据库更改了,便于使用现有的经验来架设新的系统。
暂时只使用PLAIN LOGIN,大多数电信都是这两种,对于openldap来说,这种认证方式并不比其自已本身的认证更好(openldap原文),但与sasl2结合,可以有更高的、更安全的认证方式。
参考文章:
1、http://kunmail.cz8.net/
2、http://www.huihoo.com/internet/postfix/pis/book1.html


第一章 系统准备


如果你能够安装基本系统,可以跳过本章。本文未特别申明的,一律是以root身份操作。

freebsd5.4安装
选择最小化安装,配置好网络,添加perl5.8软件包。
在本例中,机器名:mail.chinake.com
域名:chinake.com
默认网关:192.168.0.1
IP地址:192.168.0.66

1、cvsup安装
由于5.4将不少软件包放在第二张盘上,所以只有通过网络安装了。
设计pkg_add环境变量,使它使用国内的服务器,freebsd默认的shell是csh。
bash shell
#export PACKAGEROOT="ftp://ftp.freebsdchina.org"
csh shell
#setenv PACKAGEROOT "ftp://ftp.freebsdchina.org"
#pkg_add -r cvsup-without-gui

2、设计/etc/make.conf
添加
MASTER_SITE_OVERRIDE=ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}

3、更新ports树
#/usr/local/bin/cvsup -g -L 2 -h ftp.freebsdchina.org /usr/share/examples/cvsup/ports-supfile ;

第二章 邮件系统软件的安装

1、安装openssl
#cd /usr/ports/security/openssl; make install clean

2 安装apache
#cd /usr/ports/www/apache13-modssl;make install clean
支持https连接,web服务路径为:/usr/local/www/data/。也可以选择apache2。
#ee /etc/rc.conf;加入:apache_enable="YES"

3 安装php4
#cd /usr/ports/lang/php4;make install clean
#cp /usr/local/etc/php.ini.dist /usr/local/etc/php.ini
#ee /usr/local/etc/apache/httpd.conf
在最后加入:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

4 安装expect
#cd /usr/ports/lang/expect
#make install clean

5 安装SASL2
cd /usr/ports/security/cyrus-sasl2;make install WITH_AUTHDAEMON=yes clean;
或者使用:make -DWITH_AUTHDAEMOND install clean
#ln -s /usr/local/lib/sasl2 /usr/lib/sasl2;
下面的这个smtpd.conf就是postfix调用的,很简单吧。
#ee /usr/local/lib/sasl2/smtpd.conf ;
pwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond_path:/var/run/authdaemond/socket

6 安装courier-imap
#cd /usr/ports/mail/courier-imap
#make install clean
选择添加:[auth_ldap],[openssl],[gdbm]如果没有做,可以make config,进行重新选择。
然后编辑/etc/rc.conf;增加courier_authdaemond_enable="YES"自启动,并启动:
#/usr/local/etc/rc.d/courier_authdaemond.sh start。
此时会在/var/run/authdaemond/下产生socket。
chmod +x /var/run/authdaemond;
给sasl可执行权限。

我们这里是使用authdaemond认证,不使用pam认证,所以以下的不需要做:
In case you use authpam, you should put the following lines
in your /etc/pam.d/imap
auth required pam_unix.so try_first_pass
account required pam_unix.so try_first_pass
session required pam_permit.so
至此,认证部分基本完成。

7、openldap安装
#cd /usr/ports/net/openldap22-server;
#make WITH_SASL=yes install clean;
#ee /etc/rc.conf;
添加:
slapd_enable="YES"
slapd_flags='-h "ldapi://%2fvar%2frun%2fopenldap%2fldapi/ ldap://0.0.0.0/"'
slapd_sockets="/var/run/openldap/ldapi"
我们来启动它:
#/usr/local/etc/rc.d/slapd.sh start

8、 安装POSTFIX
3.3.1 cd /usr/ports/mail/postfix
安装时选中[sasl2]+[tls]+[ldap]+[vda]+[test]。
make install clean
在安装快结束时会提示两个问题,分别是加入用户组和修改mailer.conf。全部回答为y。
添加postfix别名:
#cd /etc;
#echo ‘postfix: root’ >> /etc/aliases
产生别名数据库,每次改动都必须要做一次:
#/usr/local/bin/newaliases
如果提示opiekeys错误
#chown postfix:postfix /etc/opiekeys

替换并停止sendmail
#ee /etc/rc.conf;
修改sendmail_enable=’NONE’
建立启动链接:
#cd /usr/local/etc/rc.d/;
#ln –s /usr/local/sbin/postfix postfix.sh
创建/etc/periodic.conf
#ee /etc/periodic.conf
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"

9、phpldapadmin安装
强烈建议安装此程序,这是一个web界面的openldap的管理程序,对于理解和运用openldap大有帮助,我们可以把它看作是mysql的phpmyadmin一样。
#cd /usr/ports/net/phpldapadmin/
#ee Makefile,修改 www/为www/data/
#make install clean;

phpldapadmin的配置,与phpmyadmin基本上一样,无非就是用户名、密码等。
#ee /usr/local/www/data/phpldapadmin/config.php;
$blowfish_secret = 'mytestopenldap'; //随机加密码字符串,默认是空,使用cooki认证时必须要填,内容随便。
$servers[$i]['name'] = 'My LDAP Server'; //名称,随便。
$servers[$i]['host'] = '192.168.0.66'; //主机IP
$servers[$i]['base'] = 'dc=chinake,dc=com'; //与slapd.conf保持一致。下面有讲到。
$servers[$i]['port'] = 389; //默认端口号。
$servers[$i]['auth_type'] = 'cookie'; //进入模式,开始的时候可以使用config(默认值)
$servers[$i]['login_dn'] = 'cn=chaohu,dc=chinake,dc=com' //与slapd.conf的rootdn保持一致。
$servers[$i]['login_pass'] = 'chaohu'; //rootpw的密码。使用cookie时,不需要。
$language = 'zh-tw'; //语言,默认为 auto乱码,设为zh-cn也乱码,所以使用繁体的或en。


第三章 openldap的配置

1、关于schema
一个schema就是一张字段和字段关系的定义表(与mysql的数据库相比)。postfix和courier需要查找的基本字段是用户名(用户邮件地址)、密码(postfix不需要)、用户邮件的存储目录。
①kunmail.schema基本字段:
kunmailuser: userName - 邮件系统用户名 (是完整的用户名,包括@后面的部分)
userHome - 用户的home目录
userMaildir - 用户的maildir (一般为 userHome + “/Maildir/”)
userClearpw - 用户密码 (明码)
②postfix.schema基本字段:
postfixAccount:mail – 用户邮件地址
mailbox - 用户的maildir
clearPassword - 用户密码
homeDirectory -用户的home目录
③mail.schema基本字段:
mailUser: mail – 用户邮件地址
userPassword - 用户密码
homeDirectory -用户的home目录
mailMessageStore - 用户的maildir
④qmail.schema基本字段:
qmailUser: mail – 用户邮件地址
mailMessageStore - 用户的maildir
homeDirectory -用户的home目录
userPassword - 用户密码
注意:用户的home目录+用户的maildir要构成一个邮件用户完整的绝对路径。本文使用mail.schema进行讲解。(几个schema文件附后)

2、关于slapd.conf
这是openldap主要配置文件,这个文件可以分成三个部分来理解:
第一部分:载入schema文件,主要是装载所有字段定义和属性。其依赖关系可以这样理解:如某个schema文件中未定义mailhost这个字段,而其属性值里引用了这个字段,则定义了mailhost这个字段的schema必须先载入。我们先将mail.schema放到/usr/local/etc/openldap/schema/下,必须要先放。
根据其依赖关系我们加入了几个schema文件:
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/nis.schema
include /usr/local/etc/openldap/schema/misc.schema
include /usr/local/etc/openldap/schema/mail.schema
对于openldap的配置文件,行尾一定不能有空格。

第二部分:控制权限。其默认的控制权限是rootdn任何时候都拥有写入权,这一部分我们可以不加定义,直接使用rootdn,但这样不太安全,所以我们添加一个用户或组来拥有对邮箱用户组写入权,邮箱用户自己可以读写。

access to dn.base="" by * read //只读
access to dn.base="cn=Subschema" by * read //只读
access to dn.subtree="ou=admin,dc=chinake,dc=com" attr=userPassword
by * auth //添加管理组ou=admin,对自己可以认证。
access to dn.subtree="ou=mail,dc=chinake,dc=com" attr=userPassword
by * auth //添加邮箱组ou=mail,对自己可以认证。
access to dn.subtree="ou=mail,dc=chinake,dc=com"
by dn="cn=kunmail,ou=admin,dc=chinake,dc=com" write
by * none //添加管理员kumail,对ou=mail拥有写入权,对其它无权。

第三部分:根及根用户

suffix "dc=chinake,dc=com" //默认前缀
rootdn "cn=chaohu,dc=chinake,dc=com" //根用户,名称随便。
rootpw chaohu //根用户密码。

这种结构与我的路径很相似,只是倒过来的,可以这样对比:
/com/chinake/chaohu,这样就容易理解多了。

那么我们的slapd.conf看起来就象这样。
#ee /usr/local/etc/openldap/slapd.conf

# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/nis.schema
include /usr/local/etc/openldap/schema/misc.schema
include /usr/local/etc/openldap/schema/mail.schema
# Define global ACLs to disable default read access.
# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
# Load dynamic backend modules:
# modulepath /usr/local/libexec/openldap
# moduleload back_bdb
# moduleload back_ldap
# moduleload back_ldbm
# moduleload back_passwd
# moduleload back_shell

# Sample security restrictions
# Require integrity protection (prevent hijacking)
# Require 112-bit (3DES or better) encryption for updates
# Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64

# Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub)entry DSE: allow anyone to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read access
# Allow anonymous users to authenticate
# Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
# by self write
# by users read
# by anonymous auth
#
# if no access controls are present, the default policy
access to dn.base="" by * read
access to dn.base="cn=Subschema" by * read
access to dn.subtree="ou=admin,dc=chinake,dc=com" attr=userPassword
by * auth
access to dn.subtree="ou=mail,dc=chinake,dc=com" attr=userPassword
by * auth
access to dn.subtree="ou=mail,dc=chinake,dc=com"
by dn="cn=kunmail,ou=admin,dc=chinake,dc=com" write
by * none
#
# rootdn can always read and write EVERYTHING!

#######################################################################
# BDB database definitions
#######################################################################

database bdb
suffix "dc=chinake,dc=com"
rootdn "cn=chaohu,dc=chinake,dc=com"
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd(8) and slapd.conf(5) for details.
rootdn "cn=chaohu,dc=chinake,dc=com"
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw chaohu
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory /var/db/openldap-data
# Indices to maintain
index objectClass eq

3、配置ldap.conf,也可以不配置。

# LDAP Defaults
#
# See ldap.conf(5) for details
# This file should be world readable but not world writable.

BASE dc=chinake, dc=com
HOST localhost
#URI ldap://ldap.example.com ldap://ldap-master.example.com:666

#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never
以上两个配置文件中间和前面空的部分都是TAB键打出来的,不是空格。

重新启动slapd
/usr/local/etc/rc.d/slapd.sh stop;
/usr/local/etc/rc.d/slapd.sh start;

4、建立用户数据

建立导入文件,多个记录间使用空行分隔,我在使用过程中发现根结点必须手动导入,其它记录可以通过phpldapadmin导入,也可以直接建立。

第一步是建立DN:
文字不多,我们手动建立就可以了

ldapadd -x -D 'cn=chaohu,dc=chinake,dc=com' -W //输入密码,然后将下面的内容输入,完成后按Ctrl+d 存盘。
dn: dc=chinake,dc=com
objectClass: dcObject
objectClass: organization
dc: chinake
o: Corporation
description: d Corporation

第二步建立组和用户:
将下面的存为postfix.ldif,然后进入http://192.168.0.66/phpldapadmin/,使用其中的导入功能就可以了。
也可以手动导入:
# ldapadd -x -D "cn=chaohu,dc=chinake,dc=com" -W -f postfix.ldif

#管理组
# 紀錄 2: ou=admin,dc=chinake,dc=com
dn: ou=admin,dc=chinake,dc=com
ou: admin
objectClass: top
objectClass: organizationalUnit

#用户组
# 紀錄 3: ou=mail,dc=chinake,dc=com
dn: ou=mail,dc=chinake,dc=com
ou: mail
objectClass: top
objectClass: organizationalUnit

#邮箱用户管理员
# 紀錄 4: cn=kunmail,ou=admin,dc=chinake,dc=com
dn: cn=kunmail,ou=admin,dc=chinake,dc=com
cn: kunmail
mail: [email protected]
uid: kunmail
displayName: kunmail admin
gidNumber: 80
uidNumber: 80
userStatus: 1
mailMessageStore: chinake.com/kunmail/Maildir/
mailQuota: 1000000
userPassword: 2320419
objectClass: mailUser
objectClass: top
homeDirectory: /usr/local/vmail

#用户
# 紀錄 5: uid=test,ou=mail,dc=chinake,dc=com
dn: uid=test,ou=mail,dc=chinake,dc=com
cn: test
uid: test
displayName: test user
uidNumber: 80
gidNumber: 80
userPassword: test
userStatus: 1
objectClass: mailUser
objectClass: top
mail: [email protected]
mailMessageStore: chinake.com/test/Maildir/
homeDirectory: /usr/local/vmail

在网络上的教程大都是建立一个用户如vmail,然后让这个用户在操作邮件用户。在本例中,用户使用www,与apache运行用户一样。
邮件目录是这样的:/usr/local/vmail/chinake.com/user/Maildir/。
所以我们建立这个目录:
mkdir /usr/local/vmail;
chown -R www:www /usr/local/vmail;
chmod -R 700 /usr/local/vmail;

以后再往openldap中添加用户,直接就可以使用phpldapadmin了,在相应组下面建立新记录
——COUSTOM——uid=user,ObjectClasses选mailuser——填上必填项就可以了。

第四章 配置AUTHLDAPRC


#ee /usr/local/etc/authlib/authldaprc
LDAP_SERVER localhost //本地服务器
LDAP_PORT 389 //端口号
LDAP_PROTOCOL_VERSION 3 //协议版本
LDAP_BASEDN ou=mail, dc=chinake, dc=com //搜索的根目录
LDAP_BINDDN cn=kunmail, ou=admin, dc=chinake, dc=com //绑用户
LDAP_BINDPW 2320419 //绑定用户密码
LDAP_TIMEOUT 10 //超时设置
LDAP_AUTHBIND 1 //认证绑定为真
LDAP_MAIL mail //用户邮箱地址
LDAP_DOMAIN chinake.com //默认域名
LDAP_GLOB_UID www //使用www用户来操作目录
LDAP_GLOB_GID www //使用www用户组
LDAP_HOMEDIR homeDirectory //用户基本目录
LDAP_MAILDIR mailMessageStore //邮箱的Maildir地址
LDAP_MAILDIRQUOTA mailQuota //邮箱大小
LDAP_CLEARPW userPassword //密码字段
LDAP_DEREF never
LDAP_TLS 0

第五章 配置POSTFIX


#ee /usr/local/etc/postfix/main.cf;在最后加入:

#======= BASE ==============
myhostname = mail.chinake.com //本机机器名
mydomain = chinake.com //本机域名
home_mailbox = Maildir/ //邮件的存储方式
mydestination = $myhostname $mydomain //收信域名
local_recipient_maps = //不投递本地系统帐号邮件
mynetworks = 127.0.0.1, 192.168.0.0/24 //信任的,无须SMTP认证的地址范围
alias_maps = hash:/etc/aliases //别名
alias_database = hash:/etc/aliases //别名数据
local_transport = virtual //本地邮件的投递方式,也可以使用maildrop
virtual_transport = virtual //虚拟用户的投递方式,也可以使用maildrop
virtual_mailbox_base = /usr/local/vmail //邮件存储的根目录
virtual_gid_maps = static:80 //虚拟用户的ID
virtual_uid_maps = static:80 //虚拟用户组的ID
virtual_minimum_uid = 80 //虚拟用户的最小ID

#============ ldap mailbox ============
#virtual_mailbox_domains = hash:/usr/local/etc/postfix/transport //虚拟域名,由于只有一个域名,可以不用。
virtual_mailbox_maps = ldap:mailuser //虚拟域邮箱
mailuser_timeout = 10 //超时设置
mailuser_server_host = localhost //与mysql差不多,就是如何去找用户
mailuser_server_port = 389
mailuser_search_base = ou=mail,dc=chinake,dc=com
mailuser_query_filter = (&(mail=%s)(userStatus=1)) //查询语句
mailuser_result_attribute = mailMessageStore
mailuser_bind = yes
mailuser_bind_dn = cn=kunmail,ou=admin,dc=chinake,dc=com
mailuser_bind_pw = 2320419
mailuser_version = 3

#============== ldap Quota ============
message_size_limit = 5242880
virtual_mailbox_limit_size = 5242880
virtual_mailbox_limit_override=yes
#virtual_mailbox_limit_inbox = no
virtual_maildir_extended = yes
virtual_create_maildirsize = yes

virtual_mailbox_limit_maps = ldap:mailquota
mailquota_timeout = 10
mailquota_server_host = localhost
mailquota_server_port = 389
mailquota_search_base = ou=mail,dc=chinake,dc=com
mailquota_query_filter = (mail=%s)
mailquota_result_attribute = mailQuota
mailquota_bind = yes
mailquota_bind_dn = cn=kunmail,ou=admin,dc=chinake,dc=com
mailquota_bind_pw = 2320419
mailquota_version = 3

#============== SASL ================
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated permit_auth_destination reject
#smtpd_sasl_local_domain = $mydomain
smtpd_client_restrictions = permit_sasl_authenticated

#============ banner =============
smtpd_banner = Chinke Mail System

多域名直接修改:/usr/local/etc/postfix/transport
#ee /usr/local/etc/postfix/transport
chinake.com virtual:
test.com virtual:
#postmap /usr/local/etc/postfix/transport


第六章 测试


1、测试courier-pop3
手动建立邮件用户目录
mkdir -p /usr/local/vmail/chinake.com/test
maildirmake /usr/local/vmail/chinake.com/test/Maildir
chown -R /usr/local/vmail
chmod -R 700 /usr/local/vmail

#telnet localhost 110
Trying ::1...
Connected to localhost.chinake.com.
Escape character is '^]'.
+OK Hello there.
user [email protected]
+OK Password required.
pass test
+OK logged in.
Ctrl+]退出。

如果有出错,请查看/var/log/maillog文件的输出。

2、测试postfix

认证测试:
安装p5-MIME-Base64
# cd /usr/ports/converters/p5-MIME-Base64/
# make install clean
# perl -MMIME::Base64 -e 'print encode_base64("test/@chinake.com");'
dGVzdEBjaGluYWtlLmNvbQ==
# perl -MMIME::Base64 -e 'print encode_base64("test");'
dGVzdA==

#telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.chinake.com.
Escape character is '^]'.
220 Chinke Mail System
ehlo mail
250-mail.chinake.com
250-PIPELINING
250-SIZE 5242880
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME
auth login
334 VXNlcm5hbWU6
dGVzdEBjaGluYWtlLmNvbQ==
334 UGFzc3dvcmQ6
dGVzdA==
235 Authentication successful

如果认证不成功,请查看/var/log/maillog文件,如果提示:
SASL authentication failure: cannot connect to Courier authdaemond: Permission denied
则可能是这一步没有做:
#chmod +x /var/run/authdaemond

如果提示与ldap有关,请仔细检查main.cf文件,注意每次修改后,都要
#postfix reload

发信测试:
#echo "hello" |mail [email protected]
成功后/var/log/maillog显示:
May 25 23:46:02 mail postfix/pickup[369]: A57521BB: uid=0 from=
May 25 23:46:02 mail postfix/cleanup[928]: A57521BB: message-id=<[email protected]>
May 25 23:46:02 mail postfix/qmgr[272]: A57521BB: from=, size=285, nrcpt=1 (queue active)
May 25 23:46:03 mail postfix/virtual[930]: A57521BB: to=, relay=virtual,delay=1, status=sent (delivered to maildir)
May 25 23:46:03 mail postfix/qmgr[272]: A57521BB: removed

第七章 安装WEBMAIL


我们使用小松鼠WEBMAIL,它使用IMAP方式,所以需要启动courier-imap-imapd。
#ee /etc/rc.conf;
添加:
courier_imap_imapd_enable=”YES”
启动imapd:
/usr/local/etc/rc.d/courier-imap-imapd.sh start;
安装小松鼠WEBMAIL:
#cd /usr/ports/mail/squirrelmail/;
#ee Makefile;
将默认的安装路径www/修改为:www/data/
#make install clean

配置小松鼠WEBMAIL:
#cd /usr/local/www/data/squirrelmail
#./configure
1. Organization Preferences //修改组织特性,可以不改
2. Server Settings //修改域名,必须要改
3. Folder Defaults //可以将INDEX.XXXX,改成相应的INDEX.垃圾箱、发件箱、草稿箱
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages //可以将语言改为zh_CH,编码改为GB2312

D. Set pre-defined settings for specific IMAP servers

C Turn color on
S Save data
Q Quit

先存盘,后退出,也可以直接修改config/config.php文件。
使用它去登录吧。

关于新增用户,目前可以这样做,在openldap中添加新用户记录,然后给该新用户发一欢迎信,则courier就会自动建立好用户的邮箱目录,产生相对应的Maildir/。


附件:
1、kunmail.schema
# kunmail-ldap v3 directory schema
# written by [email protected]
# Attribute Type Definitions
attributetype ( 1.3.6.1.4.1.7914.1.2.1.1 NAME 'userNo'
DESC 'id of the user on the mailsystem'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27{32}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.2 NAME 'userName'
DESC 'name of the user on the mailsystem'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.3 NAME 'userUid'
DESC 'UID of the user on the mailsystem'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27{32}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.4 NAME 'userGid'
DESC 'GID of the user on the mailsystem'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27{32}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.5 NAME 'userHome'
DESC 'home of user in mail system'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.6 NAME 'userMaildir'
DESC 'maildir of user'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.7 NAME 'userQuota'
DESC 'The amount of space the user can use until all further messages get bounced.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.44{32}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.8 NAME 'userClearpw'
DESC 'clear password of the user on the mailsystem'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.9 NAME 'userFullname'
DESC 'full name of user'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.10 NAME 'userActive'
DESC 'The status of a user account'
ORDERING integerOrderingMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.11 NAME 'userMailReplyText'
DESC 'A reply text for every incoming message'
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.44{4096}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.12 NAME 'userRegisterDate'
DESC 'timestamp of user registration'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.13 NAME 'userExpireDate'
DESC 'timestamp of user mailbox expiration'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE )

# Object Class Definitions

objectclass ( 1.3.6.1.4.1.7914.1.2.2.1 NAME 'kunmailUser'
DESC 'KunMail-LDAP User' SUP top STRUCTURAL
MUST ( userNo $ userName $ cn $ userUid $ userGid )
MAY ( userMaildir $ userHome $ userClearpw $ userQuota $ userFullname $ userMailReplyText $ userActive $ userRegisterDate $ userExpireDate ) )

2、mail.schema
# mail-ldap v3 directory schema
# written by liut
# This schema depends on:
# - core.schema
# - cosine.schema
# - inetorgperson.schema
# - nis.schema
# - misc.schema
# Attribute Type Definitions

attributetype ( 1.3.6.1.4.1.7914.1.2.1.3 NAME 'mailMessageStore'
DESC 'Path to the maildir/mbox on the mail system'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.4 NAME 'mailQuota'
DESC 'The amount of space the user can use until all further messages get bounced.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.44{32}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.6 NAME 'mailForward'
DESC 'Address(es) to forward all incoming messages to.'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.7 NAME 'mailClearpw'
DESC 'clear password of the user on the mailsystem'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.9 NAME 'mailReplyText'
DESC 'A reply text for every incoming message'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.44{4096}
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.11 NAME 'userStatus'
DESC 'The status of a user account'
EQUALITY integerMatch
ORDERING integerOrderingMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.12 NAME 'userRegisterDate'
DESC 'timestamp of user registration'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7914.1.2.1.13 NAME 'userExpireDate'
DESC 'timestamp of user mailbox expiration'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE )

# Object Class Definitions

objectclass ( 1.3.6.1.4.1.7914.1.2.2.1 NAME 'mailUser'
DESC 'Mail-LDAP User' SUP top STRUCTURAL
MUST ( mail $ cn $ uid )
MAY ( userPassword $ uidNumber $ gidNumber $ homeDirectory $ mailMessageStore $
mailHost $ mailForward $ mailQuota $ displayName $ mailReplyText $
userStatus $ userRegisterDate $ userExpireDate ) )

3、postfix.schema

# postfix-ldap directory schema v0.1
# Created by: netkiller
# Created: 2004-4-12
# Note: The attribute and objectclass OIDs are valid
# Attribute Type Definitions
# Postfix Style

#attributetype ( 1.3.6.1.4.1.7006.1.2.1.1 NAME 'uidnumber'
DESC 'UID of the user on the mailsystem'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )

#attributetype ( 1.3.6.1.4.1.7006.1.2.1.2 NAME 'gidnumber'
DESC 'GID of the user on the mailsystem'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.12461.1.1.5 NAME 'mailbox'
DESC 'The absolute path to the mailbox for a mail account in a non-default location'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.12461.1.1.6 NAME 'quota'
DESC 'A string that represents the quota on a mailbox'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.12461.1.1.8 NAME 'maildrop'
DESC 'RFC822 Mailbox - mail alias'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )

attributetype ( 1.3.6.1.4.1.12461.1.1.7 NAME 'clearPassword'
DESC 'A separate text that stores the mail account password in clear text'
EQUALITY octetStringMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128})


attributetype ( 1.3.6.1.4.1.12461.1.1.9 NAME 'mailsource'
DESC 'Message source'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

# Qmail Style

attributetype ( 1.3.6.1.4.1.7006.1.2.1.1 NAME 'qmailUID'
DESC 'UID of the user on the mailsystem'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.2 NAME 'qmailGID'
DESC 'GID of the user on the mailsystem'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.3 NAME 'mailMessageStore'
DESC 'Path to the maildir/mbox on the mail system'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.4 NAME 'mailAlternateAddress'
DESC 'Secondary (alias) mailaddresses for the same user'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.5 NAME 'mailQuota'
DESC 'The amount of space the user can use until all further messages get bounced.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.6 NAME 'mailHost'
DESC 'On which qmail server the messagestore of this user is located.'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.7 NAME 'mailForwardingAddress'
DESC 'Address(es) to forward all incoming messages to.'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.8 NAME 'deliveryProgramPath'
DESC 'Program to execute for all incoming mails.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.9 NAME 'qmailDotMode'
DESC 'Interpretation of .qmail files: both, dotonly, ldaponly, ldapwithprog, none'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.10 NAME 'deliveryMode'
DESC 'multi field entries of: normal, forwardonly, nombox, localdelivery, reply, echo'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.11 NAME 'mailReplyText'
DESC 'A reply text for every incoming message'
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.7006.1.2.1.12 NAME 'accountStatus'
DESC 'The status of a user account: active, nopop, disabled'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

# Postfix Virtual Domain

attributetype ( 1.3.6.1.4.1.12461.1.1.4 NAME 'vd'
DESC 'A virtual domain managed by Jamm'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.12461.1.1.1 NAME 'transport'
DESC 'A string directing postfix which transport to use'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{20} SINGLE-VALUE )

# Object Class Definitions

objectclass ( 1.3.6.1.4.1.12461.1.2.1 NAME 'postfixAccount'
DESC 'Postfix-LDAP User' SUP top AUXILIARY
MUST ( mail $ uid )
MAY ( mailbox $ quota $ maildrop $ clearPassword $
mailMessageStore $ homeDirectory $ userPassword $
mailAlternateAddress $ uidnumber $ gidnumber $ mailQuota $
mailHost $ mailForwardingAddress $ mailReplyText $
accountStatus ) )

objectclass ( 1.3.6.1.4.1.12461.1.2.2 NAME 'postfixAliases'
SUP top STRUCTURAL
DESC 'Mail aliasing/forwarding entry'
MUST ( mail $ uid )
MAY ( maildrop $ description $ mailForwardingAddress $ accountStatus ) )

objectclass ( 1.3.6.1.4.1.12461.1.2.3 NAME 'postfixVirtualDomain'
SUP top STRUCTURAL
DESC 'Virtual Domain entry to be used with postfix transport maps'
MUST ( vd $ transport )
MAY ( o $ description $ accountStatus ) )

# Qmail Object Class Definitions
objectclass ( 1.3.6.1.4.1.7006.1.2.2.1 NAME 'qmailUser'
DESC 'QMail-LDAP User' SUP top AUXILIARY
MUST ( mail $ uid )
MAY ( mailMessageStore $ homeDirectory $ userPassword $
mailAlternateAddress $ qmailUID $ qmailGID $ mailQuota $
mailHost $ mailForwardingAddress $ deliveryProgramPath $
qmailDotMode $ deliveryMode $ mailReplyText $
accountStatus ) )

你可能感兴趣的:(FREEbsd)