开心六月综合激情婷婷|欧美精品成人动漫二区|国产中文字幕综合色|亚洲人在线成视频

    1. 
      
        <b id="zqfy3"><legend id="zqfy3"><fieldset id="zqfy3"></fieldset></legend></b>
          <ul id="zqfy3"></ul>
          <blockquote id="zqfy3"><strong id="zqfy3"><dfn id="zqfy3"></dfn></strong></blockquote>
          <blockquote id="zqfy3"><legend id="zqfy3"></legend></blockquote>
          打開APP
          userphoto
          未登錄

          開通VIP,暢享免費電子書等14項超值服

          開通VIP
          postfix各類故障詳細(xì)分析與解決

          問題1 ?。模危訜o法正常解析郵件服務(wù)器

          查看dns解析是否正常

          [root@centos work]# nslookup  -type=mx mail.sun.com

          Server: 10.3.0.100

          Address: 10.3.0.100#53

          mail.sun.com mail exchanger = 0 10.3.0.100.sun.com.

          ^

          償試從其它機器給其發(fā)郵件

          [root@centos work]# echo hello | mail -s 'hello' root@mail.sun.com

          結(jié)果發(fā)現(xiàn)郵件被退回,查看郵件退回原因:

          : Host or domain name not found. Name service error for

          name=10.3.0.100.sun.com type=AAAA: Host not found

          ^

          通過以上信息,我們發(fā)現(xiàn)郵件地址被解析成了10.3.0.100.sun.com,并不是mail.sun.com

          其實在第6步就已經(jīng)誤入歧途了!因為我們要解析的應(yīng)該是sun.com這個域的地址。而不是mail.sun.com這個主機名!

          償試解析sun.com這個域的郵件交換記錄:

          [root@centos work]# nslookup  -type=mx sun.com

          Server: 10.3.0.100

          Address: 10.3.0.100#53

          *** Can't find sun.com: No answer

          出錯了!證明dns服務(wù)器配置不正確!

          看看原來的配置文件

          [root@centos58 postfix]# vim /var/named/chroot/var/named/data/sun.com.zone 

          $TTL 86400

          @       IN      SOA     root.sun.com.   root. (

          2012090301

          120

          240

          360

          86400 )

          IN      NS      centos58.sun.com.

          mail    IN      MX 0    10.3.0.100   <-----這里寫錯了!

          www     IN      A       10.3.0.100

          mail    IN      A       10.3.0.100

          修改sun.com.zone配置文件

          [root@centos58 postfix]# vim /var/named/chroot/var/named/data/sun.com.zone 

          $TTL 86400

          @       IN      SOA     root.sun.com.   root. (

          2012090301

          120

          240

          360

          86400 )

          IN      NS      centos58.sun.com.

          IN      MX 0    10.3.0.100

          www     IN      A       10.3.0.100

          mail    IN      A       10.3.0.100

          [root@centos58 postfix]# /etc/init.d/named restart 

          [root@centos58 postfix]# nslookup -type=mx sun.com

          Server: 10.3.0.100

          Address: 10.3.0.100#53

          sun.com mail exchanger = 0 10.3.0.100.sun.com.

          本機解析成功!

          再次發(fā)郵件成功!

          --------------------------------------------------

          問題2 myhostname字段填寫錯誤導(dǎo)致postfix無法收到郵件

          在客戶端發(fā)郵件給服務(wù)器

          [root@centos work]# echo test2 | mail -s "hello" root@mail.sun.com

          在服務(wù)器端查看郵件,發(fā)現(xiàn)沒有郵件

          [root@centos58 postfix]# mail

          No mail for root

          查看客戶端是否退信,沒有退信信息。

          [root@centos work]# mail

          No mail for root

          以上現(xiàn)象說明客戶端已經(jīng)將郵件發(fā)送至服務(wù)器端??蛻舳送哆f沒有問題,問題出在服務(wù)器上。

          這個問題出在main.cf配置文件的myhostname = centos58.sun.com上。此行代表監(jiān)聽主機名為centos58.sun.com.而我發(fā)郵件的地址為mail.sun.com。所以postfix處理發(fā)給mail.sun.com的郵件!

          注意:myhostname字段接的是郵件服務(wù)器監(jiān)聽的主機名,與本機的主機名無關(guān),應(yīng)該與dns所解析的主機名一致!我開始填的centos58.sun.com代表的是本機的主機名。這是錯誤的!

          解決:

          修改myhostname = centos58.sun.com 為 myhostname = mail.sun.com

          重啟/etc/init.d/postfix restart 

          再次用客戶端測試

          [root@centos work]# echo test2 | mail -s "hello" root@mail.sun.com

          [root@centos58 postfix]# mail

          Mail version 8.1 6/6/93.  Type ? for help.

          "/var/spool/mail/root": 1 message 1 new

          >N  1 root@centos.sun.com   Mon Sep  3 02:59  21/739   "hello"

          & 1

          Message 1:

          From root@centos.sun.com  Mon Sep  3 02:59:29 2012

          X-Original-To: root@mail.sun.com

          Delivered-To: root@mail.sun.com

          Date: Mon, 03 Sep 2012 17:59:33 +0800

          To: root@mail.sun.com

          Subject: hello

          User-Agent: Heirloom mailx 12.4 7/29/08

          MIME-Version: 1.0

          Content-Type: text/plain; charset=us-ascii

          Content-Transfer-Encoding: 7bit

          From: root@centos.sun.com (root)

          test2

          & q

          總結(jié):myhostname代表的是postfix所監(jiān)聽的主機名,與本機的主機名不一樣。應(yīng)該與dns上解析的主機名保持一致。

          ok!客戶端發(fā)郵件成功!

          ---------------------------------------------

          問題3 mydestination字段錯誤導(dǎo)致不能以域名結(jié)尾來發(fā)信

          前面我們用的主機名為后綴發(fā)信

          現(xiàn)在償試用短域名發(fā)郵件給自己

          [root@centos58 postfix]# echo own | mail -s 'hello' root@sun.com

          [root@centos58 postfix]# mail

          No mail for root

          結(jié)果失敗。

          查看配置文件,原來在mydestination字段后面沒有添加本地域名

          修改配置文件,在mydestination后加上sun.com域。

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

          [root@centos58 postfix]# /etc/init.d/postfix restart 

          再次測試

          [root@centos58 postfix]# echo own2 | mail -s 'hello' root@sun.com

          [root@centos58 postfix]# mail

          Mail version 8.1 6/6/93.  Type ? for help.

          "/var/spool/mail/root": 1 message 1 new

          >N  1 root@centos58.sun.co  Mon Sep  3 03:24  18/638   "hello"

          & 1

          Message 1:

          From root@centos58.sun.com  Mon Sep  3 03:24:46 2012

          X-Original-To: root@sun.com

          Delivered-To: root@sun.com

          Date: Mon, 3 Sep 2012 03:24:45 -0700

          From: root

          To: root@sun.com

          Subject: hello

          own2

          成功!

          -----------------------------

          問題4 訪問extmail出現(xiàn)500錯誤

          用瀏覽器訪問mail.sun.com,會自動跳轉(zhuǎn)到/extmail/cgi/index.cgi目錄下。但頁面會報500錯誤。

          先看看我apache虛擬主機配置情況

          [root@centos58 cgi-bin]# vim /etc/httpd/conf/httpd.conf 

          NameVirtualHost *:80

          ServerName mail.sun.com

          DocumentRoot /var/www/extsuite/extmail/html/

          ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi

          Alias /extmail /var/www/extsuite/extmail/html

          SuexecUserGroup postfix postfix

          看apache錯誤日志

          [root@centos58 extmail]# tail /var/log/httpd/error_log

          ......... 

          [Wed Sep 05 20:16:48 2012] [error] [client 10.3.0.26] suexec policy violation: see suexec log for more details, referer: http://mail.sun.com/

          [Wed Sep 05 20:16:48 2012] [error] [client 10.3.0.26] Premature end of script headers: index.cgi, referer: http://mail.sun.com/

          [Wed Sep 05 20:16:48 2012] [error] [client 10.3.0.26] File does not exist: /var/www/extsuite/extmail/html/favicon.ico

          提示查看suexec日志獲得更詳細(xì)信息。

          查看suexec日志

          [root@centos58 extmail]# tail /var/log/httpd/suexec.log 

          ..........

          [2012-09-05 20:16:48]: uid: (89/postfix) gid: (89/89) cmd: index.cgi

          [2012-09-05 20:16:48]: cannot run as forbidden uid (89/index.cgi)

          可以看到postfix用戶的id是不允許執(zhí)行這個cgi文件的。

          用suexec -V查看一下

          [root@centos58 extmail]# suexec -V

          -D AP_DOC_ROOT="/var/www"

          -D AP_GID_MIN=100

          -D AP_HTTPD_USER="apache"

          -D AP_LOG_EXEC="/var/log/httpd/suexec.log"

          -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"

          -D AP_UID_MIN=500

          -D AP_USERDIR_SUFFIX="public_html"

          由AP_UID_MIN可知,suexec執(zhí)行的最小用戶uid必需大于500.

          那讓我們創(chuàng)建一個普通用戶

          [root@centos58 extmail]# useradd -s /sbin/nologin vuser

          [root@centos58 extmail]# id vuser

          uid=1002(vuser) gid=1002(vuser) groups=1002(vuser)  <-------注意:這里id=1002對解決此問題雖有效,但會給后續(xù)配置帶來很多問題。強烈建議映射賬戶id指定為1000!后面我會寫出此故障現(xiàn)象

          修改httpd.conf中SuexecUserGroup字段。

          [root@centos58 extmail]# sed -i '/Suexec/s/postfix/vuser/g' /etc/httpd/conf/httpd.conf 

          [root@centos58 extmail]# /etc/init.d/httpd restart

          再次訪問extmail,仍然提示同樣錯誤。

          再次查看日志

          [root@centos58 extmail]# tail /var/log/httpd/suexec.log 

          [2012-09-06 12:09:36]: uid: (1002/vuser) gid: (1002/1002) cmd: index.cgi

          [2012-09-06 12:09:36]: target uid/gid (1002/1002) mismatch with directory (0/0) or program (0/0)

          提示所執(zhí)行用戶的uid/gid與目錄所屬用戶不匹配。提示目錄所屬用戶及組均為root.

          [root@centos58 extmail]# chown -R vuser.vuser cgi/

          再次訪問,錯誤提示不同了,這次提示未安裝syslog.

          Unix::Syslog not found, please install it first! (in cleanup) Undefined subroutine &Ext::Logger::do_closelog called at /var/www/extsuite/extmail/libs/Ext/Logger.pm line 86.

          下載unix-syslog 地址:http://search.cpan.org/~mharnisch/Unix-Syslog-1.1/Syslog.pm

          [root@centos58 src]# tar xf /usr/src/Unix-Syslog-1.1.tar.gz 

          [root@centos58 src]# cd Unix-Syslog-1.1

          [root@centos58 Unix-Syslog-1.1]# perl Makefile.PL 

          [root@centos58 Unix-Syslog-1.1]# make;make install

          再次訪問,終于ok!

          總結(jié):suexec可執(zhí)行用戶身份默認(rèn)最小uid要大于500,這個問題要注意下。

          ~~~~~~~參考文獻http://wenku.baidu.com/view/0e5aeac758f5f61fb73666b5.html~~~~~

          ----------------------------------

          問題5  webman看不到圖形驗證碼

          在瀏覽器中訪問extman看不到驗證碼圖片,因為缺少GD插件。

          下載gd軟件包

          [root@centos58 extman]# wget http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.46.tar.gz

          [root@centos58 src]# tar xf GD-2.46.tar.gz 

          編譯gd軟件包報錯,提示找不到gdlib-config文件。

          [root@centos58 GD-2.46]# perl Makefile.PL 

          **UNRECOVERABLE ERROR**

          Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.

          查找gd-config所屬軟件包

          [root@centos58 GD-2.46]# yum provides */gdlib-config

          gd-devel-2.0.33-9.4.el5_4.2.x86_64 : The development libraries and header files

          : for gd

          Repo        : base

          Matched from:

          Filename    : /usr/bin/gdlib-config

          找到所屬軟件包為gd-devel,安裝軟件包

          [root@centos58 GD-2.46]# yum install gd-devel-2.0.33-9.4.el5_4.2.x86_64 -y

          [root@centos58 GD-2.46]# whereis gdlib-config

          gdlib-config: /usr/bin/gdlib-config

          [root@centos58 GD-2.46]# perl Makefile.PL 

          [root@centos58 GD-2.46]# make;make install 

          編譯成功,再次訪問extman,能夠看到驗證碼了!默認(rèn)用戶名root@extmail.org,密碼extmail*123*,順利登錄。但登錄后又報錯!

          Can't open /tmp/extman//sid_36e127fdd6ebcbb870b6b934b038df5e, No such file or directory

          [ Go Back ] >> Re-Login

          提示不能打開/tmp/extman。因為我們沒有建立這個文件夾

          [root@centos58 GD-2.46]# mkdir /tmp/extman

          [root@centos58 GD-2.46]# chown -R vuser:vuser /tmp/extman/

          再次登錄,一切ok!

          總結(jié):gd插件為驗證碼插件,不裝無法提供驗證碼,安裝gd插件需要gd-devel包的支持,extman運行需要有/tmp/extman目錄來放緩存文件

          ------------------------------------

          問題6 啟動圖形化日志信息的報錯歸納。

          在啟動mailgraph-init時報錯

          [root@centos58 mailgraph_ext]# /var/www/extsuite/extman/addon/mailgraph_ext/mailgraph-init start

          Starting mail statistics grapher: mailgraph_ext

          nice: /usr/local/mailgraph_ext/mailgraph_ext.pl: No such file or directory

          Starting queue statistics grapher: qmonitor

          nice: /usr/local/mailgraph_ext/qmonitor.pl: No such file or directory

          提示找不到/usr/local/mailgraph_ext/mailgraph_ext.pl和qmonitor.pl這兩個文件,因為我們默認(rèn)沒有建立這兩個路徑

          根據(jù)提示建目錄

          [root@centos58 mailgraph_ext]# mkdir /usr/local/mailgraph_ext

          復(fù)制文件到指定目錄

          [root@centos58 mailgraph_ext]# cp /var/www/extsuite/extman/addon/mailgraph_ext/mailgraph_ext.pl /usr/local/mailgraph_ext/

          [root@centos58 mailgraph_ext]# cp /var/www/extsuite/extman/addon/mailgraph_ext/qmonitor.pl /usr/local/mailgraph_ext/

          上述問題解決后,啟動mailgraph-init又出現(xiàn)新的問題。

          [root@centos58 mailgraph_ext]# /var/www/extsuite/extman/addon/mailgraph_ext/mailgraph-init start

          Starting mail statistics grapher: mailgraph_ext

          Can't locate RRDs.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/mailgraph_ext/mailgraph_ext.pl line 292.

          BEGIN failed--compilation aborted at /usr/local/mailgraph_ext/mailgraph_ext.pl line 292.

          Starting queue statistics grapher: qmonitor

          Can't locate RRDs.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/mailgraph_ext/qmonitor.pl line 8.

          BEGIN failed--compilation aborted at /usr/local/mailgraph_ext/qmonitor.pl line 8.

          提示找不到RRDs.pm,因為沒有安裝rrd圖形采集工具。

          安裝rrdtool來解決上述問題。

          無法用yum install 來安裝rrdtool.添加yum源,使其支持yum安裝rrdtool.

          [root@centos58 src]# vim /etc/yum.repos.d/CentOS-Base.repo 

          [dag]

          name=Dag RPM Repository for Red Hat Enterprise Linux

          baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag

          gpgcheck=1

          gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

          enabled=1

          [root@centos58 src]# yum install rrdtool rrdtool-perl

          rrds.pm的問題解決后,新的問題再次出現(xiàn)。

          [root@centos58 mailgraph_ext]# /var/www/extsuite/extman/addon/mailgraph_ext/mailgraph-init start

          Starting mail statistics grapher: mailgraph_ext

          Can't locate File/Tail.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/mailgraph_ext/mailgraph_ext.pl line 296.

          BEGIN failed--compilation aborted at /usr/local/mailgraph_ext/mailgraph_ext.pl line 296.

          Starting queue statistics grapher: qmonitor

          提示沒有安裝File-Tail

          下載安裝File-Tail軟件。

          [root@centos58 src]# wget http://search.cpan.org/CPAN/authors/id/M/MG/MGRABNAR/File-Tail-0.99.3.tar.gz

          [root@centos58 File-Tail-0.99.3]# perl Makefile.PL ;make;make install

          再次啟動終于成功!

          [root@centos58 mailgraph_ext]# /var/www/extsuite/extman/addon/mailgraph_ext/mailgraph-init start

          Starting mail statistics grapher: mailgraph_ext

          Starting queue statistics grapher: qmonitor

          [root@centos58 File-Tail-0.99.3]# /var/www/extsuite/extman/addon/mailgraph_ext/qmonitor.pl start & 

          在瀏覽器中點擊Graph Log選項,可以看到出現(xiàn)了很多圖形化日志界面!ok!

          總結(jié):要想啟動mailgraph-init和qmonitor.pl繪圖工具,必需建立/usr/local/mailgraph_ext,并將mailgraph_ext.pl,qmonitor.pl拷過去。否則會報錯。并且要安裝好rdtool rrdtool-perl File-Tail三個信賴包。

          ----------------------------

          問題7 用extman管理界面添加新用戶報錯

          償試用extman管理界面添加新用戶,結(jié)果報錯!

          DBD::mysql::st execute failed: INSERT command denied to user 'extmail'@'localhost' for table 'mailbox' at /var/www/extsuite/extman/libs/Ext/Mgr/MySQL.pm line 333

          提示extmail用戶沒有對mailbox表的插入權(quán)限。

          決定extman采用哪個用戶身份來執(zhí)行新建用戶操作的配置文件在/var/www/extsuite/extman/webman.cf里面。

          [root@centos58 extman]# vim /var/www/extsuite/extman/webman.cf

          SYS_MYSQL_USER = extmail

          SYS_MYSQL_PASS = extmail

          SYS_MYSQL_DB = extmail

          SYS_MYSQL_HOST = localhost

          SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock

          以上指定了連接的用戶名及密碼extmail,以及數(shù)據(jù)庫等信息。

          進入數(shù)據(jù)庫,查看extmail用戶對extmail數(shù)據(jù)庫的權(quán)限。

          mysql> select user,db,host,insert_priv from mysql.db where db='extmail';

          +---------+---------+-----------+-------------+

          | user    | db      | host      | insert_priv |

          +---------+---------+-----------+-------------+

          | extmail | extmail | localhost | N           | 

          | webman  | extmail | localhost | Y           | 

          +---------+---------+-----------+-------------+

          2 rows in set (0.00 sec)

          可以看到extmail用戶對extmail數(shù)據(jù)庫而言是沒有插入表的權(quán)限的。那么我們改變一下extmail用戶的權(quán)限。

          mysql> grant all on extmail.* to extmail@'localhost' identified by 'extmail';

          Query OK, 0 rows affected (0.00 sec)

          mysql> select user,db,host,insert_priv from mysql.db where db='extmail';

          +---------+---------+-----------+-------------+

          | user    | db      | host      | insert_priv |

          +---------+---------+-----------+-------------+

          | extmail | extmail | localhost | Y           | 

          | webman  | extmail | localhost | Y           | 

          +---------+---------+-----------+-------------+

          2 rows in set (0.00 sec)

          已經(jīng)擁有插入權(quán)限了!再回到web管理界面添加新用戶看看。

          New user test@extmail.org Added

          成功添加用戶,上述問題解決!注意:這里也可以不更改extmail的權(quán)限,而只需要調(diào)整webman.cf中的SYS_MYSQL_USER=webman,SYS_MYSQL_PASS = webman 即可。因為webman這個用戶默認(rèn)就是具有插入刪除權(quán)限的!建議采用更改用戶為webman的方式解決上述問題。

          總結(jié):extman的配置文件webman.cf里面的默認(rèn)用戶是填的extmail,但我們在導(dǎo)入extman默認(rèn)的兩張表extmail.sql init.sql時,表中默認(rèn)只給extmail這個用戶查詢數(shù)據(jù)庫的權(quán)限,而給webman這個用戶管理數(shù)據(jù)庫的權(quán)限,所以要么更改extmail用戶的權(quán)限,要么更換webman.cf中的用戶名為webman解決上面問題。 

          ------------------------------------

          問題8 新用戶無法登錄

          添加成功后,我們登錄看看,結(jié)果登錄報錯,提示未知用戶或密碼。

          Invalid account or password

          查看日志文件

          [root@centos58 extman]# tail /var/log/maillog

          Sep  7 11:19:56 centos58 extmail[17739]: user=, client=10.3.0.26, module=login, status=badlogin <---用test登錄

          Sep  7 11:21:20 centos58 extmail[17801]: user=<>, client=10.3.0.26, module=login, status=badlogin    <---用test@extmail.org用戶登錄情況

          Sep  7 11:21:58 centos58 extmail[17823]: user=, client=10.3.0.26, module=login, status=badlogin

          進入mysql查看一下test用戶情況

          [root@centos58 ~]# mysql -uextmail -pextmail

          mysql> use extmail;

          由前面無法新建用戶的故障我們知道了用戶信息是保存在mailbox這張表中,所以我們直接查看這張表的數(shù)據(jù),看能不能發(fā)現(xiàn)什么。

          mysql> select username,uid,password,maildir,mailhost,domain from mailbox\G;

          *************************** 2. row ***************************

          username: test@extmail.org

          uid: test

          password: $1$sikOoDKi$GMTYxGVX0h2qV5ID9qjsJ1

          maildir: extmail.org/test/Maildir/

          mailhost: 

          domain: extmail.org

          2 rows in set (0.00 sec)

          可以看到我們新建的test用戶實際是屬于extmail.org域的,也就是和我的sun.com并不是同一個域。問題就在這。(當(dāng)然,可以直接在web管理界面看到test用戶所屬域,更簡單)

          進入到extman web管理界面,添加新的域sun.com 

          Add sun.com ok

          這時候在添加新用戶的時候就可以選則用戶所屬的域了。

          New user test2@sun.com Added

          回到extmail登錄界面,用test2用戶登錄,成功登錄!

          總結(jié):這個問題比較2b。粗心所致。

          -------------------------------------

          問題9 webmail發(fā)送郵件測試,結(jié)果一直停在發(fā)送界面,無法發(fā)送郵件。

          查看日志文件。

          [root@centos58 ~]# tail /var/log/maillog -f

          Sep  7 11:53:39 centos58 postfix/smtpd[19109]: fatal: open /etc/postfix/mysql_virtual_alias_maps.cf: No such file or directory

          Sep  7 11:53:40 centos58 postfix/master[7686]: warning: process /usr/libexec/postfix/smtpd pid 19109 exit status 1

          Sep  7 11:53:40 centos58 postfix/master[7686]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling

          Sep  7 11:54:40 centos58 postfix/smtpd[19153]: fatal: open /etc/postfix/mysql_virtual_alias_maps.cf: No such file or directory

          Sep  7 11:54:41 centos58 postfix/master[7686]: warning: process /usr/libexec/postfix/smtpd pid 19153 exit status 1

          Sep  7 11:54:41 centos58 postfix/master[7686]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling

          Sep  7 11:55:41 centos58 postfix/smtpd[19191]: fatal: open /etc/postfix/mysql_virtual_alias_maps.cf: No such file or directory

          Sep  7 11:55:42 centos58 postfix/master[7686]: warning: process /usr/libexec/postfix/smtpd pid 19191 exit status 1

          Sep  7 11:55:42 centos58 postfix/master[7686]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling

          沒有mysql_virtual_alias_maps.cf文件。

          提示信息很明顯,在/etc/postfix文件夾下沒有mysql_virtual_maps.cf等文件。因為我沒將extman下面的模板文件拷貝過來。這些包默認(rèn)在extman的docs目錄下面。

          [root@centos58 docs]# pwd

          /var/www/extsuite/extman/docs

          [root@centos58 docs]# cp mysql_virtual_* /etc/postfix/

          再來訪問下看看報什么錯!郵件發(fā)送成功,沒有此類報錯。問題解決! 

          看看日志記錄情況

          [root@centos58 docs]# tail /var/log/maillog

          Sep  7 15:50:38 centos58 postfix/smtpd[28365]: disconnect from localhost.localdomain[127.0.0.1]

          Sep  7 15:53:49 centos58 extmail[28486]: user=, client=10.3.0.26, module=login, status=badlogin

          Sep  7 15:54:01 centos58 extmail[28490]: user=, client=10.3.0.26, module=login, status=loginok

          Sep  7 15:55:42 centos58 postfix/smtpd[28608]: warning: smtpd_sasl_auth_enable is true, but SASL support is not compiled in

          Sep  7 15:55:42 centos58 postfix/smtpd[28608]: connect from localhost.localdomain[127.0.0.1]

          Sep  7 15:55:42 centos58 postfix/smtpd[28608]: B74BEE3010: client=localhost.localdomain[127.0.0.1]

          Sep  7 15:55:42 centos58 postfix/cleanup[28614]: B74BEE3010: message-id=<20120907075542.B74BEE3010@mail.sun.com>

          Sep  7 15:55:42 centos58 postfix/qmgr[7688]: B74BEE3010: from=, size=655, nrcpt=2 (queue active)

          Sep  7 15:55:42 centos58 postfix/smtpd[28608]: disconnect from localhost.localdomain[127.0.0.1]

          Sep  7 15:55:45 centos58 postfix/smtp[28616]: B74BEE3010: to=, relay=163mx02.mxmail.netease.com[220.181.12.69]:25, delay=3, delays=0.26/0.15/0.59/2, dsn=2.0.0, status=sent (250 Mail OK queued as mx19,RcCowEDJXnyKqElQzTtvEQ--.1649S2 1347004556)

          由以上日志可以看到郵件已經(jīng)被正確投遞出去了!進到163郵箱確認(rèn)一下看。成功收到郵件!

          總結(jié):關(guān)于無法發(fā)送出郵件的原因很多,無法一一例舉。具體原因建議多看日志來尋找答案!

          -------------------------------------

          問題10 mysql虛擬用戶認(rèn)證不通過,無法發(fā)信

          [root@centos581 postfix]# telnet mail.sun.com 25

          Trying 10.3.0.100...

          Connected to mail.sun.com (10.3.0.100).

          Escape character is '^]'.

          220 mail.sun.com ESMTP Postfix

          ehlo da

          250-mail.sun.com

          250-PIPELINING

          250-SIZE 10240000

          250-VRFY

          250-ETRN

          250-ENHANCEDSTATUSCODES

          250-8BITMIME

          250 DSN

          mail from:aa@bb.com

          250 2.1.0 Ok

          rcpt to:test1@sun.com

          550 5.1.1: Recipient address rejected: User unknown in local recipient table

          提示我用戶未知,被拒絕。

          那么我們回到mysql中查看test1@sun.com這個用戶是否真的不存在

          mysql> select domain from domain;

          +--------------+

          | domain       |

          +--------------+

          | extmail.org  | 

          | mail.sun.com | 

          | sun.com      | 

          +--------------+

          mysql> select name,username,uidnumber,password from mailbox where username='test1@sun.com';

          +------------+------------------------+-----------+------------------------------------+

          | name       | username               | uidnumber | password                           |

          +------------+------------------------+-----------+------------------------------------+

          | test1      | test1@sun.com          |      1000 | $1$qeG0Ns8D$63ABiq2nF7jgNQ7EyN7UC/ | 

          +------------+------------------------+-----------+------------------------------------+

          用戶是存在于數(shù)據(jù)庫中的

          再查看maillog日志情況

          [root@centos58 ~]# tail /var/log/maillog

          Sep 10 16:43:42 centos58 postfix/cleanup[7155]: D9329A6F8: message-id=<>

          Sep 10 16:43:43 centos58 postfix/qmgr[19071]: D9329A6F8: from=, size=175, nrcpt=1 (queue active)

          Sep 10 16:43:43 centos58 postfix/trivial-rewrite[7125]: warning: do not list domain mail.sun.com in BOTH virtual_mailbox_domains and relay_domains

          Sep 10 16:43:43 centos58 postfix/virtual[7157]: D9329A6F8: to=, relay=virtual, delay=49, delays=49/0.05/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)

          Sep 10 16:43:43 centos58 postfix/qmgr[19071]: D9329A6F8: removed

          Sep 10 16:43:46 centos58 postfix/smtpd[7101]: disconnect from unknown[10.3.0.101]

          Sep 10 16:49:30 centos58 postfix/smtpd[7440]: warning: smtpd_sasl_auth_enable is true, but SASL support is not compiled in

          Sep 10 16:49:30 centos58 postfix/smtpd[7440]: connect from unknown[10.3.0.101]

          Sep 10 16:49:49 centos58 postfix/trivial-rewrite[7443]: warning: do not list domain sun.com in BOTH mydestination and virtual_mailbox_domains

          Sep 10 16:49:49 centos58 postfix/smtpd[7440]: NOQUEUE: reject: RCPT from unknown[10.3.0.101]: 550 5.1.1: Recipient address rejected: User unknown in local recipient table; from=to=proto=ESMTP helo=

          日志分析:

          1,smtpd_sasl_auth_enable is true, but SASL support is not compiled in

          sasl認(rèn)證已經(jīng)打開,但沒有加載sasl支持!因為我用的是rpm版,而rpm版默認(rèn)是不支持sasl認(rèn)證的。這個問題與解決此問題無關(guān),但我在后面會解決。

          2,warning: do not list domain sun.com in BOTH mydestination and virtual_mailbox_domains

          (我原來將這句話理解為“沒有在mydestination和virtual_mailbox_domains參數(shù)中找到sun.com這個域!”這是錯誤的!)

          意思應(yīng)該是 不要在mydestination和virtual_mailbox_domains同時定義同一個域,會沖突!且在出現(xiàn)沖突的情況下,系統(tǒng)會默認(rèn)以mydestination中定義的為準(zhǔn),那就代表著mysql中添加的sun.com虛擬域不生效,那么該域下的虛擬賬戶同樣也就無法生效了。這也就是為什么一直提示我的sun.com域中的test1用戶找不到的原因了,因為本地用戶里面根本沒這個賬戶,而mysql里面雖然有,但根本沒生效!

          3,Recipient address rejected: User unknown in local recipient table;

          收件地址拒絕,沒有找到用戶test1@sun.com。受上面錯誤配置的影響。

          解決辦法:

          根據(jù)日志分析,出現(xiàn)上述問題主要原因在于mydestination和virtual_mailbox_domains沖突所致!

          那么我們將mydestination字段留空!

          [root@centos58 courier-authlib]# vim /etc/postfix/main.cf

          mydestination = $mydomain

          改為

          mydestination =

          [root@centos58 courier-authlib]# /etc/init.d/postfix restart

          再次測試

          [root@centos Desktop]# telnet 10.3.0.100 25

          Trying 10.3.0.100...

          Connected to 10.3.0.100.

          Escape character is '^]'.

          220 mail.sun.com ESMTP Postfix

          ehlo

          501 Syntax: EHLO hostname

          mail from:ss@sun.com

          250 2.1.0 Ok

          rcpt to:test1@sun.com

          250 2.1.5 Ok

          data

          354 End data with.

          hello test mail!

          .

          250 2.0.0 Ok: queued as 76BB1E319C

          quit

          221 2.0.0 Bye

          Connection closed by foreign host.

          測試成功,沒有再報錯!

          再看看日志情況

          [root@centos58 courier-authlib]# tail /var/log/maillog

          Sep 12 09:16:55 centos58 postfix/postfix-script[15306]: starting the Postfix mail system

          Sep 12 09:16:55 centos58 postfix/master[15307]: daemon started -- version 2.8.12, configuration /etc/postfix

          Sep 12 09:17:32 centos58 postfix/smtpd[15347]: warning: smtpd_sasl_auth_enable is true, but SASL support is not compiled in

          Sep 12 09:17:32 centos58 postfix/smtpd[15347]: connect from centos.sun.com[10.3.0.26]

          Sep 12 09:18:09 centos58 postfix/smtpd[15347]: 76BB1E319C: client=centos.sun.com[10.3.0.26]

          Sep 12 09:18:22 centos58 postfix/cleanup[15396]: 76BB1E319C: message-id=<>

          Sep 12 09:18:22 centos58 postfix/qmgr[15309]: 76BB1E319C: from=, size=193, nrcpt=1 (queue active)

          Sep 12 09:18:22 centos58 postfix/virtual[15401]: 76BB1E319C: to=, relay=virtual, delay=38, delays=38/0.05/0/0.05, dsn=2.0.0, status=sent (delivered to maildir)

          Sep 12 09:18:22 centos58 postfix/qmgr[15309]: 76BB1E319C: removed

          Sep 12 09:18:23 centos58 postfix/smtpd[15347]: disconnect from centos.sun.com[10.3.0.26]

          ok!日志記錄正常!

          用瀏覽器登錄mail.sun.com,用test1用戶登錄郵箱看是否收到郵件。ok!test1順利收到郵件??词欠衲馨l(fā)信給test2,ok順利發(fā)送!發(fā)給外網(wǎng)sunjiebin2006@163.com看看,ok順利發(fā)送!

          登錄test2@sun.com和sunjiebin2006@163.com查看郵件。一路綠燈,都收到!

          總結(jié):在打開了虛擬認(rèn)證后最好將mydestination字段留空或注釋掉,不要和virtual_mailbox_domains中定義的域相同而導(dǎo)致沖突。當(dāng)然,如果mydestination中的域名和mysql中定義的虛擬域不相同的話也是可以的!

          ------------------------------------

          問題11 pop3無法順利收信

          測試pop3收信

          下面又迎來了新的問題,發(fā)信雖然成功,收信仍需努力!pop3收信認(rèn)證又有問題!

          [root@centos Desktop]# telnet mail.sun.com 110

          Trying 10.3.0.100...

          Connected to mail.sun.com.

          Escape character is '^]'.

          +OK Dovecot ready.

          user test1@sun.com

          +OK

          pass 123456

          +OK Logged in.

          -ERR [IN-USE] Couldn't open INBOX: Internal error occurred. Refer to server log for more information. [2012-09-13 14:54:01]

          Connection closed by foreign host.

          直接提示無法打開收信夾。在服務(wù)器端看日志

          [root@centos58 postfix]# tail /var/log/maillog

          Sep 13 14:54:01 centos58 dovecot: auth-worker(default): mysql: Connected to localhost (extmail)

          Sep 13 14:54:01 centos58 dovecot: POP3(test1@sun.com): stat(/home/domains/sun.com/test1/Maildir/cur) failed: Permission denied

          Sep 13 14:54:01 centos58 dovecot: POP3(test1@sun.com): stat(/home/domains/sun.com/test1/Maildir/cur) failed: Permission denied

          Sep 13 14:54:01 centos58 dovecot: POP3(test1@sun.com): Couldn't open INBOX: Internal error occurred. Refer to server log for more information. [2012-09-13 14:54:01]

          Sep 13 14:54:01 centos58 dovecot: POP3(test1@sun.com): Couldn't open INBOX top=0/0, retr=0/0, del=0/0, size=0

          Sep 13 14:54:01 centos58 dovecot: pop3-login: Login: user=, method=PLAIN, rip=::ffff:10.3.0.26, lip=::ffff:10.3.0.100

          提示/home/domains/sun.com/test1/Maildir/cur文件夾無法訪問

          我們看看這個目錄的權(quán)限

          [root@centos58 domains]# ll -d /home/domains/

          drwx------ 5 vuser vuser 4096 Sep  7 16:21 /home/domains/

          [root@centos58 domains]# ll /home/domains/sun.com/

          drwx------ 3 vuser vuser 4096 Sep 10 10:40 test1

          drwx------ 3 vuser vuser 4096 Sep  7 11:50 test2

          drwx------ 3 vuser vuser 4096 Sep 12 09:55 test3

          所有目錄都屬于vuser,且只有vuser具有完全權(quán)限,其它用戶都沒有權(quán)限。

          那么我們試著更改一下權(quán)限看看。

          [root@centos58 home]# chmod 755 domains/     <-----注意這個父目錄的權(quán)限,如果只改/home/domains/下面的子目錄而不改/home/domains目錄本身的話依然會無法訪問!

          [root@centos58 domains]# chmod 755 sun.com/

          [root@centos58 sun.com]# cp -a test1 test1.bak

          [root@centos58 sun.com]# chmod -R 777 test1

          [root@centos58 home]# ll -d domains/

          drwxr-xr-x 5 vuser vuser 4096 Sep  7 16:21 domains/

          [root@centos58 domains]# ll -d sun.com

          drwxr-xr-x 6 vuser vuser 4096 Sep 13 15:26 sun.com

          [root@centos58 domains]# ll -d sun.com/test1

          drwxrwxrwx 3 vuser vuser 4096 Sep 10 10:40 sun.com/test1

          現(xiàn)在test1文件夾及其父目錄所有用戶都能訪問了。下面我們再測試一下看

          [root@centos Desktop]# telnet  mail.sun.com 110

          Trying 10.3.0.100...

          Connected to mail.sun.com.

          Escape character is '^]'.

          +OK Dovecot ready.

          user test1@sun.com

          +OK

          pass 123456

          +OK Logged in.

          list

          +OK 7 messages:

          1 279

          2 666

          3 1112

          retr 1

          +OK 279 octets

          Return-Path:

          X-Original-To: test1@sun.com

          Delivered-To: test1@sun.com

          Received: from centos.sun.com (centos.sun.com [10.3.0.26])

          by mail.sun.com (Postfix) with SMTP id 76BB1E319C

          for; Wed, 12 Sep 2012 09:17:44 +0800 (CST)

          hello test mail!

          改了權(quán)限后,pop3認(rèn)證也成功了!那么引發(fā)出一個問題,很明顯pop3并不是用的我們的vuser用戶來讀取用戶的郵件的,那么它是用的哪個用戶呢?我們總不能將所有郵件權(quán)限都設(shè)為777吧,那樣太不安全了!

          一個偶然的機會發(fā)現(xiàn)了它的默認(rèn)用戶

          [root@centos58 Maildir]# ll

          total 64

          -rwxrwxrwx 1 vuser vuser   452 Sep 12 14:08 abook.cf

          drwxrwxrwx 2 vuser vuser  4096 Sep 13 16:54 cur

          -rw------- 1  1000  1000   240 Sep 13 16:54 dovecot.index

          -rw------- 1  1000  1000 16384 Sep 13 15:43 dovecot.index.cache

          -rw------- 1  1000  1000   360 Sep 13 16:54 dovecot.index.log

          -rw------- 1  1000  1000   425 Sep 13 16:54 dovecot-uidlist

          原來它用的是id=1000這個用戶,但這個用戶在我系統(tǒng)中并不存在。問題好解決了。把vuser的uid改為1000應(yīng)該就行了!

          其實這個默認(rèn)用戶不僅僅只是適用于dovecot,extmail/extman所用的虛擬賬戶也是默認(rèn)映射為id=1000的這個本地用戶??梢酝ú樵僲ailbox表來查看一下。

          mysql> select username,uidnumber,gidnumber from mailbox ;

          +------------------------+-----------+-----------+

          | username               | uidnumber | gidnumber |

          +------------------------+-----------+-----------+

          | postmaster@extmail.org |      1000 |      1000 | 

          | test@extmail.org       |      1000 |      1000 | 

          | test2@sun.com          |      1000 |      1000 | 

          下面將相關(guān)目錄的uid,gid都改為1000這個用戶

          [root@centos58 Maildir]# id vuser

          uid=1002(vuser) gid=1002(vuser) groups=1002(vuser)

          [root@centos58 Maildir]# usermod -u 1000 vuser

          [root@centos58 Maildir]# id vuser

          uid=1000(vuser) gid=1002(vuser) groups=1002(vuser)

          [root@centos58 Maildir]# usermod -g 1000 vuser

          [root@centos58 Maildir]# id vuser

          uid=1000(vuser) gid=1000(vuser) groups=1000(vuser)

          [root@centos58 home]# chown -R vuser:vuser domains 

          [root@centos58 home]# ll -d domains/

          drwxr-xr-x 5 1002 1002 4096 Sep  7 16:21 domains/

          [root@centos58 home]# chown -R vuser:vuser domains

          [root@centos58 home]# ll -d domains/

          drwxr-xr-x 5 vuser vuser 4096 Sep  7 16:21 domains/

          好了,現(xiàn)在郵件的權(quán)限都為vuser,并且uid,gid都為1000了!

          我們把test1的文件夾都恢復(fù)默認(rèn)

          [root@centos58 domains]# chmod 700 sun.com

          [root@centos58 sun.com]# chmod -R 700 test1

          [root@centos58 sun.com]# ll test1

          total 8

          drwx------ 10 vuser vuser 4096 Sep 13 17:38 Maildir

          注意還要改一下postfix里面的main.cf,因為以前我們設(shè)的虛擬映射用戶為1002要改過來

          [root@centos58 ~]# vim /etc/postfix/main.cf

          virtual_uid_maps = static:1002

          virtual_gid_maps = static:1002

          改為

          virtual_uid_maps = static:1000

          virtual_gid_maps = static:1000

          [root@centos58 ~]# /etc/init.d/postfix restart

          注意同時還得改變下網(wǎng)站家目錄的所屬用戶。因為以前我們是用的uid=1002的用戶。不改回來會提示訪問拒絕。

          [root@centos58 home]# find /var/www/ -uid 1002 -exec chown vuser:vuser  {} \;

          現(xiàn)在再來telnet測試一下

          [root@centos Desktop]# telnet  mail.sun.com 110

          Trying 10.3.0.100...

          Connected to mail.sun.com.

          Escape character is '^]'.

          +OK Dovecot ready.

          user test1@sun.com

          +OK

          pass 123456

          +OK Logged in.

          list

          +OK 8 messages:

          1 279

          用test2@sun.com來測試下

          [root@centos Desktop]# telnet  mail.sun.com 110

          Trying 10.3.0.100...

          Connected to mail.sun.com.

          Escape character is '^]'.

          +OK Dovecot ready.

          user test2@sun.com

          +OK

          pass 123456

          +OK Logged in.

          這次真的都o(jì)k了!

          登錄webmail也成功了!

          至此,發(fā)信認(rèn)證和收信認(rèn)證都成功了!

          總結(jié):此次故障出現(xiàn)主要是“問題4”埋下的禍根,當(dāng)時不知道uid=1000是必需的。問題本身并不難,看日志提示就知道錯誤問題所在,但為什么dovecot默認(rèn)用戶是uid=1000這個用戶?這個我也不太清楚。

          ------------------------------------

          問題12 定制rpm版的postfix時報錯

          由于前面我們默認(rèn)的rpm版postfix軟件包并沒有支持sasl認(rèn)證,現(xiàn)在我們用rpm定制版重新安裝postfix

          下載定制版rpm

          [root@centos58 postfix-2.8.12]# wget http://ftp.wl0.org/official/2.8/SRPMS/postfix-2.8.8-1.src.rpm

          [root@centos58 postfix-2.8.12]# rpm -ivh /usr/src/postfix-2.8.8-1.src.rpm 

          [root@centos58 SPECS]# vim /usr/src/redhat/SPECS/postfix.spec 

          %define with_cdb          0

          %define with_ldap         1

          %define with_mysql        1

          %define with_mysql_redhat 1

          %define with_pcre         0

          %define with_pgsql        0

          %define with_sasl         2

          %define with_spf          0

          %define with_dovecot      1

          %define with_tls          1

          %define with_tlsfix       2

          %define with_vda          0

          with_mysql為1代表支持www.mysql.com網(wǎng)站上面的mysql。

          with_mysql_redhat為1代表支持redhat的mysql,即我們用yum裝的就屬于這種。

          with_sasl為2代表支持sasl2。為1代表支持sasl1?,F(xiàn)在一般都是用sasl2了。所以選2。

          [root@centos58 SPECS]# rpmbuild -ba postfix.spec 

          error: Failed build dependencies:

          MySQL-shared is needed by postfix-2.8.8-1.rhel5.x86_64

          MySQL-devel is needed by postfix-2.8.8-1.rhel5.x86_64

          出現(xiàn)報錯說要MySQL-shared MySQL-devel.

          [root@centos58 SPECS]# yum list MySQL*

          [root@centos58 SPECS]# yum list MySQL* |grep shared

          [root@centos58 SPECS]# yum list MySQL* |grep devel

          mysql-devel.x86_64                       5.0.95-1.el5_7.1              installed

          mysql-devel.i386                         5.0.95-1.el5_7.1              updates  

          yum中竟然沒有MySQL-shared!!

          看下postfix.spec中的代碼

          [root@centos58 SPECS]# vim postfix.spec

          %if %{with_mysql}

          Requires: MySQL-shared

          BuildRequires: MySQL-shared, MySQL-devel

          原來是加載mysql支持的時候要這個。

          去掉mysq的支持,保留mysql-redhat試一下。

          %define with_mysql        0

          %define with_mysql_redhat 1

          沒有看到error之類的報錯,編譯成功!

          進入rpm包生成的位置

          [root@centos58 RPMS]# ls /usr/src/redhat/RPMS/x86_64/

          postfix-2.8.8-1.rhel5.x86_64.rpm  postfix-debuginfo-2.8.8-1.rhel5.x86_64.rpm

          安裝定制好的rpm包

          [root@centos58 x86_64]# rpm -ivh postfix-2.8.8-1.rhel5.x86_64.rpm 

          [root@centos58 x86_64]# rpm -q postfix

          postfix-2.8.8-1.rhel5

          看看支持的模塊

          [root@centos58 x86_64]# postconf -m

          btree

          cidr

          environ

          hash

          internal

          ldap

          mysql

          nis

          proxy

          regexp

          static

          tcp

          texthash

          unix

          可看到支持mysql

          [root@centos58 x86_64]# cp /etc/postfix/main.cf.bak /etc/postfix/main.cf

          cp: overwrite `/etc/postfix/main.cf'? y

          [root@centos58 x86_64]# /etc/init.d/postfix restart

          查看是不是支持sasl認(rèn)證了!

          [root@centos58 local]# postconf  -a 

          cyrus   <---------這里出現(xiàn)這一行代表postfix已經(jīng)支持了sasl認(rèn)證模塊,與配置文件main.cf中是否打開sasl認(rèn)證無關(guān)

          dovecot

          可以看到有了cyrus。。也可以用下面的telnet上去看,看到兩個AUTH證明成功了!

          [root@centos Desktop]# telnet  mail.sun.com 25

          Trying 10.3.0.100...

          Connected to mail.sun.com.

          Escape character is '^]'.

          220 mail.sun.com ESMTP Postfix

          ehlo test

          250-mail.sun.com

          250-PIPELINING

          250-SIZE 10240000

          250-VRFY

          250-ETRN

          250-AUTH LOGIN PLAIN   <---------這里出現(xiàn)認(rèn)證支持僅代表main.cf配置文件中已經(jīng)打開了認(rèn)證功能,與postfix是否支持sasl模塊無關(guān)

          250-AUTH=LOGIN PLAIN

          250-ENHANCEDSTATUSCODES

          250-8BITMIME

          250 DSN

          看來postfix已經(jīng)支持sasl認(rèn)證了。

          總結(jié):在定制版中,如果你沒有安裝oracle官網(wǎng)的mysql的時,就不要打開 with_mysql 這個參數(shù)的支持。直接打開 with_mysql_redhat 就行了。我們默認(rèn)就是用的這個。

          ------------------------------------

          問題13 用sasl發(fā)信認(rèn)證失敗

          我們來測試一下發(fā)信看看

          首先用perl產(chǎn)生加密的登錄賬號和密碼

          [root@centos58 postfix-2.8.12]# perl -MMIME::Base64 -e "print encode_base64('test1@sun.com');"

          dGVzdDFAc3VuLmNvbQ==

          [root@centos58 postfix-2.8.12]# perl -MMIME::Base64 -e "print encode_base64('123456');"

          MTIzNDU2

          回到客戶端來測試

          [root@centos Desktop]# telnet  mail.sun.com 25

          Trying 10.3.0.100...

          Connected to mail.sun.com.

          Escape character is '^]'.

          220 mail.sun.com ESMTP Postfix

          ehlo test  

          250-mail.sun.com

          250-PIPELINING

          250-SIZE 10240000

          250-VRFY

          250-ETRN

          250-AUTH LOGIN PLAIN

          250-AUTH=LOGIN PLAIN

          250-ENHANCEDSTATUSCODES

          250-8BITMIME

          250 DSN

          auth login

          334 VXNlcm5hbWU6

          dGVzdDFAc3VuLmNvbQ==

          334 UGFzc3dvcmQ6

          MTIzNDU2

          535 5.7.8 Error: authentication failed: generic failure

          竟然認(rèn)證失敗了!看日志!

          [root@centos58 ~]# tail /var/log/maillog

          Sep 13 09:17:21 centos58 authdaemond: Installing libauthmysql

          Sep 13 09:17:21 centos58 authdaemond: Installation complete: authmysql

          Sep 13 09:18:32 centos58 extmail[5083]: user=, client=10.3.0.26, module=login, status=loginok

          Sep 13 09:19:20 centos58 postfix/smtpd[5149]: connect from centos.sun.com[10.3.0.26]

          Sep 13 09:22:33 centos58 postfix/smtpd[5149]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory

          Sep 13 09:22:33 centos58 postfix/smtpd[5149]: warning: centos.sun.com[10.3.0.26]: SASL login authentication failed: generic failure

          說不能連接到saslauthd服務(wù)。因為沒啟動saslauthd...!

          [root@centos58 ~]# /etc/init.d/saslauthd start

          Starting saslauthd:                                        [  OK  ]

          [root@centos Desktop]# telnet mail.sun.com 25Trying 10.3.0.100...

          Connected to mail.sun.com.

          Escape character is '^]'.

          220 mail.sun.com ESMTP Postfix

          ehlo go

          250-mail.sun.com

          250-PIPELINING

          250-SIZE 10240000

          250-VRFY

          250-ETRN

          250-AUTH LOGIN PLAIN

          250-AUTH=LOGIN PLAIN

          250-ENHANCEDSTATUSCODES

          250-8BITMIME

          250 DSN

          auth login

          334 VXNlcm5hbWU6

          dGVzdDFAc3VuLmNvbQ==

          334 UGFzc3dvcmQ6

          MTIzNDU2

          535 5.7.8 Error: authentication failed: authentication failure

          還是失敗了!

          [root@centos58 ~]# tail /var/log/maillog

          Sep 13 09:31:04 centos58 postfix/smtpd[5800]: connect from centos.sun.com[10.3.0.26]

          Sep 13 09:31:44 centos58 postfix/smtpd[5800]: warning: centos.sun.com[10.3.0.26]: SASL login authentication failed: authentication failure

          Sep 13 09:31:50 centos58 postfix/smtpd[5800]: disconnect from centos.sun.com[10.3.0.26]

          這次不再是找不到服務(wù)器了,而是提示認(rèn)證失敗了!

          我們用本地用戶試試

          [root@centos Desktop]# telnet mail.sun.com 25

          Trying 10.3.0.100...

          Connected to mail.sun.com.

          Escape character is '^]'.

          220 mail.sun.com ESMTP Postfix

          ehlo helo

          250-mail.sun.com

          250-PIPELINING

          250-SIZE 10240000

          250-VRFY

          250-ETRN

          250-AUTH LOGIN PLAIN

          250-AUTH=LOGIN PLAIN

          250-ENHANCEDSTATUSCODES

          250-8BITMIME

          250 DSN

          auth login

          334 VXNlcm5hbWU6

          c3Vu

          334 UGFzc3dvcmQ6

          MTIzNDU2

          235 2.7.0 Authentication successful

          本地認(rèn)證是成功的!

          為什么會出現(xiàn)這種情況?我們看看我們的sasl進程

          [root@centos58 local]# ps aux |grep sasl

          root      5535  0.0  0.1  48856  1140 ?        Ss   09:25   0:00 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam

          root      5536  0.0  0.1  48856  1128 ?        S    09:25   0:00 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam

          其中-m代表saslauthd的工作目錄在/var/run/saslauthd下面。-a代表所啟用的驗證機制。這里代表用pam來驗證!pam驗證是啥?我們的系統(tǒng)登錄就是用的調(diào)用pam來驗證用戶密碼的?。∫簿褪钦f,這時候的saslauthd是調(diào)用的pam來驗證的我們的賬戶!而pam剛好可以驗證本地賬戶。這也就是為什么我用真實賬戶sun為什么能驗證通過的原因。而我們的虛擬賬號test1@sun.com并不是用pam機制來驗證,而是采用的mysql自身來驗證的,所以會提示驗證失?。∧敲磗aslauthd能否支持mysql的驗證呢?我們可以man saslauthd來看看,發(fā)現(xiàn)saslauthd支持多達(dá)10種認(rèn)證方式,但偏偏沒有mysql的驗證!所以說,用saslauthd是不能驗證mysql虛擬賬戶的!那么我們得改變一下postfix所采用的驗證機制!

          [root@centos58 local]# vim /usr/lib64/sasl2/smtpd.conf

          pwcheck_method: authdaemond  <-----這里不再是saslauthd

          mech_list: PLAIN LOGIN

          authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socke  <--------這里有錯誤,我先不改過來,等著看后面的好戲吧!

          [root@centos Desktop]# telnet mail.sun.com 25

          .......

          auth login

          334 VXNlcm5hbWU6

          dGVzdDFAc3VuLmNvbQ==

          334 UGFzc3dvcmQ6

          MTIzNDU2

          535 5.7.8 Error: authentication failed: generic failure

          還是失敗了!再看日志

          [root@centos58 usr]# tail /var/log/maillog

          ......

          Sep 13 11:37:22 centos58 postfix/smtpd[31886]: warning: SASL authentication failure: cannot connect to Courier authdaemond: No such file or directory

          Sep 13 11:37:22 centos58 postfix/smtpd[31886]: warning: centos.sun.com[10.3.0.26]: SASL login authentication failed: generic failure

          提示無法連接到authdaemond進程,找不到文件或目錄。我們先看看有沒有啟動這個進程

          [root@centos58 usr]# ps aux  | grep authdaemond

          root     31384  0.0  0.0   3808   440 ?        S    11:31   0:00 /usr/local/courier-authlib/sbin/courierlogger -pid=/usr/local/courier-authlib/var/spool/authdaemon/pid -start /usr/local/courier-authlib/libexec/courier-authlib/authdaemond

          root     31385  0.0  0.1  52448  1548 ?        S    11:31   0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond

          root     31386  0.0  0.0  52448   480 ?        S    11:31   0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond

          進程是啟動的。把進程停掉,結(jié)果報錯還是一樣的結(jié)果!所以不是courier-authlib進程的問題,而是postfix壓根兒就沒和authdaemond建立連接。

          我們在學(xué)習(xí)mysql的時候知道,mysql本地連接是利用socket和進程通信的。那么同樣的,現(xiàn)在postfix和courier連接也是利用socket來連接的。那么首先我們先確定一下我們指定的socket是否存在吧!

          [root@centos58 local]# vim /usr/lib64/sasl2/smtpd.conf

          authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socke

          [root@centos58 ~]# ls /usr/local/courier-authlib/var/spool/authdaemon/socke

          ls: /usr/local/courier-authlib/var/spool/authdaemon/socke: No such file or directory

          看到?jīng)],根本沒這個文件!那么問題就在這了!

          [root@centos58 local]# vim /usr/lib64/sasl2/smtpd.conf

          authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socke  <-----看到問題所在了吧!掉了個t!

          改過來

          [root@centos58 local]# vim /usr/lib64/sasl2/smtpd.conf

          pwcheck_method: authdaemond

          mech_list: PLAIN LOGIN

          authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

          [root@centos58 local]# /etc/init.d/postfix restart    <----------一定要重啟postfix才能使修改過的smtpd.conf重新生效,我開始就是沒重啟進程而苦惱了很久找不到原因!

          登錄驗證看

          [root@centos Desktop]# telnet mail.sun.com 25

          Trying 10.3.0.100...

          Connected to mail.sun.com.

          Escape character is '^]'.

          220 mail.sun.com ESMTP Postfix

          auth login

          334 VXNlcm5hbWU6

          dGVzdDFAc3VuLmNvbQ==

          334 UGFzc3dvcmQ6

          MTIzNDU2

          235 2.7.0 Authentication successful

          驗證成功!

          另外,網(wǎng)絡(luò)上也說了出現(xiàn)此問題的方法,一般大致有三種情況。

          1,smtp.conf配置文件中文件名或參數(shù)寫錯

          2,/usr/local/courier-authlib/var/spool/authdaemon/這個目錄權(quán)限不對,需要755權(quán)限才能正確運行。

          3,postfix開啟了chroot環(huán)境,導(dǎo)致postfix只能讀取其籠環(huán)境之內(nèi)的文件。

          下面我們來驗證下1和2問題

          問題1

          [root@centos58 usr]# vim /usr/lib64/sasl2/smtpd.conf

          authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket 

          我在socket后面故意多打了一個空格

          [root@centos58 usr]# /etc/init.d/postfix restart

          [root@centos Desktop]# telnet mail.sun.com 25

          auth login

          334 VXNlcm5hbWU6

          dGVzdDJAc3VuLmNvbQ==

          334 UGFzc3dvcmQ6

          MTIzNDU2

          535 5.7.8 Error: authentication failed: generic failure

          果然認(rèn)證失敗。

          [root@centos58 local]# tail /var/log/maillog

          Sep 13 12:59:49 centos58 postfix/smtpd[5327]: warning: SASL authentication failure: cannot connect to Courier authdaemond: No such file or directory

          Sep 13 12:59:49 centos58 postfix/smtpd[5327]: warning: centos.sun.com[10.3.0.26]: SASL login authentication failed: generic failure

          同樣的日志信息

          問題2

          [root@centos58 usr]# ll /usr/local/courier-authlib/var/spool/authdaemon/ -d

          drwxr-xr-x 2 daemon daemon 4096 Sep 13 12:36 /usr/local/courier-authlib/var/spool/authdaemon/

          [root@centos58 usr]# chmod 744 /usr/local/courier-authlib/var/spool/authdaemon/

          [root@centos58 usr]# /etc/init.d/postfix restart

          [root@centos Desktop]# telnet mail.sun.com 25

          ....

          auth login

          334 VXNlcm5hbWU6

          dGVzdDJAc3VuLmNvbQ==

          334 UGFzc3dvcmQ6

          MTIzNDU2

          535 5.7.8 Error: authentication failed: generic failure

          [root@centos58 local]# tail /var/log/maillog

          Sep 13 13:06:11 centos58 postfix/smtpd[6059]: warning: SASL authentication failure: cannot connect to Courier authdaemond: Permission denied

          Sep 13 13:06:11 centos58 postfix/smtpd[6059]: warning: centos.sun.com[10.3.0.26]: SASL login authentication failed: generic failure

          也是同樣的日志信息!

          至此,smtp發(fā)信認(rèn)證搞定了!

          總結(jié):出現(xiàn)sasl認(rèn)證失敗,我遇到了三個原因。

          1,postfix未添加sasl模塊支持.這時候可以通過安裝源碼包或定制rpm包來添加支持。

          2,mysql的sasl認(rèn)證要用courier-authlib這個軟件來支持,系統(tǒng)默認(rèn)裝的的cyrus-sasl是不支持mysql認(rèn)證的

          3,/usr/lib/sasl2/smtpd.conf這個配置文件里面認(rèn)證方式要采用authdaemond,而不是saslauthd。配置文件中socket路徑一定要寫對,不要多打空格!

          4,服務(wù)要啟動!

          --------------------------------------------------------------------------------------------------

          問題14 imap無法連接

          有時候imap連接好好的,可過一會后就發(fā)現(xiàn)無法連接上了。雷鳥報超過最大連接數(shù)限制。直接用telnet服務(wù)器發(fā)現(xiàn)無法連接。

          [root@centos Desktop]# telnet mail.sun.com 143

          Trying 10.3.0.100...

          Connected to mail.sun.com.

          Escape character is '^]'.

          Connection closed by foreign host.

          查看服務(wù)器端日志

          [root@mail bin]# tail /var/log/maillog 

          Sep 21 13:49:12 mail imapd: Maximum connection limit reached for ::ffff:116.24.82.12

          提示已經(jīng)達(dá)到最大連接數(shù)限制。

          我們用netstat看看連接數(shù)為多少了

          [root@mail etc]# netstat  -tna |grep 143

          tcp        0      0 10.3.0.100:143           116.24.82.12:2393           ESTABLISHED 

          tcp        0      0 10.3.0.100:143           116.24.82.12:2395           ESTABLISHED 

          tcp        0      0 10.3.0.100:143           116.24.82.12:2394           ESTABLISHED 

          tcp        0      0 10.3.0.100:143           116.24.82.12:2397           TIME_WAIT   

          tcp        0      0 10.3.0.100:143           116.24.82.12:2396           ESTABLISHED 

          tcp        0      0 10.3.0.100:143           116.24.82.12:2398           TIME_WAIT   

          可以看到116.24.82.12的客戶端ip和服務(wù)器端共建立了4個連接

          這時候telnet上去就直接報拒絕了。

          解決辦法:

          我們看看imapd配置文件

          [root@yx_host etc]# vim /usr/lib/courier-imap/etc/imapd

          #  Maximum number of connections to accept from the same IP address

          MAXPERIP=4    <-----這個即代表每個ip最大連接數(shù)為4,與上面連接數(shù)吻合!

          改為

          MAXPERIP=20

          由于公司用的人比較多,所以4個顯然不夠用。將這個值改為20.

          [root@mail etc]# /etc/init.d/courier-imap restart

          搞定! 

          --------------------------------------------------------------------------------------------------

          2012.11.02

          問題15,每次發(fā)信很慢,要幾十秒才能發(fā)信成功

          直接看日志情況:

          Oct 24 15:02:39 localhost postfix/smtpd[99067]: connect from unknown[113.116.236.65]

          Oct 24 15:03:01 localhost postfix/smtpd[99067]: warning: 65.236.116.113.opm.blitzed.org: RBL lookup error: Host or domain name not found. Name service error for name=65.236.116.113.opm.blitzed.org type=A: Host not found, try again

          Oct 24 15:03:01 localhost postfix/smtpd[99067]: AB89823F046: client=unknown[113.116.236.65], sasl_method=LOGIN, sasl_username=test2@example.com

          Oct 24 15:03:01 localhost postfix/cleanup[99102]: AB89823F046: message-id=<201210241502429841144@example.com>

          Oct 24 15:03:01 localhost postfix/qmgr[12944]: AB89823F046: from=, size=1701, nrcpt=1 (queue active)

          Oct 24 15:03:01 localhost postfix/smtpd[99067]: disconnect from unknown[113.116.236.65]

          Oct 24 15:03:02 localhost postfix/smtp[99103]: AB89823F046: to=<445335413@qq.com>, relay=mx3.qq.com[119.147.192.199]:25, delay=23, delays=23/0/0.04/0.31, dsn=2.0.0, status=sent (250 Ok: queued as )

          Oct 24 15:03:02 localhost postfix/qmgr[12944]: AB89823F046: removed

          日志顯示我們15:02:39開始連接,而在15:03:01返回了RBL查詢錯誤信息,隨后才發(fā)出郵件。問題很明顯,RBL查詢超時導(dǎo)致的!

          編輯main.cf,去掉RBL實時黑名單查詢功能。

          localhost# vi /etc/postfix/main.cf

          #smtpd_client_restrictions =

          #       reject_rbl_client cblless.anti-spam.org.cn, 

          #       reject_rbl_client cdl.anti-spam.org.cn, 

          #       reject_rbl_client opm.blitzed.org, 

          #       reject_rbl_client bl.spamcop.net 

          localhost# postfix reload

          再發(fā)郵件

          Oct 24 15:25:16 localhost postfix/smtpd[99296]: connect from unknown[113.116.236.65]

          Oct 24 15:25:16 localhost postfix/smtpd[99296]: AD9BC23F047: client=unknown[113.116.236.65], sasl_method=LOGIN, sasl_username=test2@example.com

          Oct 24 15:25:16 localhost postfix/cleanup[99348]: AD9BC23F047: message-id=<201210241525203286146@example.com>

          Oct 24 15:25:16 localhost postfix/qmgr[99278]: AD9BC23F047: from=, size=1703, nrcpt=1 (queue active)

          Oct 24 15:25:16 localhost postfix/smtpd[99296]: disconnect from unknown[113.116.236.65]

          Oct 24 15:25:17 localhost postfix/smtp[99356]: AD9BC23F047: to=<445335413@qq.com>, relay=mx3.qq.com[113.108.77.23]:25, delay=0.49, delays=0.14/0/0.05/0.31, dsn=2.0.0, status=sent (250 Ok: queued as )

          Oct 24 15:25:17 localhost postfix/qmgr[99278]: AD9BC23F047: removed

          從連接到發(fā)送1s內(nèi)完成,正常了!

          總結(jié):由于開戶了客戶端RBL查詢驗證功能,所以在客戶端發(fā)信之前postfix服務(wù)器會先將客戶端IP發(fā)給RBL服務(wù)器來查詢該IP是否位于實時黑名單之中。如果在黑名單中,則會拒絕客戶端的發(fā)信請求。而當(dāng)postfix無法連接上RBL服務(wù)器時,則會有一個等待超時的時間,只有在查詢超時后,才會繼續(xù)后續(xù)的投遞操作。所以,造成了發(fā)信過程中幾十秒的延遲問題。

          中國反垃圾郵件聯(lián)盟  http://www.anti-spam.org.cn/

          postfix中配置使用casa RBL http://www.anti-spam.org.cn/AID/15

          只不過 cblless.anti-spam.org.cn 這個鏈接地址貌似連接不上。所以我取消了RBL功能。

          --------------------------------------------------------------------------------------------------

          2012.11.02

          問題16 extmail總是無法發(fā)送郵件,一直卡在正在發(fā)郵件那里。而用foxmail等郵件客戶端卻可以正常發(fā)送。

          分析: 

          查看日志

          localhost# tail -20000 /var/log/maillog | grep test2

          Oct 24 02:55:26 localhost extmail[12253]: user=, client=163.125.216.2, module=login, status=loginok

          Oct 24 02:56:28 localhost postfix/smtpd[12204]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 553 5.7.1 : Sender address rejected: not logged in; from= to= proto=ESMTP helo=

          Oct 24 03:07:01 localhost postfix/smtpd[12206]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 553 5.7.1 : Sender address rejected: not logged in; from= to= proto=ESMTP helo=提示來自Localhost的登錄拒絕,提示沒有登錄。因為extmail沒有使用認(rèn)證發(fā)信的方式。 reject: RCPT from localhost[127.0.0.1]: 553Oct 24 03:00:02 localhost extmail[34131]: user=, client=27.38.21.195, module=login, status=loginok

          提示來自127.0.0.1的登錄拒絕.

          Sender address rejected: not logged in

          提示發(fā)信地址拒絕,因為前面登錄失敗,所以這里提示我們沒有登錄,拒絕發(fā)信。

          服務(wù)器不允許我們本地登錄,那么我們查看一下mynetworks選項的設(shè)定。

          localhost# grep mynetworks /etc/postfix/main.cf

          結(jié)果發(fā)現(xiàn)配置文件中沒有定義mynetworks選項。

          解決:

          將mynetworks添加上,然后在smtpd_sender_restrictions選項中允許mynetworks登錄。

          localhost# vi main.cf

          mynetworks = 127.0.0.0/8

          smtpd_sender_restrictions =

          permit_mynetworks,

          reject_sender_login_mismatch,

          reject_non_fqdn_sender,

          reject_unauthenticated_sender_login_mismatch,

          reject_non_fqdn_recipient,

          reject_invalid_hostname,

          reject_unknown_sender_domain,

          check_sender_access hash:/etc/postfix/sender_access

          localhost# postfix reload

          postfix/postfix-script: refreshing the Postfix mail system

          再次發(fā)信,立即成功了!

          我們再來看看日志

          localhost# tail -1000 /var/log/maillog |grep test2 -A 5 -B 5

          Oct 24 03:00:02 localhost postfix/smtpd[33884]: connect from localhost[127.0.0.1]

          Oct 24 03:00:02 localhost postfix/smtpd[33884]: 676E323F008: client=localhost[127.0.0.1]

          Oct 24 03:00:02 localhost postfix/cleanup[34146]: 676E323F008: message-id=<20121101173439.676E323F008@mail.example.com>

          Oct 24 03:00:02 localhost postfix/qmgr[64388]: 676E323F008: from=, size=564, nrcpt=1 (queue active)

          Oct 24 03:00:02 localhost postfix/smtpd[33884]: disconnect from localhost[127.0.0.1]

          Oct 24 03:00:02 localhost postfix/virtual[34147]: 676E323F008: to=, relay=virtual, delay=0.14, delays=0.1/0/0/0.04, dsn=2.0.0, status=sent (delivered to maildir)

          Oct 24 03:00:02 localhost postfix/qmgr[64388]: 676E323F008: removed

          connect from localhost[127.0.0.1] 

          這一行日志告訴了我們是從本地localhost登錄,并且登錄成功了。繼而發(fā)信也成功了!

          總結(jié):extmail默認(rèn)是用127.0.0.1來連接本地的Postfix服務(wù)器來發(fā)信,而不是通過用戶認(rèn)證的方式來發(fā)信,而foxmail等則是通過客戶端認(rèn)證來連接到服務(wù)器。而此前我在配置文件中只允許了認(rèn)證用戶登錄,而沒有添加mynetworks的允許,所以導(dǎo)致了上述問題的出現(xiàn)。

          --------------------------------------------------------------------------------------------------2012.11.02

          問題17  foxmail發(fā)信提示rcpt錯誤

          說是用戶名未找到??晌襡xtmail中確定是有此用戶的

          解決:

          出現(xiàn)以上問題,其實是因為我們開啟了用戶發(fā)信驗證,而配置文件又缺少了 smtpd_sender_login_maps = 這行參數(shù)。

          具體情況,請參閱 http://coolerfeng.blog.51cto.com/133059/48317 這篇博客!

          再次修改配置文件,增加smtpd_sender_login_maps參數(shù)

          #alter smtp_sender_restrictions

          smtpd_sender_restrictions =

          reject_sender_login_mismatch,

          reject_non_fqdn_sender,

          reject_authenticated_sender_login_mismatch,

          reject_unauthenticated_sender_login_mismatch,

          #       reject_non_fqdn_hostname,

          reject_non_fqdn_recipient,

          reject_invalid_hostname,

          reject_unknown_sender_domain,

          check_sender_access hash:/etc/postfix/sender_access

          smtpd_sender_login_maps =        <-----新增加的

          mysql:/etc/postfix/mysql_virtual_sender_maps.cf,     <-----新增加的

          mysql:/etc/postfix/mysql_virtual_alias_maps.cf       <-----新增加的

          重新載入配置文件

          localhost# postfix reload

          postfix/postfix-script: refreshing the Postfix mail system

          再用foxmail發(fā)信,提示發(fā)信成功了!

          qq郵箱順利收到發(fā)出的郵件,成功!

          --------------------------------------------------------------------------

          2012.11.27

          問題18  出現(xiàn)maildrop訪問拒絕。

          [root@localhost extmail]# tail /var/log/maillog

          Nov 27 09:24:33 localhost postfix/pickup[725]: fatal: scan_dir_push: open directory maildrop: Permission denied

          Nov 27 09:24:34 localhost postfix/master[26729]: warning: process /usr/libexec/postfix/pickup pid 725 exit status 1

          [root@localhost extmail]# ll /var/spool/postfix/

          總計 56

          drwx------ 2 vuser root     4096 11-26 16:56 active

          drwx------ 2 vuser root     4096 11-26 16:56 bounce

          drwx------ 2 vuser root     4096 11-26 16:56 corrupt

          drwx------ 2 vuser root     4096 11-26 16:56 defer

          drwx------ 2 vuser root     4096 11-26 16:56 deferred

          drwx------ 2 vuser root     4096 11-26 16:56 flush

          drwx------ 2 vuser root     4096 11-26 16:56 hold

          drwx------ 2 vuser root     4096 11-26 16:56 incoming

          drwx-wx--- 2 vuser postdrop 4096 11-27 04:02 maildrop

          drwxr-xr-x 2 root  root     4096 11-26 17:51 pid

          drwx------ 2 vuser root     4096 11-26 17:28 private

          drwx--x--- 2 vuser postdrop 4096 11-26 17:28 public

          drwx------ 2 vuser root     4096 11-26 16:56 saved

          drwx------ 2 vuser root     4096 11-26 16:56 trace

          分析:postfix在執(zhí)行的時候,會讀取/var/spool/postfix/maildrop文件夾中的內(nèi)容,但是由于maildrop是屬于vuser和postdrop組的,而執(zhí)行postfix程序的用戶是postfix。maildrop的權(quán)限為731。postfix用戶就無法讀取了

          出現(xiàn)上述原因是因為我一開始在新建postfix用戶時指定id為1000,然后安裝postfix,但后來我把postfix用戶的id改了,然后新建了一個用戶vuser,把id指為1000。導(dǎo)致原本屬于postfix用戶的文件夾變成了vuser的了。

          解決:把用戶改回來即可

          [root@localhost extmail]# id vuser

          uid=1000(vuser) gid=1000(vuser) groups=1000(vuser)

          [root@localhost extmail]# id postfix

          uid=25(postfix) gid=25(postfix) groups=25(postfix),1200(postdrop)

          [root@localhost extmail]# chown -R postfix /var/spool/postfix/*

          [root@localhost extmail]# postfix  reload               

          postfix/postfix-script: refreshing the Postfix mail system

          沒有上述錯誤提示了。

          ---------------------------------------------------------------------------

          2012.11.27

          問題20  訪問extmail出現(xiàn)

          “Can't chdir to /opt/mailbox/test.com/test1/Maildir/, No such file or directory”報錯,用戶無法進入extmail郵箱。如圖:

          分析:

          1,查看日志

          [root@localhost extmail]# tail /var/log/maillog

          Nov 27 10:09:21 localhost extmail[2286]: user=, client=113.97.240.45, module=login, status=loginok

          日志中就只有這一條有用的信息。沒有任何錯誤提示。

          2,查看對應(yīng)的文件夾,可看到mailbox根文件夾內(nèi)為空,郵件目錄未自動創(chuàng)建。

          [root@localhost extmail]# ll /opt/mailbox/         

          總計 0

          3,更改權(quán)限為777,再重新在extman中建立新的域和用戶

          [root@localhost extmail]# chmod 777 -R /opt/mailbox/

          [root@localhost extmail]# ll /opt/mailbox/ -d

          drwxrwxrwx 2 vuser vuser 4096 11-27 10:03 /opt/mailbox/

          4,結(jié)果仍然是什么都沒有。

          5,重新檢查main.cf配置文件,找到原因,原來掉了一項virtual_transport選項。

          解決:

          將virtual_transport參數(shù)加上,該參數(shù)默認(rèn)值為virtual。

          [root@localhost extmail]# vim /etc/postfix/main.cf

          virtual_uid_maps = static:1000

          virtual_gid_maps = static:1000

          virtual_transport = virtual

          [root@localhost extmail]# postfix  reload

          在extman中將原來的未生效的域test.com刪除再重新建立。刪除域的時候要先將用戶刪除,再刪別名,最后刪域。否則刪除會失敗。

          總結(jié):必需在main.cf中指定virtual_transport,且值為virtual。不指定這個參數(shù)或指定值錯誤都會導(dǎo)致收發(fā)郵件出問題。在下面問題21中就是因為錯誤的參數(shù)值而造成收信。

          virtual_transport定義郵件投遞代理類型,默認(rèn)為virtual,這個virtual類型會將發(fā)來的郵件根據(jù)$virtual_mailbox_maps 中的定義來將郵件投遞到指定的域,沒有這個參數(shù),那么postfix收下的郵件就不知道放哪里,所以就不會自動創(chuàng)建域和用戶目錄了。。

          參考:http://www.postfix.org/postconf.5.html#virtual_transport

          http://www.postfix.org/virtual.8.html

          ---------------------------------------------------

          2012.11.28

          問題21  信件發(fā)出后無任何錯誤提示,但收件方卻收不到剛發(fā)的郵件。

          maillog日志:

          Nov 27 15:29:54 localhost postfix/qmgr[13975]: warning: connect to transport private/vuser: No such file or directory

          Nov 27 15:29:54 localhost postfix/qmgr[13975]: D48E35DD15A: from=, size=608, nrcpt=1 (queue active)

          Nov 27 15:29:54 localhost postfix/error[14398]: 334DC5DD178: to=, relay=none, delay=1104, delays=1104/0.01/0/0.01, dsn=4.3.0, status=deferred (mail transport unavailable)

          有用信息為:

          warning: connect to transport private/vuser: No such file or directory

          localhost postfix/error

          status=deferred (mail transport unavailable)

          找了好久的原因。最后發(fā)現(xiàn)原來是main.cf中的virtual_transport 配置錯誤。

          [root@localhost ~]# vim /etc/postfix/main.cf

          virtual_transport = vuser    <------原來的配置

          要將其改為virtual

          virtual_transport=virtual    <------現(xiàn)在的配置

          [root@localhost ~]# postfix  reload

          再次發(fā)信,再次查看日志情況。

          [root@localhost ~]# tail /var/log/maillog

          Nov 27 15:41:56 localhost postfix/qmgr[14519]: 9151D5DD17E: from=, size=605, nrcpt=1 (queue active)

          Nov 27 15:41:56 localhost postfix/smtpd[14532]: disconnect from localhost.localdomain[127.0.0.1]

          Nov 27 15:41:56 localhost postfix/virtual[14582]: 9151D5DD17E: to=, relay=virtual, delay=0.05, delays=0.05/0/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)

          問題解決!

          本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
          打開APP,閱讀全文并永久保存 查看更多類似文章
          猜你喜歡
          類似文章
          在FreeBSD上組建ISP級的郵件系統(tǒng)--extmail--postfix
          CentOS7下搭建postfix郵件服務(wù)器實現(xiàn)extmail的web訪問
          The Perfect Server - Fedora 12 x86_64 [ISPConfig 2] - Page 4 | HowtoForge - Linux Howtos and Tutorials
          利用ubuntu extmail 30分鐘配置好一個功能強大的郵件服務(wù)器 | 高進波Lin...
          Linux 郵件服務(wù)器 之跟我一步一步來實現(xiàn)一個郵件系統(tǒng)
          CentOS7搭建簡單的郵件服務(wù)器
          更多類似文章 >>
          生活服務(wù)
          分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
          綁定賬號成功
          后續(xù)可登錄賬號暢享VIP特權(quán)!
          如果VIP功能使用有故障,
          可點擊這里聯(lián)系客服!

          聯(lián)系客服