SendMail-8.12.x

安裝 | 設定 | 調校 | 其他 | 測試版本:sendmail-8.12.4


我發現,只要系統做CVSup,sendmail也會跟著更新。所以底下的步驟參考就好。(2002.12.09)

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

建立 devtools/Site/site.config.m4 (這個主要是啟動tcp_wrappers的功能)

APPENDDEF(`conf_sendmail_ENVDEF', `-DTCPWRAPPERS')
APPENDDEF(`conf_sendmail_LIBS', `-lwrap')

建立 sendmail.cf

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

啟動 sendmail:

/usr/sbin/sendmail -bd -q30m

測試 port 25:

telnet mail.dnes.mlc.edu.tw 25 Trying 163.19.224.120... Connected to dns.dnes.mlc.edu.tw. Escape character is '^]'. 220 dnes.mlc.edu.tw ESMTP Sendmail 8.12.3/8.12.3; Mon, 22 Apr 2002 10:04:57 +08)

預設的 generic-bsd4.4.mc

divert(-1) divert(0)dnl VERSIONID(`$Id: generic-bsd4.4.mc,v 8.10 1999/02/07 07:26:02 gshapiro Exp $') OSTYPE(bsd4.4)dnl DOMAIN(generic)dnl MAILER(local)dnl MAILER(smtp)dnl

我自行修改過的sendmail.mc (添加procmail及其他的功能):

紅色的部分可別照抄,那是敝校的網域名稱(Domain Name)。 divert(-1) divert(0)dnl VERSIONID(`$Id: generic-bsd4.4.mc,v 8.10 1999/02/07 07:26:02 gshapiro Exp $') OSTYPE(bsd4.4)dnl DOMAIN(generic)dnl define(`confDOMAIN_NAME', `$w.$m')dnl FEATURE(local_procmail)dnl FEATURE(always_add_domain)dnl FEATURE(access_db)dnl FEATURE(`compat_check')dnl FEATURE(`relay_hosts_only')dnl FEATURE(`relay_entire_domain')dnl FEATURE(delay_checks)dnl FEATURE(blacklist_recipients)dnl FEATURE(masquerade_entire_domain)dnl FEATURE(masquerade_envelope)dnl MASQUERADE_AS(dnes.mlc.edu.tw)dnl MAILER(local)dnl MAILER(smtp)dnl MAILER(procmail)dnl

Script:一氣呵成的安裝程序。

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


Tcp_Wrappers : /etc/hosts.allow 中與sendmail有關的內容:

sendmail : localhost : allow
sendmail : .bsdlab.idv.tw : deny
sendmail : PARANOID : RFC931 : deny
sendmail : ALL : allow

從 mail.bsdlab.idv.tw 主機寄信給 mail.dnes.mlc.edu.tw 主機


從 .bsdlab.idv.tw 網域以 Outlook Express 透過 mail.dnes.mlc.edu.tw 為 SMPT-Server 寄信時,會被deny,產生如下的訊息:

無法傳送郵件,因為伺服器拒絕寄件者的電子郵件地址。寄件者的地址是 'tim@dnes.mlc.edu.tw'。 主旨 'test', 帳戶: '大南國民小學', 伺服器: 'mail.dnes.mlc.edu.tw', 通訊協定: SMTP, 伺服器回應: '550 5.0.0 Access denied', 連接埠: 25, 安全(SSL): 否, 伺服器錯誤: 550, 錯誤碼: 0x800CCC78


網路上的資源: