自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Postfix的配置

運維 系統(tǒng)運維
Postfix的功能是實現(xiàn)SMTP的服務、發(fā)送郵件服務。如何配置Postfix呢,需要哪些相關的配置文檔。這篇文章講述的是RedHat Linux 下的配置文檔。簡單而且十分實用。

一、安裝前準備

  環(huán)境:RedHat Linux+Postfix+Cyrus-sasl+Dovecot+Stunnel

  在安裝Linux時,如果選擇全部安裝的話,Postfix與Dovecot以及Stunnel將會自動給予安裝上去,查看是否已安裝,可以執(zhí)行如下命令:

  rpm –qa | grep postfix或dovecot或stunnel

  如果沒有的話,請直接在光盤里找出來,并給予安裝。這里以RPM包安裝為列,安裝命令如下:

  rpm –ivh postfix-*.rpm 或

  rpm –ivh cyrus-sasl-*.rpm 或

  rpm –ivh dovecot-*.rpm 或

  rpm-ivh stunnel-*.rpm

  這里的*代表的是相關的版本號。

  在確認這些安裝包已安裝到系統(tǒng)里后,現(xiàn)在開始配置Mail服務。

  首先,請停止系統(tǒng)內(nèi)自帶的Mail服務-Sendmail,執(zhí)行如下命令:

  /etc/init.d/sendmail stop //先停止sendmail進程

  chkconfig sendmail off //再把自啟動服務去掉

  二、配置Cyrus-sasl

  確定已安裝完Cyrus-sasl后,啟動該服務:

  /etc/init.d/saslauthd start //啟動Cyrus-sasl服務。

  chkconfig saslauthd on //把Cyrus-sasl設置為開機自啟動。

  測試一下是否成功:

  testsaslauthd –u 系統(tǒng)用戶名 –p ‘對應的密碼’   或

  /usr/sbin/testsaslauthd –u 系統(tǒng)用戶名 –p ‘對應的密碼’

  如果提示:

  0: OK "Success."

  則說明已安裝成功!

  注:Cyrus-sasl的功能就是實現(xiàn)密碼驗證機制。

  三、配置SMTP

  現(xiàn)在,開始配置Postfix,Postfix的功能就是實現(xiàn)SMTP服務,也即信件發(fā)送服務。Postfix的主要配置文檔是/etc/postfix/main.cf,如果沒看到mail.cf文檔則請執(zhí)行:

  cp /etc/postfix/main.cf.default /etc/postfix/main.cf

  然后修改main.cf的相關內(nèi)容。具體內(nèi)容如下:

  alias_database = hash:/etc/aliases

  alias_maps = hash:/etc/aliases

  command_directory = /usr/sbin

  config_directory = /etc/postfix

  daemon_directory = /usr/libexec/postfix

  debug_peer_level = 2

  header_checks = regexp:/etc/postfix/header_checks

  html_directory = no

  mailbox_size_limit = 102400000

  mailq_path = /usr/bin/mailq.postfix

  manpage_directory = /usr/share/man

  mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

  mydomain = 域名

  myhostname = mail.域名

  mynetworks = 192.168.1.0/24, 127.0.0.0/8, 192.168.1.100/32

  myorigin = $mydomain

  newaliases_path = /usr/bin/newaliases.postfix

  readme_directory = /usr/share/doc/postfix-1.1.11/README_FILES

  relay_domains = nanoconcept.net

  sample_directory = /usr/share/doc/postfix-1.1.11/samples

  sendmail_path = /usr/sbin/sendmail.postfix

  setgid_group = postdrop

  smtpd_sasl_auth_enable = yes

  smtpd_sasl_local_domain= ''

  smtpd_recipient_restrictions =

  permit_sasl_authenticated

  permit_auth_destination

  permit_mynetworks

  check_relay_domain

  reject_rbl_client yahoo.com.tw

  reject_rbl_client cbl.anti-spam.org.cn

  reject_rbl_client cdl.anti-spam.org.cn

  reject_rbl_client cblplus.anti-spam.org.cn

  reject_non_fqdn_sender

  reject_non_fqdn_recipient

  reject_unknown_sender_domain

  reject_unknown_recipient_domain

  reject

  broken_sasl_auth_clients = yes

  smtpd_client_restrictions = permit_sasl_authenticated

  smtpd_recipient_restrictions = permit_sasl_authenticated

  smtpd_sasl_security_options=noanonymous

  unknown_local_recipient_reject_code = 550

  Postfix配置文件默認情況下,沒有啟用SMTP認證機制,所以,需要修改postfix的主配置main.cf文件,也即上面以smtpd開頭的,這些就是實現(xiàn)SMTP功能的配置內(nèi)容!

  現(xiàn)在可以啟動postfix服務:

  /etc/init.d/postfix start //啟動postfix服務

  chkconfig postfix on //設置postfix開機自啟動。

  可以通過netstat –ntl進行查看SMTP的端口(25)是否起來。

  然后就可以進行測試是否能發(fā)信,如果不行的話,請查看一下:

  /usr/lib/sasl2下是否存在著smtpd.conf與Sendmail.conf兩個文件,其內(nèi)容為:

  [root@xtmail sasl2]# cat Sendmail.conf

  pwcheck_method:saslauthd

  與:

  [root@xtmail sasl2]# cat smtpd.conf

  pwcheck_method: saslauthd

  但有時候,Postfix無法自動找到saslauthd的路徑,所以需要在smtpd.conf里添加一條:

  saslauthd_path:/var/run/saslauthd/mux

  四、配置POP3

  Dovecot的功能就是實現(xiàn)收信功能,即POP3功能。在安裝Dovecot的RPM包后,Dovecot的配置文件是在/etc/下的dovecot.conf

  為了能讓Dovecot正常使用,需要修改一下dovecot.conf的些配置。具體如下:

  protocols = pop3

  pop3_listen = [::]

  login = imap

  login = pop3

  mbox_locks = fcntl

  auth = default

  auth_mechanisms = plain

  auth_userdb = passwd

  auth_user = root

  完后,請運行以下命令:

  /etc/init.d/dovecot start //啟動Dovecot服務

  chkconfig dovecot on //設置開機自啟動

  五、端口加密

  現(xiàn)在就把一臺具有SMTP與POP3功能的郵局配置完畢。當然了,這臺只具備簡單的SMTP與POP3功能的郵局,現(xiàn)在要對其進行端口加密。也就是提到的Stunnel。Stunnel的配置文件是在/etc/stunnel/stunnel.conf,里面已有SMTP與POP3的進行端口加密。一般只要直接啟動起來就可以了。具體形式如下:

  /etc/init.d/stunnel //啟動stunnel

  如果是用tar.gz進行編譯的話,有時在啟動stunnel時,需要帶上stunnel.conf的絕對路徑!

  六、總結(jié)

  現(xiàn)在一套完整的Postfix郵局已配置完畢,可以投入正常使用。可以通過 netstat –ntl進行查看到25、110、465、995這幾個端口的存在。其中25端口加密后就是465,110加密后就是995,110端口只是一個與客戶端連接的,可以禁止掉。25端口不可以屏蔽掉,因為Mail服務器之間在互相傳輸時,還是使用25端口的。

 

