21232asa 发表于 2016-5-30 09:28:03

Extmail邮件服务器centos搭建(一)

1,Extmail概述
ExtMail Solution 是一个基于优秀开源软件的电子邮件系统解决方案,核心部件包括了Postfix、Amavisd-new、ClamAV、ExtMail、ExtMan、Courier系列软件。是一个功能相对比较齐全的免费电子邮件系统。而其中Extmail 是一个以perl语言编写,面向大容量/ISP级应用,免费的高性能Webmail软件,主要包括ExtMail、Extman两个部分的程序套件。ExtMail套件用于提供从浏览器中登录、使用邮件系统的Web操作界面,而Extman套件用于提供从浏览器中管理邮件系统的Web操作界面。2,Extmail工作原理Extmail的核心部分是postfix,是一种web页面,可以创建账号,可以收发邮件。extman可以账号注册。账号存放在mysql里面。postfix发信件,dovecot收信件。利用outlook收信件(docecot)和发信件(postfix)都要通过mysql查询。发信件(postfix)要提取mysql账号信息要通过courier-authlib。是基于虚拟帐号的邮件系统。配置准备:修改主机名为mail.aolens.cn在DNS上解析mail.aolens.cn
[*]@ MX mail.aolens.cn

[*]mail A ip地址

3,Extmail搭建3.1 安装依赖
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# yum install httpd mysql mysql-server mysql-devel openssl-devel dovecot perl-DBD-MySQL tcl tcl-devel libart_lgpl libart_lgpl-devel libtool-ltdl libtool-ltdl-devel expect

# yum groupinstall "Development Libraries” “Development Tools"

root@node2 ~]# service httpd start

正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using node2.aolens.cn for ServerName

[确定]

# service mysqld start

初始化 MySQL 数据库: Installing MySQL system tables...

[确定]
正在启动 mysqld:                                          [确定]

# mysqladmin password aolens    #为数据库设置密码
3.2 安装postfix

# rpm -qa postfix

postfix-2.6.6-2.2.el6_1.x86_64

# rpm -e postfix --nodeps

# id postfix
uid=89(postfix) gid=89(postfix) 组=89(postfix),12(mail)

# userdel postfix

# groupdel postfix

# grep postfix /etc/passwd

# rm -rf /var/spool/postfix

# groupadd -g 2525 postfix

# useradd -g postfix -u 2525 -s /sbin/nologin -M postfix

# groupdel postdrop

# groupadd -g 2526 postdrop
# useradd -g postdrop -u 2526 -s /sbin/nologin -M postdrop

# grep post* /etc/passwd

postfix:x:2525:2525::/home/postfix:/sbin/nologin

postdrop:x:2526:2526::/home/postdrop:/sbin/nologin




postfix版本:postfix-3.2-20160327

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# wget ftp://ftp.cuhk.edu.hk/pub/packages/mail-server/postfix/experimental/postfix-3.2-20160327.tar.gz

# yum install cyrus-sasl*

SASL:Simple Authintication Secure Layer简单认证安全层,用来认证邮箱账号的

# make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS ' 'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm -L/usr/lib64/sasl2 -lsasl2 -lssl -lcrypto’

# make && make install && echo ok

按照以下提示输入相关路径,省略表示采用默认值

install_root: [/] /
tempdir: /tmp
config_directory: /etc/postfix
command_directory: /usr/sbin
daemon_directory:
data_directory:
html_directory: /var/www/postfix_html
mail_owner:
mailq_path:
manpage_directory:
queue_directory:
readme_directory:
sendmail_path:
setgid_group:
shlib_directory:
meta_directory:
# newaliases

newaliases: warning: smtputf8_enable is true, but EAI support is not compiled in

postalias: warning: smtputf8_enable is true, but EAI support is not compiled in

# mkdir postfix2.6

# cd postfix2.6/

