设为首页 收藏本站
查看: 2874|回复: 0

[经验分享] Extmail邮件服务器centos搭建(一)

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-5-30 09:28:03 | 显示全部楼层 |阅读模式
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
[iyunv@node2 ~]# 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

[iyunv@node2 ~]# 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

[确定]

[iyunv@node2 ~]# service mysqld start

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

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

[iyunv@node2 ~]# mysqladmin password aolens    #为数据库设置密码
3.2 安装postfix

[iyunv@node2 ~]# rpm -qa postfix

postfix-2.6.6-2.2.el6_1.x86_64

[iyunv@node2 ~]# rpm -e postfix --nodeps

[iyunv@node2 ~]# id postfix
uid=89(postfix) gid=89(postfix) 组=89(postfix),12(mail)

[iyunv@node2 ~]# userdel postfix

[iyunv@node2 ~]# groupdel postfix

[iyunv@node2 ~]# grep postfix /etc/passwd

[iyunv@node2 ~]# rm -rf /var/spool/postfix

[iyunv@node2 ~]# groupadd -g 2525 postfix

[iyunv@node2 ~]# useradd -g postfix -u 2525 -s /sbin/nologin -M postfix

[iyunv@node2 ~]# groupdel postdrop

[iyunv@node2 ~]# groupadd -g 2526 postdrop
[iyunv@node2 ~]# useradd -g postdrop -u 2526 -s /sbin/nologin -M postdrop

[iyunv@node2 ~]# 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
[iyunv@node2 ~]# wget ftp://ftp.cuhk.edu.hk/pub/packag ... 3.2-20160327.tar.gz

[iyunv@node2 ~/postfix-3.2-20160327]# yum install cyrus-sasl*

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

[iyunv@node2 ~/postfix-3.2-20160327]# 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’

[iyunv@node2 ~/postfix-3.2-20160327]# make && make install && echo ok

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

install_root: [/] /
tempdir: [/root/postfix-3.2-20160327] /tmp
config_directory: [/etc/postfix] /etc/postfix
command_directory: [/usr/sbin] /usr/sbin
daemon_directory: [/usr/libexec/postfix]
data_directory: [/var/lib/postfix]
html_directory: [no] /var/www/postfix_html
mail_owner: [postfix]
mailq_path: [/usr/bin/mailq]
manpage_directory: [/usr/local/man]
queue_directory: [/var/spool/postfix]
readme_directory: [no]
sendmail_path: [/usr/sbin/sendmail]
setgid_group: [postdrop]
shlib_directory: [no]
meta_directory: [/etc/postfix]
[iyunv@node2 ~/postfix-3.2-20160327]# 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

[iyunv@node2 /media]# mkdir postfix2.6

[iyunv@node2 /media]# cd postfix2.6/

[iyunv@node2 /media/postfix2.6]# wget http://mirrors.sohu.com/centos/6 ... -6.el6_5.x86_64.rpm

[iyunv@node2 /media/postfix2.6]# rpm2cpio postfix-2.6.6-6.el6_5.x86_64.rpm |cpio -id

19862 块

[iyunv@node2 /media/postfix2.6]# ls *

postfix-2.6.6-6.el6_5.x86_64.rpm

etc:

pam.d  postfix  rc.d  sasl2

usr:

bin  lib  libexec  sbin  share

var:

lib  spool



#创建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
[iyunv@node2 /media/postfix2.6/etc/rc.d/init.d]# cp -p postfix /etc/init.d/

[iyunv@node2 ~]# chown -R postfix /var/lib/postfix

[iyunv@node2 ~]# service postfix start

启动 postfix:                                             [确定]

[iyunv@node2 ~]# ss -tnlp|grep 25
LISTEN     0      100                       *:25                       *:*      users:(("master",55347,13))

[iyunv@node2 ~]# chkconfig --add postfix

[iyunv@node2 ~]# chkconfig postfix on

[iyunv@node2 ~]# 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
[iyunv@mail ~]# service saslauthd start

正在启动 saslauthd:                                       [确定]

[iyunv@mail ~]# 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
[iyunv@mail ~]# useradd test

[iyunv@mail ~]# 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.

[iyunv@mail ~]# vim /var/spool/mail/test

From aolens@aolens.cn  Wed 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 [127.0.0.1])

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、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-223728-1-1.html 上篇帖子: 安装CENTOS 6.5 32位(CentOS-6.5-i386)+postfix+dovecot+openwebmail passwd验证的邮件系统 下篇帖子: Extmail邮件服务器centos搭建(二) 邮件服务器
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表