RHEL6 Postfix+Dovecot邮件系统配置
更新时间:2023-04-06 17:36:01 阅读量: 教育文库 文档下载
- rhel6推荐度:
- 相关推荐
下午闲来无事,就在RHEL6上面折腾了下邮件的收发,rhel5默认采用sendmail做为MTA,rhel6则采用postfix,以前也从来没玩过这个,因此今天折腾的时候遇到了蛮多的阻力,现在基本实现了邮件的收发功能,更多的postfix配置后期还需要不断的学习和整理,下面附上实验过程1:环境介绍
邮件服务器IP: 192.168.50.24/24,主机名为5a16123987c24028915fc392,因为
懒得去配dns,这里就用hosts文件来代替解析
客户端1 IP: 192.168.50.211/24,FreeBSD 8.1,使用telnet收信
客户端2 IP: 192.168.50.40/24, Win7,使用foxmail收发邮件
[root@rhel6 ~]# hostname
5a16123987c24028915fc392
[root@rhel6 ~]# cat /etc/hosts
192.168.50.24 5a16123987c24028915fc392 rhel6
127.0.0.1 localhost.localdomainlocalhost
2:安装postfix和dovecot软件包,这里为了省事,就采用rpm包方
式安装,后期可以去研究研究如何编译使用,rhel6默认已经安装好了postfix,所以只需要安装dovecot即可
[root@rhel6 ~]# rpm -qa |grep -E 'postfix|dovecot|sendmail +' postfix-2.6.6-2.el6.x86_64
dovecot-2.0-0.10.beta6.20100630.el6.x86_64
3:修改postfix主配置文件如下,各配置项的具体含义可以参考手册和注释
[root@rhel6 ~]# grep -v '^#' /etc/postfix/main.cf |grep -v '^$' queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
mydomain = 5a16123987c24028915fc392 //指定邮件域
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost unknown_local_recipient_reject_code = 550
mynetworks_style = subnet
mynetworks = 192.168.50.0/24, 127.0.0.0/8 //指定允许中继的IP 地址段
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
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 = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES [root@rhel6 ~]# service postfix start
启动 postfix: [确定]
本地发信测试
[root@rhel6 ~]# mail -s 'Postfix1'ylw6006@5a16123987c24028915fc392< /etc/hosts
win7客户端测试:
4:修改dovecot主配置文件如下
[root@rhel6 ~]# grep -v '^#' /etc/dovecot/dovecot.conf |grep -v
'^$' |grep -v '#'
!includeconf.d/*.conf //该配置项说明conf.d下的所以conf结尾的文件均有效,注意最前面的"!"号
protocols = imap pop3 lmtp
login_trusted_networks = 192.168.50.0/24 //指定允许登录的网段地址
dict {
}
若未设置login_trusted_networks参数值,使用telnet登录110端口,将会出现如下错误,不知道这个值能不能设置为四个零,这个还有待测试…
freebsd# telnet 192.168.50.24 110
Trying 192.168.50.24...
Connected to 192.168.50.24.
Escape character is '^]'.
+OK Dovecot ready.
<2564.2.4d106a4d.NTUFLnbszkRtt73yHZq2iw==@5a16123987c24028915fc392>
user oracle
-ERR Plaintext authentication disallowed on non-secure (SSL/TLS) connections.
pass oracle
-ERR Plaintext authentication disallowed on non-secure (SSL/TLS) connections.
quit
+OK Logging out
Connection closed by foreign host.
[root@rhel6 ~]# tail -f /var/log/maillog
Dec 21 16:51:00 rhel6 dovecot: pop3-login: Aborted login (tried to use disabled plaintext auth): rip=192.168.50.211,
lip=192.168.50.24, mpid=0
5:设置/etc/dovecot/conf.d/10-mail.conf配置文件如下:
[root@rhel6 ~]# grep -v '^#' /etc/dovecot/conf.d/10-mail.conf |grep -v '^$' |grep -v '#'
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mbox_write_locks = fcntl
如未设置mail_location参数值,将会出现如下错误:
freebsd# telnet 192.168.50.24 110
Trying 192.168.50.24...
Connected to 192.168.50.24.
Escape character is '^]'.
+OK Dovecot ready.
<2656.1.4d106ad9.Ovoh/mkl1gK+XPX5qohEbA==@5a16123987c24028915fc392>
user oracle
+OK
pass oracle
Connection closed by foreign host.
[root@rhel6 ~]# tail -f /var/log/maillog
Dec 21 16:52:50 rhel6 dovecot: pop3-login: Login: user=
Dec 21 16:52:50 rhel6 dovecot: pop3(oracle): Error: user oracle: Initialization failed: mail_location not set and autodetection failed: Mail storage autodetection failed with
home=/u01/oracle
Dec 21 16:52:50 rhel6 dovecot: pop3(oracle): Error: Invalid user settings. Refer to server log for more information.
设置完mail_location值后,需要重启dovecot服务,同时需要创建相关的目录,否则还会出现如下错误
freebsd# telnet 192.168.50.24 110
Trying 192.168.50.24...
Connected to 192.168.50.24.
Escape character is '^]'.
+OK Dovecot ready.
<2781.1.4d106bc3.JFuUEG+bO68ixpY2W1zihg==@5a16123987c24028915fc392>
user oracle
+OK
pass oracle
-ERR [IN-USE] Couldn't open INBOX: Internal error occurred. Refer to server log for more information. [2010-12-21 16:56:40] Connection closed by foreign host.
[root@rhel6 ~]# tail -f /var/log/maillog
Dec 21 16:56:40 rhel6 dovecot: pop3-login: Login: user=
Dec 21 16:56:41 rhel6 dovecot: pop3(oracle): Error:
chown(/u01/oracle/mail/.imap/INBOX, -1, 12(mail)) failed: Operation not permitted (egid=501(dba), group based on
/var/mail/oracle)
Dec 21 16:56:41 rhel6 dovecot: pop3(oracle): Error:
mkdir(/u01/oracle/mail/.imap/INBOX) failed: Operation not permitted
Dec 21 16:56:41 rhel6 dovecot: pop3(oracle): Error: Couldn't open INBOX: Internal error occurred. Refer to server log for more information. [2010-12-21 16:56:40]
Dec 21 16:56:41 rhel6 dovecot: pop3(oracle): Couldn't open INBOX top=0/0, retr=0/0, del=0/0, size=0
[root@rhel6 ~]# su - oracle
[oracle@rhel6 ~]$ mkdir -p /u01/oracle/mail/.imap/INBOX [oracle@rhel6 ~]$ exit
logout
[root@rhel6 ~]# mail -s 'Postfix mail test'oracle@5a16123987c24028915fc392< /etc/hosts
freebsd# telnet 192.168.50.24 110
Trying 192.168.50.24...
Connected to 192.168.50.24.
Escape character is '^]'.
+OK Dovecot ready.
<2867.1.4d106ca7.L311rFiY7/LIWOTM2Cp3Xg==@5a16123987c24028915fc392>
user oracle
+OK
pass oracle
+OK Logged in.
list
+OK 5 messages:
1 672
6:为了使新创建的用户可以自动创建这个目录,可以修改/etc/skel/.bash_profile文件如下
[root@rhel6 ~]# tail -4 /etc/skel/.bash_profile
if [ ! -d ~/mail/.imap/INBOX ];then
mkdir -p ~/mail/.imap/INBOX
fi
7:新建一个用户,并在win7 客户端收信测试
[root@rhel6 ~]# useradd tiger
[root@rhel6 ~]# echo '123456' |passwd --stdin tiger 更改用户 tiger 的密码。
passwd:所有的身份验证令牌已经成功更新。
[root@rhel6 ~]# mail -s 'tiger'tiger@5a16123987c24028915fc392< /etc/5a16123987c24028915fc392
正在阅读:
RHEL6 Postfix+Dovecot邮件系统配置04-06
案例分析03-31
数电大作业(智能数字钟) - 图文06-14
外出培训汇报材料03-08
直接和间接控制下合并财务报表实务探讨11-22
苏教版科学五年级下册单元测试卷全册01-28
成功经理人十二项自我管理能力(徐剑)07-25
2014年中国儿童用品行业发展战略08-11
如何用Excel进行数据处理08-19
公共广播系统投标方案 - 图文03-18
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 邮件系统
- 配置
- Dovecot
- Postfix
- RHEL6
- 基于ADS 微带耦合滤波器的设计和仿真
- 谈谈评价任务设计方案的三个步骤以及日常学习评价的四种常用方式
- 民用建筑工程室内环境污染控制规范
- 走出家庭教育误区 提高家庭教育质量
- (修订版)2103年度经济责任制考核办法
- 《7的加法》中班数学教案
- 【精华】中职班主任工作计划集锦6篇
- 起重机小车设计说明书201112
- 2022届高三普通高校统一招生考试仿真卷(三)英语试卷含答案
- 兴达煤矿联合试运转报告1
- 2022年最新学校意识形态工作落实制度汇编
- 建筑工程项目施工准备和施工部署详细完整版
- 金蝶K3 V12.2 管理驾驶舱系统用户手册
- 江苏省兴化市常青藤学校联盟2022学年八年级语文下学期第一次月考
- 2022年第二军医大学北京军区总医院347心理学专业综合之心理与教
- 【人教版】2015-2016学年新教材四年级上册数学:全册教案
- (春)五年级美术下册 第6课《喜怒哀乐》教案 人教版
- 全国GIS应用水平考试软件使用教程之MapGIS6x
- 思科技术视频:思科Cisco智变万变 思科新壹代企业网络架构 - 字
- 肖建华的五部工作法