Securing Sendmail

来源:百度文库 编辑:神马文学网 时间:2024/05/07 07:09:54
Securing Sendmail
telnet smtp 寄信 telnet pop3 收信 隱藏 sendmail 版本資訊 使用 ordb.org 所提供的黑名單 更多的 sendmail.mc 設定參考 利用 nslookup 查詢 mail server 新增/移除 perl 模組 利用 AWStats 統計、分析 maillog
寄信給 mail server 裡的收件者
telnet your.mail.server 25
EHLO localhost
MAIL FROM:
RCPT TO:
DATA
From: tricker@fack.com
To: foo@a.b.c
Subject: xxx
.
QUIT
目的: 寄廣告信、探查是否可以 relay (rcpt to: 外部郵件)、以 rcpt to: 的回應探查 mail server 裡的帳號
罩門: 從信頭的 Received: from ... 就能得知發信者連入的 IP, 進而封鎖並反查來源
POP3 收信
telnet your.mail.server 110
USER someone
PASS someword
STAT (查看總封數與大小)
LIST (依序列出每封信的大小)
RETR n (顯示第 n 封信的內容)
TOP n (顯示第 n 封信的檔頭)
DELE n (將第 n 封信加上刪除標記)
RSET (取消所有刪除標記)
QUIT
隱藏 sendmail 版本資訊
cd /etc/mail
vi sendmail.mc (加入以下內容)
define(`confSMTP_LOGIN_MSG‘, `$j server ready at $b‘)
m4 sendmail.mc > sendmail.cf
vi sendmail.cf (刪除紅色字串)
HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
$.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.)
$.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
cp helpfile helpfile.backup
head -n 1 helpfile.backup > helpfile
/etc/init.d/sendmail restart
使用 ordb.org 所提供的黑名單
vi sendmail.mc
#在 MAILER 之前插入以下這行:
FEATURE(`dnsbl‘, `relays.ordb.org‘, `"Email blocked using ORDB.org - see "‘)
m4 sendmail.mc > sendmail.cf
更多的 sendmail.mc 設定參考
定義郵件大小最大為10MB
define(`confMAX_MESSAGE_SIZE‘, 10000000)
定義郵件最大收件者不可超過 25 位
define(`confMAX_RCPTS_PER_MESSAGE‘,25)
隱藏郵件主機訊息
define(`confPRIVACY_FLAGS‘, `goaway‘)
最大 Header 不可超過 16384 byte 避免駭客攻擊
define(`confMAX_HEADERS_LENGTH‘, 16384)
最大Client連線同時不可超過3個,避免 DDOS
define(`confCONNECTION_RATE_THROTTLE‘, 3)
偽裝成 Postfix ESMTP
define(`confSMTP_LOGIN_MSG‘, `Postfix current‘)
主機負載超過 8 時拒絕 smtp 連線
define(`confREFUSE_LA‘, 8)
主機負載超過 4 時不再 Queue 信
define(`confQUEUE_LA‘, 4)
完整的 M4 conf* 定義詳細說明 (複製網址後貼上)
sendmail.mc FEATURES
Linux 系管師進階班講義 by 李忠憲
查詢 mail server
nslookup
> set type=mx
> yahoo.com.tw
yahoo.com.tw    mail exchanger = 1 mx2.mail.tw.yahoo.com.
yahoo.com.tw    mail exchanger = 5 mta-v2.mail.vip.tpe.yahoo.com.
yahoo.com.tw    mail exchanger = 1 mx1.mail.tw.yahoo.com.
> exit
telnet mx2.mail.tw.yahoo.com 25
關於 Perl 的模組維護
使用 cpan 安裝 Perl 模組 查看模組安裝記錄: perldoc perllocal 移除已安裝的模組:PerlPkgMgr
利用 AWStats 統計、分析 maillog
cd /usr/local/awstats
/usr/local/awstats/tools/awstats_configure.pl (產生 /etc/awstats/awstats.mail.config.file)
vi /etc/awstats/awstats.mail.config.file
依這篇文章修改內容:AWStats Documentation - SETUP FOR MAIL LOG FILES
排程 /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=mail.config > /dev/null 2>&1
相關連結:
smptscanSnertSoftDefine an SPF Record本站 sendmail 相關文章
Posted by Jamyy at 2006年03月11日 10:57
from: http://cha.homeip.net/blog/archives/2006/03/mail_server.html#more