Postfix+Extmail安装文档
一、 简介
二、 安装
2.1、配置yum安装源
2.2、postfix安装
2.3、安装Courier-Authlib
2.4、安装maildrop
2.5、安装cyrus-sasl
2.6、安装Courier-imap
2.7、安装extmail
2.8、extman安装
2.9、apache配置
3.0、访问extmail/extman
三、 测试smtp/pop3认证
一、 简介
详细见官方文档
http://wiki.extmail.org/extmail_solution_for_linux
1
、
AM ----apache+mysql
2
、
Postfix
�C
mta
邮件系统
3
、
Courier-authlib--
个为
courier-imap
,
maildrop
,
sasl2
提供用户信息的后台进程序
4
、
Courier-imap
�C提供
pop3
服务
5
、
extmail
--一个著名的
webmail
程序
6
、
extman
--与
extmail
集成的后台管理程序
二、 安装
2.1、配置yum安装源
Vi etc/yum.repos.d/Mail-Base.repo
# Mail-Base.repo
# Created by ExtMail Dev Team: http://www.extmail.org/
# $Id$
[EMOS-base]
name=EMOS-Base
baseurl=http://mirror.extmail.org/yum/emos/1.4/os/$basearch/
gpgcheck=0
priority=0
protect=0
[EMOS-update]
name=EMOS-Updates
baseurl=http://mirror.extmail.org/yum/emos/1.4/updates/$basearch/
gpgcheck=0
priority=0
protect=0
|
更新yum
源
Yum clean all
Yum list
2.2、postfix安装
# export RPMS=/usr/src/redhat/RPMS
# export SOURCE=/usr/src/redhat/SOURCES
# export SPEC=/usr/src/redhat/SPECS
# wget http://ftp.wl0.org/official/2.5/SRPMS/postfix-2.5.4-2.src.rpm
# rpm -ivh postfix-2.5.4-2.src.rpm
下载
创建
rpm
# cd $SPEC
修改下面选项
%define distribution rhel-5.0
%define with_mysql_redhat 1
%define with_sasl 2
%define with_vda 1
|
# rpmbuild -bb postfix.spec
# cd $RPMS/i386
# rpm -ivh postfix-2.5.4-2.rhel4.i386.rpm
切换mta
# alternatives --config mta
(选择
2
,
postfix
)
# rpm -e sendmail
# cd /usr/sbin/
# mv sendmail sendmail.bak
# newaliases
# ln -s sendmail.postfix sendmail
配置postfix
# cd /etc/postfix/
# mv main.cf main.cf.bak
# vim main.cf
输入下面的内容:
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = /usr/share/doc/postfix-2.5.2-documentation/html
manpage_directory = /usr/share/man
sample_directory = /etc/postfix
readme_directory = /usr/share/doc/postfix-2.5.2-documentation/readme
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
myhostname = mail.test.com
mydomain = test.com
mydestination = $myhostname
smtpd_banner = test.com ESMTP Mail System
message_size_limit = 14680064
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_base = /home/data/domains
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_limit_maps.cf
virtual_transport = maildrop:
maildrop_destination_recipient_limit = 1
#sasl
smtpd_sasl_auth_enable = yes
smtpd_sasl2_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_unauth_pipelining,
reject_invalid_hostname
2.3、安装Courier-Authlib
安装以下软件包:
# yum install courier-authlib
# yum install courier-authlib-mysql
编辑
/etc/authlib/authmysqlrc
文件
:
# vi /etc/authlib/authmysqlrc
并将其内容清空,然后增加如下内容
:
MYSQL_SERVER localhost
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_PORT 3306
MYSQL_OPT 0
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD uidnumber
MYSQL_GID_FIELD gidnumber
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD homedir
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD maildir
MYSQL_QUOTA_FIELD quota
MYSQL_SELECT_CLAUSE SELECT username,password,"",uidnumber,gidnumber,\
CONCAT('/home/domains/',homedir), \
CONCAT('/home/domains/',maildir), \
quota, \
name \
FROM mailbox \
WHERE username = '$(local_part)@$(domain)'
修改authdaemonrc
文件
# vi /etc/authlib/authdaemonrc
修改如下内容
:
authmodulelist="authmysql"
authmodulelistorig="authmysql"
如一切正常,命令行将返回如下信息:
Starting Courier authentication services: authdaemond
修改
authdaemon socket
目录权限
如果该目录权限不正确修改,
maildrop
及
postfix
等将无法正确获取用户的信息及密码认证:
# chmod 755 /var/spool/authdaemon/
2.4、安装maildrop
# yum install maildrop
maildrop RPM
包安装时,会自动创建
vuser
用户及
vgroup
用户组,专门用于邮件的存储
配置
master.cf
为了使
Postfix
支持
Maildrop
,必须修改
/etc/postfix/master.cf
文件,注释掉原来的
maildrop
的配置内容,并改为:
maildrop unix - n n - - pipe
flags=DRhu user=vuser argv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}
|
配置
main.cf
由于
maildrop
不支持一次接收多个收件人,因此必须在
main.cf
里增加如下参数:
maildrop_destination_recipient_limit = 1