Chinaunix首页 | 论坛 | 博客
  • 博客访问: 692842
  • 博文数量: 98
  • 博客积分: 3145
  • 博客等级: 中校
  • 技术积分: 1902
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-15 12:52
文章分类
文章存档

2021年(1)

2020年(1)

2016年(8)

2015年(3)

2014年(1)

2013年(5)

2012年(4)

2011年(9)

2010年(12)

2009年(42)

2008年(12)

我的朋友

分类:

2009-11-26 11:05:54

1.说明

   此邮件系统采用目前企业比较普遍的postfixextmail系统,其中管理采用extman系统,使用环境为apache+mysql,邮件系统认证使用mysql方式,POP3支持用courier软件。全套系统用的开源环境,测试收发邮件及客户端pop3均正常,认证密码采用md5crypt加密。

2.安装准备

 准备如下:

 硬件准备:

   一台服务器,配置要求能安装debian系统,并且硬盘空间有10G以上(存放mail

 软件准备:

 操作系统:debian4 update8

WEBMAIL:

 下载extmail/extman

登陆,下载最新的extmail/extman

下载下面3个文件:

extmail-1[1][1].1.1.tar.gz  extman-1[1][1].0.1.tar.gz  maildir_upgrade_mysql-1[1][1].0.tar.gz

放到/opt/distfiles/

系统环境:

需要安装下面包:

libperl-dev

rrdtools

libperl-dev

libsendmail-pmilter-perl

libtime-modules-perl

libtime-period-perl

libsys-syslog-perl

libunix-syslog-perl

libgd-securityimage-perl

libgd-perl

librrds-perl

libfile-tail-perl

libart-dev

libart-2.0-dev

libart2

libpng12-dev

libpng12-0

libttf-dev

libttf2

tk8.3 

tk8.3-dev

3.安装步骤

3.1安装apache2+php+mysql环境

说明:其实php是不用安装的

 

安装apache2+php5:

 

#apt-get install apache2 libapache2-mod-php5

注:apache需要配置suexec模块支持

安装mysql:

#apt-get install mysql-server-5.0

注:默认密码为空

3.2安装postfix

#apt-get install postfix postfix-doc postfix-tls postfix-mysql

3.3 安装SASL2

#apt-get install libsasl2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl libpam-modules libpam-mysql

3.4 安装COURIER

#apt-get install courier-base courier-pop courier-imap courier-authdaemon courier-authlib-mysql

 

4.配置

4.1配置postfix

#cd /etc/postfix

 

#mv main.cf main.cf.bak

 

#vi main.cf

 

加入内容:

smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem

smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

smtpd_use_tls=yes

smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache

smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for

myhostname = vip.eol.cn

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

myorigin = /etc/mailname

mydestination =

relayhost =

mynetworks = 0.0.0.0/8

inet_interfaces = all

 

#=====================MySQL=====================

virtual_alias_maps = mysql:/etc/postfix/mysql/mysql_virtual_alias_maps.cf

virtual_uid_maps = static:105

virtual_gid_maps = static:105

virtual_mailbox_base = /home/domains

virtual_mailbox_domains = mysql:/etc/postfix/mysql/mysql_virtual_domains_maps.cf

virtual_mailbox_limit = 51200000

virtual_mailbox_maps = mysql:/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf

virtual_minimum_uid = 105

virtual_transport = virtual

#=====================Quota=====================

virtual_create_maildirsize = yes

virtual_mailbox_extended = yes

virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql/mysql_virtual_mailbox_limit_maps.cf

virtual_mailbox_limit_override = yes

virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.

virtual_overquota_bounce = yes

#=====================SASL2====================

smtpd_sasl_auth_enable = yes

smtpd_sasl_security_options = noanonymous

broken_sasl_auth_clients = yes

smtpd_delay_reject=yes

smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,permit_auth_destination,reject

smtpd_client_restrictions = permit_sasl_authenticated

创建mysql虚拟配置文件:

#mkdir mysql

 

#cd mysql

 

#vi /etc/postfix/mysql/mysql_virtual_alias_maps.cf

 

加入:

user = extmail

password = extmail

#hosts = localhost

hosts = 219.224.99.244

dbname = extmail

table = alias

select_field = goto

where_field = address

additional_conditions = AND active = '1'

 

#vi /etc/postfix/mysql/mysql_virtual_domains_maps.cf

 

加入:

user = extmail

password = extmail

#hosts = localhost

hosts = 219.224.99.244

dbname = extmail

table = domain

select_field = domain

where_field = domain

additional_conditions = AND active = '1'

#vi /etc/postfix/mysql/mysql_virtual_mailbox_maps.cf

加入:

user = extmail

password = extmail

#hosts = localhost

hosts = 219.224.99.244

dbname = extmail

table = mailbox

select_field = maildir

where_field = username

additional_conditions = AND active = '1'

 

#vi /etc/postfix/mysql/mysql_virtual_mailbox_limit_maps.cf

加入:

user = extmail

password = extmail

#hosts = localhost

hosts = 219.224.99.244

dbname = extmail

table = mailbox

select_field = quota

where_field = username

additional_conditions = AND active = '1'

 

4.2配置smtp

#vi /etc/default/saslauthd

start=no改成yes

#vi /etc/postfix/sasl/smtpd.conf

加入:

pwcheck_method: authdaemond

log_level: 7

mech_list: plain login

authdaemond_path:/var/run/courier/authdaemon/socket

 

# vi /etc/pam.d/smtp

加入:

auth    required  pam_mysql.so user=extmail passwd=extmail host=202.205.109.7 db=extmail table=mailbox usercolumn=username passwdcolumn=password crypt=1

account sufficient pam_mysql.so user=extmail passwd=extmail host=202.205.109.7 db=extmail table=mailbox usercolumn=username passwdcolumn=password crypt=1

4.3配置pop3

# vi /etc/courier/pop3d

修改下面一些地方:

POP3AUTH="" 改为POP3AUTH=" CRAM-MD5"

 

#mv /etc/courier/authdaemonrc /etc/courier/authdaemonrc.bak

 

#vi /etc/courier/authdaemonrc

加入:

authmodulelist="authmysql"

authmodulelistorig="authmysql"

version="authdaemond.mysql"

daemons=5

subsystem=mail

DEBUG_LOGIN=2

DEFAULTOPTIONS=""

authdaemonvar=/var/run/courier/authdaemon

 

#vi /etc/courier/authmodulelist

修改认证模式为authmysql

# mv /etc/courier/authmysqlrc /etc/courier/authmysqlrc.bak

#vi /etc/courier/authmysqlrc

加入:

MYSQL_SERVER    219.224.99.244

MYSQL_PORT 3306

MYSQL_USERNAME   extmail

MYSQL_PASSWORD   extmail

MYSQL_SOCKET   /var/run/mysqld/mysqld.sock

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)'

阅读(1697) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~