最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Centos7.9搭建自主郵件服務(wù)器詳細步驟

 更新時間:2021年12月03日 15:49:02   作者:黑驢騎士  
大家好,本篇文章主要講的是Centos7.9搭建自主郵件服務(wù)器詳細步驟,感興趣的同學(xué)趕快來看一看吧,對你有幫助的話記得收藏一下哦,方便下次瀏覽

前言

由于公司zabbix 監(jiān)控告警郵件發(fā)送量過打,使用的騰訊企業(yè)郵箱會出現(xiàn)漏發(fā)或發(fā)送頻率過快而拒絕發(fā)送的情況,所以現(xiàn)在使用自主搭建的內(nèi)網(wǎng)郵件服務(wù)器來負責zabbix告警郵件的發(fā)送。

內(nèi)網(wǎng)的告警郵件服務(wù)器只能給其他(騰訊企業(yè)郵箱,網(wǎng)易郵箱等)郵箱發(fā)送郵件,而不能接受其他郵箱的回郵件,如想可以收到回件需要購買域名配置A記錄和MX記錄,本文檔不再講解。

一 配置內(nèi)網(wǎng)dns A記錄和MX記錄

我在內(nèi)網(wǎng)使用的域名主機是dnsmasq代理軟件,其使用簡單,方便,多樣化。詳細配置可查看其他文檔。

[root@dns_proxy ~]# grep liqing /etc/dnsmasq.conf
address=/mail.liqing-test.top/192.168.2.100
mx-host=liqing-test.top,mail.liqing-test.top,10

二 mail服務(wù)器初始化配置

1. 修改主機名

[root@localhost /]# hostnamectl --static set-hostname mail.liqing-test.top|bash

2. 關(guān)閉防火墻與selinux

[root@mail /]# systemctl stop iptables && systemctl disable iptables
[root@mail /]# systemctl stop firewalld && systemctl disable firewalld
[root@mail /]# setenforce 0

3. 開啟時間同步

[root@mail /]# yum -y install ntpdate && ntpdate ntp.aliyun.com

4. 安裝軟件

[root@mail /]# yum  -y  install  postfix  dovecot  cyrus-sasl-*  mailx

三 修改配置文件

注釋:配置文件備份操作本文檔自行操作

1 配置postfix

[root@mail /]# cat /etc/postfix/main.cf
mail_owner = postfix
myhostname = mail.liqing-test.top
mydomain = liqing-test.top
myorigin = $mydomain
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain, ftp.$mydomain
local_recipient_maps =
mynetworks = 0.0.0.0/0
relay_domains = $mydestination
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
smtpd_banner = $myhostname ESMTP

# 在最下面新增
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated
smtpd_client_restrictions = permit_sasl_authenticated

2 配置dovecot

2.1 配置監(jiān)聽協(xié)議:

