安裝 | 設定 | 調校 | 其他 | 測試版本:sendmail-8.12.4
SendMail 下載處:
ftp://ftp.sendmail.org/pub/sendmail/ ftp://ftp.nsysu.edu.tw/Unix/Mail/sendmail/ ftp://ftp.pu.edu.tw/Unix/Mail/sendmail/ ftp://ftp.nhctc.edu.tw/UNIX/mail/sendmail/ ftp://freebsd.csie.nctu.edu.tw/pub/distfiles/ ftp://ftp.lab.mlc.edu.tw/UNIX/sendmail/新增 gid ( Group ):
pw groupadd -n smmsp -g 25新增 uid ( User ) :
pw useradd -n smmsp -g smmsp -u 25 -m -d /var/spool/clientmqueue -s /sbin/nologin -c "Sendmail Submission User"停止目前的 sendmail 程式:
kill -KILL `cat /var/run/sendmail.pid` 或是 killall sendmail開始安裝
將原始壓縮檔解壓縮後,在 sendmail 資料夾中
| In the sendmail/ directory, run "sh Build" (see sendmail/README for details). |
| sh Build |
|
APPENDDEF(`conf_sendmail_ENVDEF', `-DTCPWRAPPERS') APPENDDEF(`conf_sendmail_LIBS', `-lwrap') |
| Change to the cf/cf/ directory (that's not a typo): Copy whichever .mc file best matches your environment to sendmail.mc, where config can be any name. Next, tailor it as explained in cf/README. Then run "sh Build sendmail.cf". |
|
cd cf/cf/ cp generic-bsd4.4.mc sendmail.mc sh Build sendmail.cf sh Build install-cf |
| Please read sendmail/SECURITY before continuing; you have to create a new user smmsp(smmsp by default, recommended uid: 25) and a new group smmsp(default group: smmsp, recommended gid: 25) for the default installation. Then install the sendmail binary built in step 3 by cd-ing back to sendmail/ and running "sh Build install". |
|
cd ../../ sh Build -c sh Build install ldd /usr/sbin/sendmail ( 如果回應 [not found] ,就是有錯誤 ) cd obj*/mail.local make force-install chown root /usr/libexec/mail.local chmod u+s /usr/libexec/mail.local chown root.wheel /etc/mail/sendmail.cf chown root.wheel /etc/mail/submit.cf chown smmsp.smmsp /var/spool/clientmqueue chmod g+w /var/spool/clientmqueue |
| /usr/sbin/sendmail -bd -q30m |
killall sendmail sh Build cd cf/cf/ sh Build sendmail.cf sh Build install-cf cd ../../ sh Build -c sh Build install ldd /usr/sbin/sendmail targetdir='obj.'`uname -s`'.'`uname -r`'.'`uname -p`'/mail.local' cd $targetdir make force-install chown root /usr/libexec/mail.local chmod u+s /usr/libexec/mail.local chown root.wheel /etc/mail/sendmail.cf chown root.wheel /etc/mail/submit.cf chown smmsp.smmsp /var/spool/clientmqueue chmod g+w /var/spool/clientmqueue cd /etc/mail makemap hash /etc/mail/access < /etc/mail/access newaliases sendmail -bd -q30m
sendmail : localhost : allow sendmail : .bsdlab.idv.tw : deny sendmail : PARANOID : RFC931 : deny sendmail : ALL : allow
The original message was received at Thu, 2 May 2002 12:12:45 +0800 (CST)
from smmsp@localhost [127.0.0.1]
----- The following addresses had permanent fatal errors -----
<tim@dnes.mlc.edu.tw>
(reason: 550 5.0.0 Access denied)
----- Transcript of session follows -----
... while talking to dns.dnes.mlc.edu.tw.:
>>> MAIL From:<tim@bsdlab.idv.tw>
<<< 550 5.0.0 Access denied
554 5.0.0 Service unavailable
May 2 12:12:45 dns sendmail[11679]: g424Cjda011679: tcpwrappers (www.bsdlab.idv.tw, 211.75.215.107) rejection
May 2 13:56:25 dns sendmail[12168]: g425uPLP012168: tcpwrappers (unknown, 210.80.65.2) rejection
這個動作也可以運用 Apache+SSI 做成網頁:http://www.dnes.mlc.edu.tw/sendmail_deny_log.shtml
sendmail : All : deny
先體驗一下是否真的會deny。
我測試的結果,寄信的主機端會有這樣的 log :
May 2 13:55:19 dns sendmail[21042]: g425tJq6021042: from=tim, size=44, class=0, nrcpts=1, msgid=<200205020555.g425tJq6021042@dns.lab.mlc.edu.tw>, relay=tim@localhost
May 2 13:55:19 dns sendmail[21043]: g425tJos021043: from=<tim@dns.lab.mlc.edu.tw>, size=346, class=0, nrcpts=1, msgid=<200205020555.g425tJq6021042@dns.lab.mlc.edu.tw>, proto=ESMTP, daemon=MTA, relay=tim@localhost [127.0.0.1]
May 2 13:55:19 dns sendmail[21042]: g425tJq6021042: to=tim@dnes.mlc.edu.tw, ctladdr=tim (1001/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30039, relay=localhost.lab.mlc.edu.tw. [127.0.0.1], dsn=2.0.0, stat=Sent (g425tJos021043 Message accepted for delivery)
May 2 13:55:19 dns sendmail[21047]: g425tJos021043: to=<tim@dnes.mlc.edu.tw>, ctladdr=<tim@dns.lab.mlc.edu.tw> (1001/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=30341, relay=dns.dnes.mlc.edu.tw. [163.19.224.120], dsn=5.0.0, stat=Service unavailable
May 2 13:55:19 dns sendmail[21047]: g425tJos021043: g425tJos021047: DSN: Service unavailable
May 2 13:55:20 dns sendmail[21047]: g425tJos021047: to=<tim@dns.lab.mlc.edu.tw>, delay=00:00:01, xdelay=00:00:00, mailer=local, pri=31370, dsn=2.0.0, stat=Sent
更可愛的是,被退信後的那台主機 mailq 是空的。sendmail在一般的狀況會很認真的每卅分鐘將 mailq 中未寄出的信件再 Try 一次寄出去。這樣子,網路頻寬無形中節省很多。