2.5、安装cyrus-sasl

删除系统的cyrus-sasl

# rpm -e --nodeps cyrus-sasl

# yum install cyrus-sasl

配置main.cf文件

# vi /etc/postfix/main.cf

增加如下内容:

# smtpd related config

smtpd_recipient_restrictions =

        permit_mynetworks,

        permit_sasl_authenticated,

        reject_non_fqdn_hostname,

        reject_non_fqdn_sender,

        reject_non_fqdn_recipient,

        reject_unauth_destination,

        reject_unauth_pipelining,

        reject_invalid_hostname,

# SMTP sender login matching config

smtpd_sender_restrictions =

        permit_mynetworks,

        reject_sender_login_mismatch,

        reject_authenticated_sender_login_mismatch,

        reject_unauthenticated_sender_login_mismatch

smtpd_sender_login_maps =

        mysql:/etc/postfix/mysql_virtual_sender_maps.cf,

        mysql:/etc/postfix/mysql_virtual_alias_maps.cf 

# SMTP AUTH config here

broken_sasl_auth_clients = yes

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain = $myhostname

smtpd_sasl_security_options = noanonymous

 

 

编辑smtpd.conf文件

 

# vi /usr/lib/sasl2/smtpd.conf

 

 

确保其内容为:

pwcheck_method: authdaemond

log_level: 3

mech_list: PLAIN LOGIN

authdaemond_path:/var/spool/authdaemon/socket

 

 

2.6、安装Courier-imap

# yum install courier-imap

配置courier-imap

# vi /usr/lib/courier-imap/etc/imapd

修改内容如下:

IMAPDSTART=NO

# vi /usr/lib/courier-imap/etc/imapd-ssl

修改内容如下:

IMAPDSSLS=NO

2.7、安装extmail

# yum install extsuite-webmail

编辑webmail.cf

# cd /var/www/extsuite/extmail

# cp webmail.cf.default webmail.cf

# vi webmail.cf

主要变动的内容见下:

SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS = extmail

SYS_MYSQL_DB = extmail

 

更新cgi目录权限 由于SuEXEC的需要,必须将extmailcgi目录修改成vuser:vgroup权限:

 

# chown -R vuser:vgroup /var/www/extsuite/extmail/cgi/

2.8extman安装

# yum install extsuite-webman

# chown -R vuser:vgroup /var/www/extsuite/extman/cgi/

目录权限设置

# mkdir /tmp/extman

# chown -R vuser:vgroup /tmp/extman

数据库初始化

# mysql -u root -p < /var/www/extsuite/extman/docs/extmail.sql

# mysql -u root -p < /var/www/extsuite/extman/docs/init.sql

设置虚拟域和虚拟用户的配置文件

# cd /var/www/extsuite/extman/docs

# cp mysql_virtual_alias_maps.cf /etc/postfix/

# cp mysql_virtual_domains_maps.cf /etc/postfix/

# cp mysql_virtual_mailbox_maps.cf /etc/postfix/

# cp mysql_virtual_sender_maps.cf /etc/postfix/

 

配置main.cf

# vi /etc/postfix/main.cf

增加以下内容:

# extmail config here

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

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

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

virtual_transport = maildrop:

2.9apache配置

编辑httpd.conf文件

vi /etc/httpd/conf/httpd.conf

在最后一行加上

Include conf/http-extmail.conf

编辑http-extmail.conf

输入以下内容

Alias /extman/cgi/ /var/www/extsuite/extman/cgi/

Alias /extman /var/www/extsuite/extman/html/

<Location "/extman/cgi">

SetHandler cgi-script

Options +ExecCGI

</Location>

# config for ExtMail

Alias /extmail/cgi/ /var/www/extsuite/extmail/cgi/

Alias /extmail /var/www/extsuite/extmail/html/

<Location "/extmail/cgi">

SetHandler cgi-script

Options +ExecCGI

</Location>

启动postfix相关服务

# /etc/init.d/httpd start

# /etc/init.d/courier-authlib start

# /etc/init.d/courier-imap start

# /etc/init.d/postfix start

3.0、访问extmail/extman

输入http://IP/extmail

用户名:postmaster 密码:extmail 域:extmail.org

输入http://IP/extman

用户为:root@extmail.org 密码为:extmail*123*

三、  测试smtp/pop3认证

# telnet localhost 25

Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

220 mail.extmail.org ESMTP Postfix - by extmail.org

ehlo extmail.org     << 输入内容

250-mail.extmail.org

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-AUTH LOGIN PLAIN

250-AUTH=LOGIN PLAIN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN

auth login     << 输入内容

334 VXNlcm5hbWU6

cG9zdG1hc3RlckBleHRtYWlsLm9yZw==     << 输入内容

334 UGFzc3dvcmQ6

ZXh0bWFpbA==     << 输入内容

235 2.0.0 Authentication successful

quit     << 输入内容

221 2.0.0 Bye

最后出现235 Authentication Successful 表明认证成功了。

Pop3测试

# telnet localhost 110

Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

+OK Hello there.

user postmaster@extmail.org     << 输入内容

+OK Password required.

pass extmail     << 输入内容

+OK logged in.

list     << 输入内容

+OK POP3 clients that break here, they violate STD53.

.

quit     << 输入内容

+OK Bye-bye.

Connection closed by foreign host.