人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動態(tài)

CentOS 7.2下安裝部署郵件服務(wù)器(Postfix)的步驟詳解

發(fā)布日期:2022-08-01 12:06 | 文章來源:站長之家

本文主要介紹的是在CentOS 7.2安裝部署郵件服務(wù)器(Postfix)的相關(guān)內(nèi)容,分享出來供大家參考學(xué)習(xí),下面來看看詳細(xì)的介紹:

Postfix 是一種電子郵件服務(wù)器,它是由任職于IBM華生研究中心(T.J. Watson Research Center)的荷蘭籍研究員Wietse Venema為了改良sendmail郵件服務(wù)器而產(chǎn)生的。最早在1990年代晚期出現(xiàn),是一個開放源代碼的軟件。

注意:以下所有配置的命名都是根據(jù)主機(jī)的hostname變量來配置的,如果hostname更換了的話,需要重新生成證書。

生成ssl證書

1、生成證書的腳本代碼

以hostname為命名生成證書,運(yùn)行腳本后需輸入四次相同密碼(密碼須包含數(shù)字和字母)

#!/bin/sh
rm -rf $(hostname).*
openssl genrsa -des3 -out $(hostname).key 1024
SUBJECT="/C=US/ST=Mars/L=iTranswarp/O=iTranswarp/OU=iTranswarp/CN=$(hostname)"
openssl req -new -subj $SUBJECT -key $(hostname).key -out $(hostname).csr
mv $(hostname).key $(hostname).origin.key
openssl rsa -in $(hostname).origin.key -out $(hostname).key
openssl x509 -req -days 3650 -in $(hostname).csr -signkey $(hostname).key -out $(hostname).crt
cp $(hostname).crt /etc/pki/tls/certs/$(hostname).crt
cp $(hostname).key /etc/pki/tls/certs/$(hostname).key
echo "the key path:/etc/pki/tls/certs/$(hostname).key"
echo "the crt path:/etc/pki/tls/certs/$(hostname).crt"
rm -rf $(hostname).*

Postfix安裝及配置

安裝

yum -y install postfix

配置

vim /etc/postfix/main.cf

# line 75: uncomment and specify hostname
myhostname = $(hostname)
# line 83: uncomment and specify domain name
mydomain = test.cn
# line 99: uncomment
myorigin = $mydomain
# line 116: change
inet_interfaces = all
# line 164: add
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# line 264: uncomment and specify your local network
mynetworks = 127.0.0.0/8, 10.0.0.0/24
# line 419: uncomment (use mailboxdir)
home_mailbox = mailbox/
# line 574: add
smtpd_banner = $myhostname ESMTP

# 在配置文件尾部追加以下內(nèi)容
# limit an email size for 10M
message_size_limit = 10485760
# limit a mailbox for 1G
mailbox_size_limit = 1073741824
# for SMTP-Auth
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/pki/tls/certs/$(hostname).crt
smtpd_tls_key_file = /etc/pki/tls/certs/$(hostname).key
smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scache

vim /etc/postfix/master.cf

# line 26-28: uncomment
smtps  inet n  -  n  -  -  smtpd
 -o syslog_name=postfix/smtps
 -o smtpd_tls_wrappermode=yes

Dovecot 安裝及配置

安裝

yum -y install dovecot

配置

vim /etc/dovecot/dovecot.conf

# line 24: uncomment
protocols = imap pop3 lmtp
# line 30: uncomment and change ( if not use IPv6 )
listen = *

vim /etc/dovecot/conf.d/10-auth.conf

# line 10: uncomment and change ( allow plain text auth )
disable_plaintext_auth = no
# line 100: add
auth_mechanisms = plain login

vim /etc/dovecot/conf.d/10-mail.conf

# line 30: uncomment and add
mail_location = maildir:~/Maildir

vim /etc/dovecot/conf.d/10-master.conf

# line 96-98: uncomment and add like follows
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
 mode = 0666
 user = postfix
 group = postfix
}

vim /etc/dovecot/conf.d/10-ssl.conf

# line 8: change
ssl = yes
# line 14,15: specify certificates
ssl_cert = </etc/pki/tls/certs/$(hostname).crt
ssl_key = </etc/pki/tls/certs/$(hostname).key

運(yùn)行

systemctl restart postfix
systemctl enable postfix
systemctl start dovecot
systemctl enable dovecot
firewall-cmd --add-service=smtp --permanent
firewall-cmd --add-port={110/tcp,143/tcp} --permanent
firewall-cmd --add-service={pop3s,imaps} --permanent
firewall-cmd --add-port=465/tcp --permanent
firewall-cmd --reload

郵件日志報告pflogsumm

安裝

yum -y install postfix-perl-scripts

查看

perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog

每天1:00AM 定時發(fā)送郵件日志摘要到根

crontab -e
00 01 * * * perl /usr/sbin/pflogsumm -e -d yesterday /var/log/maillog | mail -s 'Logwatch for Postfix' root

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對本站的支持。

美國服務(wù)器租用

版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。

相關(guān)文章

實(shí)時開通

自選配置、實(shí)時開通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問服務(wù)

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時在線

客服
熱線

400-630-3752
7*24小時客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部