[root@mail /]# cat /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp
listen = *
login_trusted_networks = 0.0.0.0/0
dict {
}
!include conf.d/*.conf
!include_try local.conf

2.2 配置登錄方式:

[root@mail /]# cat /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
auth_mechanisms = plain login
!include auth-system.conf.ext

2.3 配置郵件存儲位置:

[root@mail /]# cat /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u
namespace inbox {
inbox = yes
}
first_valid_uid = 1000
mbox_write_locks = fcntl
[root@mail /]# cat /etc/dovecot/conf.d/10-master.conf 
service auth {
   unix_listener /var/spool/postfix/private/auth {
   mode = 0666
   user = postfix
   group = postfix
   }
}

2.4 配置ssl(關(guān)閉):

[root@mail /]# cat /etc/dovecot/conf.d/10-ssl.conf 
ssl = no

3 配置sasl2

3.1 配置系統(tǒng)認證:

[root@mail /]# cat /etc/sysconfig/saslauthd 
SOCKETDIR=/run/saslauthd
MECH=shadow
FLAGS=

3.2 配置登錄方式:

[root@mail /]# cat /etc/sasl2/smtpd.conf
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
log_level:3

4 啟動服務(wù):

systemctl  restart  dovecot
systemctl  restart  postfix
systemctl  restart  saslauthd
systemctl  enable dovecot
systemctl  enable  postfix
systemctl  enable  saslauthd

5 創(chuàng)建用戶并設(shè)置pass

[root@mail /]# useradd -m autumn && echo 123456 | passwd --stdin autumn
[root@mail /]# su - autumn 
[autumn@mail ~]$ mkdir -p ~/mail/.imap/INBOX
[autumn@mail ~]$ chmod -R 750 ~/mail        #(這不操作不做會在使用foxmail登錄時報錯{Error: Couldn't open INBOX: Permission denied})
[autumn@mail ~]$ exit

6 配置mailx:

[root@mail /]# cat /etc/mail.rc
set from=autumn@liqing-test.top
set smtp=mail.liqing-test.top
set smtp-auth-user=autumn
set smtp-auth-password=123456
set smtp-auth=login

四 發(fā)送郵件測試

1 命令行發(fā)送郵件測試

[root@mail /]# echo  "郵件服務(wù)器測試"  |  mail  -s  "郵件服務(wù)器測試"  other-email@163.com

2 使用使用foxmail登錄并發(fā)送郵件測試

Centos7.9 搭建自主郵件服務(wù)器_企業(yè)郵箱

Centos7.9 搭建自主郵件服務(wù)器_發(fā)送郵件_02

Centos7.9 搭建自主郵件服務(wù)器_郵件服務(wù)器_03

五 報錯

1 權(quán)限被拒絕

在使用foxmail登錄郵箱時提示權(quán)限被拒絕,這是因為在郵箱用戶的家目錄下mail文件權(quán)限不是750,設(shè)置為750后解決。

[autumn@mail ~]$ chmod -R 750 ~/mail

Dec 3 10:15:35 Git-server dovecot: pop3-login: Login: user=<autumn>, method=PLAIN, rip=192.168.31.100, lip=192.168.2.100, mpid=24843, secured, session=<YnZ3ezTSjiLAqB9k>

Dec 3 10:15:35 Git-server dovecot: pop3(autumn): Error: fchown(/home/autumn/mail/.imap, group=12(mail)) failed: Operation not permitted (egid=1004(autumn), group based on /var/mail/autumn - see http://wiki2.dovecot.org/Errors/ChgrpNoPerm)

Dec 3 10:15:35 Git-server dovecot: pop3(autumn): Error: Couldn't open INBOX: Permission denied

Dec 3 10:15:35 Git-server dovecot: pop3(autumn): Couldn't open INBOX: Permission denied top=0/0, retr=0/0, del=0/0, size=0

Dec 3 10:16:26 Git-server dovecot: pop3-login: Login: user=<autumn>, method=PLAIN, rip=192.168.31.100, lip=192.168.2.100, mpid=24895, secured, session=<NkWHfjTS2CLAqB9k>

Dec 3 10:16:26 Git-server dovecot: pop3(autumn): Error: fchown(/home/autumn/mail/.imap, group=12(mail)) failed: Operation not permitted (egid=1004(autumn), group based on /var/mail/autumn - see http://wiki2.dovecot.org/Errors/ChgrpNoPerm)

2 無法找到主機:

郵件在發(fā)送時會根據(jù)郵件地址的解析記錄去查找mx記錄,這里我在向騰訊的企業(yè)郵箱發(fā)送測試郵件時找不到騰訊的郵箱地址。我在內(nèi)網(wǎng)的dns代理中加入了騰訊的mx記錄后解決

[root@dns- ~]# grep qq /etc/dnsmasq.conf 
mx-host=***.com,mxbiz2.qq.com,10
mx-host=***.com,mxbiz1.qq.com,5

Dec 3 10:36:14 Git-server postfix/smtpd[26216]: connect from unknown[192.168.31.100]

Dec 3 10:36:15 Git-server postfix/smtpd[26216]: 05C682267F04: client=unknown[192.168.31.100], sasl_method=LOGIN, sasl_username=autumn

Dec 3 10:36:15 Git-server postfix/cleanup[26220]: 05C682267F04: message-id=<202112031036171922345@liqing-test.top>

Dec 3 10:36:15 Git-server postfix/qmgr[25430]: 05C682267F04: from=<autumn@liqing-test.top>, size=1561, nrcpt=1 (queue active)

Dec 3 10:36:15 Git-server postfix/smtpd[26216]: disconnect from unknown[192.168.31.100]

Dec 3 10:36:15 Git-server postfix/smtp[26221]: 05C682267F04: to=<***@***.com>, relay=none, delay=0.11, delays=0.08/0.02/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=***.com type=MX: Host not found, try again)

3 郵件被拒絕

在我向騰訊企業(yè)郵箱發(fā)送測試郵件時日志里出現(xiàn)了550郵件連接被拒絕的情況,此情況在郵件中設(shè)置白名單后解決。

Centos7.9 搭建自主郵件服務(wù)器_企業(yè)郵箱_04

Dec 3 10:11:57 Git-server postfix/smtpd[24617]: connect from mail.liqing-test.top[192.168.2.100]

Dec 3 10:11:57 Git-server postfix/smtpd[24617]: 4E2292267F04: client=mail.liqing-test.top[192.168.2.100], sasl_method=LOGIN, sasl_username=autumn

Dec 3 10:11:57 Git-server postfix/cleanup[24621]: 4E2292267F04: message-id=<61a97cec.xRtXn6hYj3NI3wI3%autumn@liqing-test.top>

Dec 3 10:11:57 Git-server postfix/qmgr[24504]: 4E2292267F04: from=<autumn@liqing-test.top>, size=541, nrcpt=1 (queue active)

Dec 3 10:11:57 Git-server postfix/smtpd[24617]: disconnect from mail.liqing-test.top[192.168.2.100]

Dec 3 10:11:58 Git-server postfix/smtp[24622]: 4E2292267F04: to=<***@***.com>, relay=mxbiz1.qq.com[183.57.48.34]:25, delay=1.6, delays=0.09/0.03/0.16/1.3, dsn=5.0.0, status=bounced (host mxbiz1.qq.com[183.57.48.34] said: 550 Mail content denied. http://service.exmail.qq.com/cgi-bin/help?subtype=1&&id=20022&&no=1000726 (in reply to end of DATA command))


到此這篇關(guān)于Centos7.9搭建自主郵件服務(wù)器詳細步驟的文章就介紹到這了,更多相關(guān)Centos搭建郵件服務(wù)器內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Linux中把用戶添加到組的4個方法總結(jié)

    Linux中把用戶添加到組的4個方法總結(jié)

    這篇文章主要給大家介紹了關(guān)于Linux中把用戶添加到組的4個方法,文中通過示例代碼介紹的非常詳細,對大家學(xué)習(xí)或者使用Linux具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • Xshell7遠程連接失敗(connection failed)的問題解決

    Xshell7遠程連接失敗(connection failed)的問題解決

    本文主要介紹了Xshell7遠程連接失敗(connection failed)的問題解決,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-08-08
  • linux命令詳解date使用方法(計算母親節(jié)和父親節(jié)日期腳本示例)

    linux命令詳解date使用方法(計算母親節(jié)和父親節(jié)日期腳本示例)

    date命令可以用來顯示和修改系統(tǒng)日期時間,本文對其做了詳細說明,最近提供計算指定年份的母親節(jié)和父親節(jié)的日期腳本示例,大家參考使用吧
    2013-12-12
  • 在Linux中查看及終止正在運行的后臺程序方法

    在Linux中查看及終止正在運行的后臺程序方法

    今天小編就為大家分享一篇在Linux中查看及終止正在運行的后臺程序方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-07-07
  • 詳解如何在 CentOS 7 中安裝或升級最新的內(nèi)核

    詳解如何在 CentOS 7 中安裝或升級最新的內(nèi)核

    這篇文章主要介紹了詳解如何在 CentOS 7 中安裝或升級最新的內(nèi)核,具有一定的參考價值,感興趣的小伙伴們可以參考一下。
    2017-03-03
  • linux環(huán)境下安裝PHP的OpenSSL擴展的方法講解

    linux環(huán)境下安裝PHP的OpenSSL擴展的方法講解

    下面小編就為大家分享一篇linux環(huán)境下安裝PHP的OpenSSL擴展的方法講解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-03-03
  • Ubuntu18.04系統(tǒng)安裝、配置Redis及phpredis擴展操作詳解

    Ubuntu18.04系統(tǒng)安裝、配置Redis及phpredis擴展操作詳解

    這篇文章主要介紹了Ubuntu18.04系統(tǒng)安裝、配置Redis及phpredis擴展操作,結(jié)合實例形式分析了Ubuntu18.04系統(tǒng)安裝、配置Redis及phpredis擴展的相關(guān)原理、步驟、配置命令與操作注意事項,需要的朋友可以參考下
    2020-03-03
  • Linux下利用unzip命令如何解壓多個文件詳解

    Linux下利用unzip命令如何解壓多個文件詳解

    這篇文章主要給大家介紹了關(guān)于在Linux下利用unzip命令如何解壓多個文件的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-09-09
  • linux Dig命令使用大全

    linux Dig命令使用大全

    這篇文章主要介紹了linux Dig命令使用大全,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-01-01
  • 詳解Linux系統(tǒng)中設(shè)置SFTP服務(wù)用戶目錄權(quán)限的方法

    詳解Linux系統(tǒng)中設(shè)置SFTP服務(wù)用戶目錄權(quán)限的方法

    這篇文章主要給大家介紹了Linux系統(tǒng)中設(shè)置SFTP服務(wù)用戶目錄權(quán)限的方法,文中給出了詳細的設(shè)置方法,有需要的朋友們可以參考借鑒,下面來一起看看吧。
    2016-12-12

最新評論

隆德县| 兴宁市| 万安县| 辉县市| 麻阳| 开化县| 商洛市| 塘沽区| 上杭县| 博罗县| 柘荣县| 赣州市| 当阳市| 安龙县| 墨江| 南丰县| 万盛区| 永善县| 富平县| 三穗县| 乐山市| 琼海市| 资兴市| 兰考县| 嫩江县| 临漳县| 合水县| 通江县| 建阳市| 黑龙江省| 彩票| 文安县| 温宿县| 邵阳市| 绥芬河市| 射阳县| 平泉县| 宣威市| 潮安县| 安顺市| 延津县|