邮件服务器postfix,saslauthd,dovecot安装配置提供SMTP服务
2017-10-19 13:52
639 查看
背景:Jenkins pipeline执行完成后把结果通过email发送给相关人员。配置Jenkins E-mail notification时需要指定SMTP server。因此,需要在服务器上安装配置提供SMTP服务。
前提:linux服务器的<hostname>.<mydomain> (e.g.: abc.def.com.cn) 可通过DNS进行解析
主要参考资料, https://www.2cto.com/os/201207/139757.html http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/cyrus-sasl.html https://stackoverflow.com/questions/42409722/cyrus-sasl-make-failed-expected-specifier-qualifier-list-error-on-digestmd5-c
=========================
安装以下包
yum install -y gcc gcc-c++
yum install -y openssl
yum install -y sendmail
yum install -y sendmail-cf
yum install -y postfix
yum install -y patch
yum install -y autoconf
yum install -y automake
yum install -y libtool
yum install -y dovecot
=========================
vi /etc/postfix/main.cf
myhostname = <hostname>.<mydomain> // e.g.: abc.def.com.cn
mydomain = <mydomain> // e.g.: def.com.cn
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks_style = subnet
mynetworks = 127.0.0.0/8, localhost, <my_ip_address> // e.g.: 61.135.169.125
relay_domains = $mydestination, <mydomain> // e.g.: def.com.cn, 此处加上<mydomain>,这样就能够发信给公司邮箱了(e.g. account@def.com.cn),否则会有Relay access denied报错
home_mailbox = Maildir/ //如果采用系统帐号作为邮件用户名,该目录为帐号下的目录
最后面添加(sasl加密算法支持)
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination,permit_mynetworks
smtpd_client_restrictions = permit_sasl_authenticated
=========================
安装Cyrus SASL
按照 http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/cyrus-sasl.html 安装Cyrus SASL
其中在make时抛错,参考以下链接解决 https://stackoverflow.com/questions/42409722/cyrus-sasl-make-failed-expected-specifier-qualifier-list-error-on-digestmd5-c
cp mac/libdes/public/des.h include/
vim plugins/digestmd5.c
add #include <des.h> after #include <ctypes.h>
==========================
ln -s /etc/sasl2/smtpd.conf /usr/lib/sasl2/smtpd.conf
vim etc/sysconfig/saslauthd
MECH=shadow
vi /etc/dovecot/dovecot.conf,解注释以下两行
protocols = imap pop3 pop3s
listen = *
重启服务
service postfix restart
service dovecot restart
service saslauthd restart
设置开机自启
chkconfig –-level 2345 postfix on
chkconfig –-level 2345 dovecot on
chkconfig –-level 2345 saslauthd on
或:
echo /usr/sbin/postfix >> /etc/rc.d/rc.local
echo /usr/sbin/dovecot >> /etc/rc.d/rc.local
echo /usr/sbin/saslauthd >> /etc/rc.d/rc.local
查看log:
/var/log/maillog
/var/log/message
前提:linux服务器的<hostname>.<mydomain> (e.g.: abc.def.com.cn) 可通过DNS进行解析
主要参考资料, https://www.2cto.com/os/201207/139757.html http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/cyrus-sasl.html https://stackoverflow.com/questions/42409722/cyrus-sasl-make-failed-expected-specifier-qualifier-list-error-on-digestmd5-c
=========================
安装以下包
yum install -y gcc gcc-c++
yum install -y openssl
yum install -y sendmail
yum install -y sendmail-cf
yum install -y postfix
yum install -y patch
yum install -y autoconf
yum install -y automake
yum install -y libtool
yum install -y dovecot
=========================
vi /etc/postfix/main.cf
myhostname = <hostname>.<mydomain> // e.g.: abc.def.com.cn
mydomain = <mydomain> // e.g.: def.com.cn
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks_style = subnet
mynetworks = 127.0.0.0/8, localhost, <my_ip_address> // e.g.: 61.135.169.125
relay_domains = $mydestination, <mydomain> // e.g.: def.com.cn, 此处加上<mydomain>,这样就能够发信给公司邮箱了(e.g. account@def.com.cn),否则会有Relay access denied报错
home_mailbox = Maildir/ //如果采用系统帐号作为邮件用户名,该目录为帐号下的目录
最后面添加(sasl加密算法支持)
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination,permit_mynetworks
smtpd_client_restrictions = permit_sasl_authenticated
=========================
安装Cyrus SASL
按照 http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/cyrus-sasl.html 安装Cyrus SASL
其中在make时抛错,参考以下链接解决 https://stackoverflow.com/questions/42409722/cyrus-sasl-make-failed-expected-specifier-qualifier-list-error-on-digestmd5-c
cp mac/libdes/public/des.h include/
vim plugins/digestmd5.c
add #include <des.h> after #include <ctypes.h>
==========================
ln -s /etc/sasl2/smtpd.conf /usr/lib/sasl2/smtpd.conf
vim etc/sysconfig/saslauthd
MECH=shadow
vi /etc/dovecot/dovecot.conf,解注释以下两行
protocols = imap pop3 pop3s
listen = *
重启服务
service postfix restart
service dovecot restart
service saslauthd restart
设置开机自启
chkconfig –-level 2345 postfix on
chkconfig –-level 2345 dovecot on
chkconfig –-level 2345 saslauthd on
或:
echo /usr/sbin/postfix >> /etc/rc.d/rc.local
echo /usr/sbin/dovecot >> /etc/rc.d/rc.local
echo /usr/sbin/saslauthd >> /etc/rc.d/rc.local
查看log:
/var/log/maillog
/var/log/message
相关文章推荐
- centos 邮件服务器postfix,saslauthd,dovecot安装配置.
- CentOS 64位下安装Postfix+Dovecot 配置邮件服务器笔记
- Ubuntu 服务器管理员手记(二):快速安装配置邮件服务器(详解 Postfix + Dovecot)
- CentOS 6.x 下Postfix和dovecot邮件服务安装和基本配置
- 基于Postfix构建邮件服务器 配置smtp发信服务 配置pop和imap收信服务
- 烂泥:Postfix邮件服务器搭建之软件安装与配置
- Windows Server 2008中安装配置SMTP服务
- Postfix邮件服务器搭建之软件安装与配置
- Postfix邮件服务器搭建之软件安装与配置
- 烂泥:Postfix邮件服务器搭建之软件安装与配置
- 在Windows Server 2008R2中安装配置SMTP服务
- linux下Postfix邮件服务安装和基本配置
- 邮件服务器安装--Postfix + Dovecot + Squirrelmail--CentOS 6.4
- linux下邮件服务器系统postfix安装与配置
- postfix dovecot 安装配置客户端收信
- CentOS 64位下安装Postfix+Dovecot 配置邮件server笔记
- Centos smtp 邮件服务器安装及配置 ZT
- 邮件系统安装配置(postfix + dovecot)
- Postfix(二):为邮件服务器配置收件服务器----dovecot
- Ubuntu 12.04安装配置Postfix dovecot cyrus sasl(mysql虚拟用户)