【編輯推薦】

  1. Postfix入門篇
  2. Postfix對郵件的處理流程
  3. Linux下的郵件服務器 postfix
  4. 如何安裝Postfix
  5. Postfix郵件安裝實現(xiàn)介紹
  6. postfix 安裝配置
責任編輯:zhaolei 來源: 網(wǎng)絡轉(zhuǎn)載
相關推薦

2011-02-21 13:08:37

postfix配置

2011-01-19 09:55:27

postfix

2011-02-21 11:14:47

Postfix配置

2010-06-02 17:36:31

postfix概述

2010-06-07 11:22:28

2011-01-19 14:00:21

2009-11-30 10:21:41

2009-10-10 15:54:55

RHEL 4配置Pos

2011-02-21 10:31:54

Postfix命令配置

2011-01-18 15:00:17

Postfix安裝

2011-01-18 18:52:14

Postfix結(jié)構(gòu)

2010-05-25 14:57:17

postfix安裝配置

2011-01-20 10:20:18

Postfix配置

2011-01-19 09:57:48

Postfix控制

2011-01-19 13:39:38

Postfix郵件監(jiān)控

2010-06-02 18:17:09

Postfix郵件

2010-05-25 18:57:42

啟動postfix

2011-01-19 16:12:00

Postfix安裝啟動

2011-01-20 09:42:29

postfix郵件

2011-02-21 08:50:50

點贊
收藏

51CTO技術棧公眾號