- 论坛徽章:
- 1
|
RHEL AS3 sendmail smtp认证的问题
你給的是 sendmail 的 log , 和你現在的 SASL 問題是無關的
你要找的是所有 LOG 中有關 sasl 的,這個通常在 auth 或是 authpriv 下的東西
(看你的平台)
我去官網下了來裝 sendmail 8.13.5 + SASL2 , 不用30分鐘就全搞定了
我個人是都用 tarball 的方式裝...記得就是
下載最新的 sasl2 的 tar.gz 檔 ..
解開後看一下 configure --help
./configure --prefix=/usr --enable-login (login 是 oe 在用的)
make
make install
vi /usr/lib/sasl2/Sendmail.conf , 只要一行(這些東西官網都有說明)
- pwcheck_method: saslauthd
复制代码
再來以如下指令啟動即可
再來做 sendmail 8.13.5
到官網下載最新版的 sendmail
下載解壓後編好這個文件 devtools/Site/site.config.m4
這個文件詳情自己看 http://www.sendmail.org/compiling.html
我的內容如下
- define(`confDEPEND_TYPE', `CC-M')
- define(`confSM_OS_HEADER', `sm_os_linux')
- define(`confMANROOT', `/usr/man/man')
- define(`confLIBS', `-ldl')
- define(`confEBINDIR', `/usr/sbin')
- APPENDDEF(`confLIBSEARCH', `crypt nsl')
- define(`confLD', `ld')
- define(`confMTCCOPTS', `-D_REENTRANT')
- define(`confMTLDOPTS', `-lpthread')
- define(`confLDOPTS_SO', `-shared')
- APPENDDEF(`confMAPDEF',`-DMAP_REGEX')
- APPENDDEF(`confMAPDEF',`-DNEWDB')
- APPENDDEF(`confMAPDEF',`-DDNSMAP')
- APPENDDEF(`confMAPDEF',`-DSASL=2')
- APPENDDEF(`confMAPDEF',`-DSASL2')
- APPENDDEF(`confENVDEF',`-DTCPWRAPPERS')
- APPENDDEF(`confLIBDIRS',`-L/usr/lib/sasl2 -L/usr/lib -L/usr/local/lib')
- APPENDDEF(`confINCDIRS',`-I/usr/include -I/usr/local/include')
- APPENDDEF(`confLIBS', `-lwrap -lsasl2 -lpthread')
复制代码
這裏我想你可能會覺得複雜,但重點是你要看懂官網上的一些文件,不然學什麼
必然都很難學得好
再來只要 Build 好,並 Install 好後,再編 sendmail.mc 在 access 前加入
下面三行即可
- define(`confAUTH_OPTIONS', `A')dnl
- TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
- define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')
复制代码
再來這樣做後就大功告成了
- $>;m4 sendmail.mc >; sendmail.cf
- $>;service sendmail restart
复制代码
@@" , 什麼,我怎麼這麼順,而你沒有 !? 這要問你怎麼學習的了. 目前看來重點在
1. Sendmail.conf 中 pwcheck_method 就好了,因為其他的看來用不到,而 saslauthd 我是
用 -a pam 來啟動的,而不用 shadow, 因為 pam 的彈性大很多,但這個 pam 是我唯一出錯
的地方,後述
2. 下載的 sasl 的 tarball 解開後,在 saslauthd/ 下有一個 testsaslauthd , 用這個東西來
測試 sasl 的設定正確性與否很重要,格式如下
- $>;testsaslauthd -u username -p password
复制代码
不過要切記,這個東西在 default 的 make 中是不會產生的,要進到 saslauthd 的目錄中以
來產生,這點要記得, SASL 的 test 沒有錯,通常 SMTP AUTH 那一磈相信不會有什麼問題了
最後,就是要看看是什麼原因造成你的認證失敗了, 我自己看到的 log 有這些(是 Facility 為 AUTH 的 log)
- # Oct 7 14:59:49 log.twnic.net.tw sendmail [auth.err] sendmail[32226]: sql_select option missing
- 這是我的 PAM 沒有設好,因為我的 User 資料是存在 mysql 中的,但 pam_mysql 的 where 沒寫好所致
- #Oct 7 14:59:49 log.twnic.net.tw sendmail [auth.err] sendmail[32226]: auxpropfunc error no mechanism available
- mechanism 不對或不一玫,一開始我在 Sendmail.conf 中寫 pam 所致
- #Oct 7 14:59:49 log.twnic.net.tw sendmail [auth.debug] sendmail[32226]: _sasl_plugin_load failed on sasl_auxprop_plug_init for plugin: sql
- Plugin ?! 不知道,我沒有裝,也沒有研究,但看來不是問題的問題
- #Oct 7 14:59:58 log.twnic.net.tw sendmail [auth.notice] sendmail[32256]: cannot connect to saslauthd server: Connection refused
- #Oct 7 15:00:04 log.twnic.net.tw sendmail [auth.notice] sendmail[32271]: cannot connect to saslauthd server: Connection refused
- #Oct 7 15:00:29 log.twnic.net.tw sendmail [auth.notice] sendmail[810]: cannot connect to saslauthd server: Connection refused
- saslauthd 沒有啟動
- #Oct 7 15:01:46 log.twnic.net.tw saslauthd [auth.info] saslauthd[1642]: detach_tty : master pid is: 1642
- saslauthd 的 pid
- #Oct 7 15:01:46 log.twnic.net.tw saslauthd [auth.info] saslauthd[1642]: ipc_init : listening on socket: /var/state/saslauthd/mux
- saslauthd 用到的 socket file
- #Oct 7 15:01:54 log.twnic.net.tw saslauthd [auth.err] saslauthd[1642]: pam_sm_authenticate called.
- #Oct 7 15:01:54 log.twnic.net.tw sendmail [auth.notice] sendmail[1668]: size read failed
- saslauthd 在 SMTP AUTH 呼叫時,因為我設為 PAM 認證,但沒有設好,認證失敗,在 pam 的傳回值上有問題所致
- 以下重覆部份略,但可以看得出來調整了 pam 後的結果
- Oct 7 15:02:48 log.twnic.net.tw saslauthd [auth.err] saslauthd[1643]: pam_sm_authenticate called.
- Oct 7 15:02:48 log.twnic.net.tw sendmail [auth.notice] sendmail[2147]: size read failed
- Oct 7 15:06:12 log.twnic.net.tw saslauthd [auth.info] saslauthd[3313]: detach_tty : master pid is: 3313
- Oct 7 15:06:12 log.twnic.net.tw saslauthd [auth.info] saslauthd[3313]: ipc_init : listening on socket: /var/state/saslauthd/mux
- Oct 7 15:33:24 log.twnic.net.tw imap(pam_unix) [auth.alert] imap(pam_unix)[3315]: check pass; user unknown
- Oct 7 15:33:24 log.twnic.net.tw imap(pam_unix) [auth.notice] imap(pam_unix)[3315]: authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=
- Oct 7 15:33:24 log.twnic.net.tw saslauthd [auth.err] saslauthd[3315]: pam_sm_authenticate called.
复制代码
pam_sm_authenticate called.了後沒有 error 了,就成功了,這就是我攻略過程
===================
你那個 did not issue 訊息沒有什麼關係,那是因為 smtp auth 失敗後出現的,至於這個訊息會有許多因素造成,建議您要學習 sendmail , 至少把 sendmail 的 FAQ 看過 |
|