惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
Microsoft Security Blog
Microsoft Security Blog
博客园 - 司徒正美
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
小众软件
小众软件
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
MyScale Blog
MyScale Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
A
About on SuperTechFans
宝玉的分享
宝玉的分享
WordPress大学
WordPress大学
B
Blog RSS Feed
G
Google Developers Blog
量子位
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)

博客园 - Eric Yih

Should be run run adprep when you want to install a higher version of windows controller in an existing forest lsattr command in AIX Consolidate Unix/Linux commands 资料收集 How to block SMB/LDAP/KDC/KPASSWD/NTP ports via firewall svchost.exe占用CPU 100%的解决方法 CVS使用手册 How to: Add a user from the OS X command line, works with Leopard In Mac OS X, how do I create and delete users? How to config the AFP Share Server on Mac OS X 10.4/10.5 Server - Eric Yih How to switch 32<->64bit kernel on AIX Dpkg 常用指令操作快速参考 How to create local user use command dscl in Mac 通过 SSH 密钥验证实现在不同系统之间的脚本自动化 How-to: Understanding Mac OS X Open Directory Hands on: Mac OS X Server Mail Service Boot Camp, Part 1: The Basics Hands on: Setting up Mac OS X Open Directory Hands on: Using Apple's Workgroup Manager Configuring Network Information Service server and client on AIX
Sendmail
Eric Yih · 2010-10-10 · via 博客园 - Eric Yih

Posted on 2010-10-10 22:22  Eric Yih  阅读(264)  评论()    收藏  举报

Sendmail Files (8.10.1)

/etc/mail/sendmail.cf

這是sendmail的設定檔,8.9.3這個檔的位置在/etc下,8.10.1則是位在/etc/mail下。一般而言,不同版本/UNIX平台的sendmail會有不同的sendmail.cf(Both For Path & Content),因此在更新sendmail版本時,必須一併更新sendmail.cf。(sendmail.cf內容更改後必須重新啟動sendmail,方始生效)

/etc/mail/local-host-names

8.10.1前,這個檔名預設值是/etc/mail/sendmail.cw,事實上你可以藉由定義sendmail.cf中的"Fw"的這個類型巨集,更改之。這個巨集定義方式Fw/etc/mail/local-host-names ,你可以在sendmail.cf 中找到他,並更改之。

/etc/mail/access.db

如果你採用access_db這個FEATURE (Use FEATURE(access_db,hash -o /etc/mail/access) dnl  in config.mc )來建立sendmail.cf(請參考sendmail安裝),這就是你的access database。/etc/mail/access則是這個Database的原始檔案,Database的建立指令為 makemap  hash /etc/mail/access < /etc/mail/access,/etc/mail/access的語法請參見AnitiSpam Control一文)

/etc/mail/aliases.db

這是你的Email aliases table  ,原始檔案為/etc/mail/aliases。 sendmail 8.9.3這個檔的位置在/etc下。 aliases table在sendmail.cf下為一個Option,定義方式為: O AliasFile=/etc/mail/aliases ,你可以自行定義之。
/etc/mail/aliases格式:    aliases      realname  。You May use "man aliases" to get more detail about aliases definition。
aliases檔案內容更改過後,必須執行 newaliases,方始生效。

/var/spool/mail

這是系統中所有帳號EMail Box所在目錄,每一位User在這個目錄下都會有一個檔案代表(儲存)他所有的Incoming Mail,檔名與該User Login Name相同。
如果你想對User mail設限,你必須將此一目錄獨立為單一File System(Partition),並對該File System 建立Quota限制。對外提供服務的EMail Server 建議應對User Mail Box容量設限。

/var/spool/mqueue

這是系統的Mail Queue,凡是傳送中,或是傳送失敗的郵件都會被存放在此一目錄,等待傳送。每一封信在這個目錄下都會有兩個檔,一個檔名是以"df"開頭,存放的是mail body,另一個檔名則是以"qf"開頭,存放mail header,這兩個檔檔名的其餘部份相同。
指令"mailq"可以讓你看見/var/spool/mqueue中等待傳送信件的情況。
mail queue位置在sendmail.cf下為一Option,定義方式為
O QueueDirectory=/var/spool/mqueue  ,你可以自行定義之。

Start & Stop Sendmail 

Start sendmail
1. # sendmail -q
    sendmail將會啟動,嘗試重送儲放在/var/spool/mqueue下待送
    的所有Message後,結束執行並離開
2.# sendmail -bd -qDdHhMmSs
    將sendmail啟動成為Daemon程式,並且每隔
DH小時MS
    重新傳送/var/spool/mqueue中所有郵件
3.#/etc/rc.d/init.d/sendmail  start (For RedHAT Linux Only)
    相當於 sendmail -bd -q1h

Stop Sendmail
1.Kill Sendmail with "kill -9 sendmail's PID"
    You Have to use "ps" to find sendmail's Process ID First.
    This Wroks for all kind of UNIX

2.#/etc/rc.d/init.d/sendmail  stop
    Works only for RedHAT Linux

Sendmail & MX Record in DNS 

SMTP使用網域名稱傳送Email時,"MX" Record 的優先權高於"A" Record
假設你DNS Host_db這樣設定(nchu.edu.tw assumed):

mailb IN A         140.120.2.123
dragon     IN A 140.120.2.19
mail        IN 140.120.2.40
mail        IN MX        10 dragon
IN MX    20 mailb

寄給woody@mail.nchu.edu.tw的信,將會首先被嘗試送給dragon.nchu.edu.tw(140.120.2.19),不成功的話,會再嘗試寄給mailb.nchu.edu.tw(140.120.2.123),但是肯定不會送給140.120.2.40(mail.nchu.edu.tw)這台主機。(以上的DNS設定的例子是錯誤的,You May Check it OUT !!!)

EMail Server一般建議要註冊一個MX Record。

Anti-Spam Mail in Sendmail 

什麼是Spam Mail
Spam Mail即是俗稱垃圾信,或是不請自來的網路電子郵件。Spam Mail的特徵一般是大量、具商業廣告性質,同時利用Email來者不拒的特性,強迫Email User接受他所要傳播的訊息。

Spam Mail對系統會有什麼危害

  1. User受無謂困擾

  2. 系統資源(包括網路頻寬)受不當佔用

  3. 浪費系統資源處理無用資訊

  4. 垃圾郵件氾濫更可能阻斷正常服務

Mail Relay & Spam Mail

  1. Spam Mail Always use Mail rerouting(relay) to avoid being traced back and prevent receiver's complain send to his own mail box.

  2. Try Not to play as a mail relay.

  3. Sendmail disable mail relay by default since 8.9.x

  4. Refer to Sendmail Anti-Spam Control for Spam-Mail Control  

 Sendmail Log

The History of sendmail is saved in /var/adm/messages (by the definition of /etc/syslog.conf)

You May view how your sendmail work by :
tail -f /var/adm/messages