邮件服务器

Cyrus+postfix

 

yum install postfix
yum install cyrus

 

postfix 不能和 sendmail  同时使用

 

服务器版本CentOS 7----1611  内核版本3.10.0-514.el7.x86_64

Centos7与之前的版本不一样的命令systemctl和 防火墙firewall-cmd命令

firewalld与iptables-service无法共存

 

采用教程参考

http://www.cnblogs.com/apexchu/p/4271264.html

http://blog.csdn.net/clyao_123456/article/details/46693579

 

 

配置修改:

1、Postfix配置文件/etc/postfix/main.cf

[root@mailmonitor postfix]# vim /etc/postfix/main.cf  
myhostname = localhost  //76行,后边写邮箱主机名即mail.****.***  
mydomain = 51yip.com   //83行,设置域名  
myorigin = $mydomain   //99行,去掉注释#  
inet_interfaces = all  //113行,把后面的localhost改成all  
mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain //164行,把前面的注释拿掉,并加一下$mydomain  
mynetworks = 192.168.0.0/16, 127.0.0.0/8  //264行,设置内网和本地IP  
local_recipient_maps =  //210行,去掉注释#  
smtpd_banner = $myhostname ESMTP unknow //573行,去掉注释#,然后把$mail_name ($mail_version)改成unknow  
  
//在main.cf文件的底部加上以下内容  
smtpd_sasl_auth_enable = yes     //使用SMTP认证  
broken_sasl_auth_clients = yes   //让不支持RFC2554的smtpclient也可以跟postfix做交互。  
smtpd_sasl_local_domain = $myhostname  // 指定SMTP认证的本地域名  
smtpd_sasl_security_options = noanonymous //取消匿名登陆方式  
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination //设定邮件中有关收件人部分的限制  
smtpd_sasl_security_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination //设置允许范围 未生效 
message_size_limit = 15728640     //邮件大小  
mailbox_transport=lmtp:unix:/var/lib/imap/socket/lmtp   //设置连接cyrus-imapd的路径

 

参考两位的配置中有个参数在实际使用中无法生效  smtpd_sasl_security_restrictions  加上该选项postfix无法正常使用,因此我给注释掉了。

 

2、cyrus配置更改

         Cyrus-sasl配置

[root@localhost postfix]# vim /etc/sasl2/smtpd.conf  //在文件尾部加上以下内容  
log_level: 3     //记录log的模式  
saslauthd_path:/var/run/saslauthd/mux     //设置一下smtp寻找cyrus-sasl的路径

cyrus-imapd配置文件/etc/sysconfig/cyrus-imapd,/etc/cyrus.conf,/etc/imapd.conf。imapd.conf还包含非常多的参数,例如邮件存储目录、管理员账号、连接认证方式等等。

 

 

启动命令:

systemctl startpostfix
systemctl startsasl-authd
systemctl startcyrus-imapd

 

 

防火墙需要添加的命令

firewall-cmd –zone=public  --add-port=25/tcp –permanent //永久添加25端口

or

firewall-cmd  --addservice=smtp  –permanent //直接添加服务

 

firewall-cmd –get-services  可以得到所有存在的服务

firewall-cmd –list-all列出所有信息

防火墙动态更新命令 firewall-cmd–reload

 

查看端口监听

netstat –tpnl |grep  port

 

测试邮件命令

mail -s ‘title’*****@**mail < /root/test(邮件内容)


添加账号

wKiom1jq--vRu_7fAAAmAY8Inyk056.png-wh_50



最近在使用的DNS的过程中,被安全系统扫描出域名传送的漏洞

域名传送可以使用dig命令查询到域名的所有的解析

解决办法:

修改配置文件/etc/named.conf

在zone里加上

allow-transfer {localhost;本机IP};