# wget http://mirrors.sohu.com/centos/6.7/os/x86_64/Packages/postfix-2.6.6-6.el6_5.x86_64.rpm

# rpm2cpio postfix-2.6.6-6.el6_5.x86_64.rpm |cpio -id

19862 块

# ls *

postfix-2.6.6-6.el6_5.x86_64.rpm

etc:

pam.dpostfixrc.dsasl2

usr:

binliblibexecsbinshare

var:

libspool




#创建sysv脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# cp -p postfix /etc/init.d/

# chown -R postfix /var/lib/postfix

# service postfix start

启动 postfix:                                             [确定]

# ss -tnlp|grep 25
LISTEN   0      100                     *:25                     *:*      users:(("master",55347,13))

# chkconfig --add postfix

# chkconfig postfix on

# vim /etc/postfix/main.cf

#添加下列参数

myhostname = mail.aolens.cn

mydomain = aolens.cn
myorigin = aolens.cn    #邮件地址伪装伪装mail.aolens.cn为aolens.cn

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain       #所有目标邮件为以上的就是本机,不用中继了

mynetworks = 192.168.1.0/24,127.0.0.0/8




##这里注意一下,我192.168.1.0/24开始的时候写成192.168.1.129/24 导致rcpt to:.. 一直453错误。使用以下命令验正postfix是否支持cyrus风格的sasl认证,如果您的输出为以下结果,则是支持的:
1
2
3
4
5
6
7
8
9
# service saslauthd start

正在启动 saslauthd:                                       [确定]

# postconf -a

cyrus

dovecot




postconf命令:配置postfix
[*]-d:显示默认的配置

[*]-n:显示修改的配置

[*]-m:显示所有所支持的查找表类型

[*]-a:显示支持的SASL客户端插件类型

[*]-e:PARMATER=VALUE:更改某参数配置信息,并保存至main.cf文件中

smtp状态码:
[*]1XX:

[*]2XX:正确信息

[*]3XX:当前信息没有结束

[*]4XX:暂时性错误

[*]5XX:永久性错误

smtp:协议命令
[*]helo (smtp协议)

[*]ehlo (esmtp协议)

[*]mail from:    邮件发送人

[*]rcpt to: 邮件接收人

[*]date 邮件内容

[*]Subject: 邮件标题

[*]. 邮件结束符

alias:邮件别名abc@abc.com:efg@efg.com   法网abc的其实会发到efg使用newaliases来生成/etc/aliases.db验证postfix是否安装OK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# useradd test

# telnet localhost 25

Trying ::1...

telnet: connect to address ::1: Connection refused

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 Welcome to our mail.aolens.cn ESMTP,Warning: Version not Available!

helo

501 Syntax: HELO hostname

helo localhost

250 mail.aolens.cn

mail from:aolens@aolens.cn

250 2.1.0 Ok

rcpt to:test

250 2.1.5 Ok

data

354 End data with <CR><LF>.<CR><LF>

Subject:aaa

aaaaaaa

.

250 2.0.0 Ok: queued as 2B78580CCB

quit

221 2.0.0 Bye

Connection closed by foreign host.

# vim /var/spool/mail/test

From aolens@aolens.cnWed May 11 10:24:45 2016

Return-Path: <aolens@aolens.cn>

X-Original-To: test

Delivered-To: test@mail.aolens.cn

Received: from localhost (localhost )

by mail.aolens.cn (Postfix) with SMTP id 2B78580CCB

for <test>; Wed, 11 May 2016 10:24:25 +0800 (CST)

Subject:aaa

Message-Id: <20160511022433.2B78580CCB@mail.aolens.cn>

Date: Wed, 11 May 2016 10:24:25 +0800 (CST)

From: aolens@aolens.cn

aaaaaaa




我们发现在邮件投递目录里对应的用户中有我们发送过来的邮件。这就说明发送成功了


页: [1]
查看完整版本: Extmail邮件服务器centos搭建(一)