mail電子電子郵件服務,在網絡中算是非常普遍了。mail的重要性不多說,下面介紹一下關于mail的基本知識。
關于mail的協定:
1. 傳輸協定
smtp協定,即Simple Mail Transfer Protocol簡單郵件傳輸協定,使用tcp25端口,弊端:使用明文傳輸,安全性不高。
2. 接收協定
pop協定,即Post Office Protocol郵局協定,2版本pop2使用tcp109端口,3版本pop3使用tcp110端口,可以實作脫機通路,使用明文傳輸。imap協定,Internet Mail Access Protocol互動式郵件存取協定,版本4,使用tcp143端口,是線上式的接受協定,同樣使用明文傳輸,不夠安全。
3. mime協定,Multipurpose Internet Mail Extensions多功能Internet郵件擴充協定,可以将二進制的檔案轉化為文本檔案,這也是現在我們的郵箱可以傳遞圖檔,視訊等媒體檔案的原因。
因為這些郵件傳輸和接收協定都是使用明文傳輸,為了達到更高的安全性,将smtp,
pop,imap協定與ssl結合,分别形成了更加安全的協定,smtps,pops,imaps協定。
關于mail的一些術語
1. MUA,mail user agent,郵件的使用者代理,相當于郵件接收發送的用戶端。
windows下主要有:outlook、express,foxmail等;
linux下主要有:mutt、thunderbird、evolution等。
2. MTA,mail transfer agent,網際網路郵件傳送代理。顧名思義,傳送伺服器。
window下主要有:exchange(2003、2007),mdaemon,lotus notes
linux下主要有:sendmail,postfix,qmail
3. MAA,接收伺服器,dovecot。
4. MDA,mail delivery agent,相當于郵件投遞員。
當今mail服務有許多功能,必須完成,保護郵件服務的安全有效運作,比如:
1. 垃圾郵件方面,需要安裝反垃圾郵件的應用,例如spamassian。
2. 病毒方面,查病毒使用clamav,但它隻有查病毒的功能,并無殺病毒的功能,而且需要自行下載下傳特征碼庫,殺毒也許就得使用另一款應用了。
mail服務是一個相當複雜的服務,我隻着将sendmail的配置使用進行展示。
sendmail算是mail界大爺級的存在了,無比的古老,甚至在電子郵件協定發明之前就出現了,那是後用的是另一套協定,具體我就不知道了。相比于postfix和qmail它有不少缺點。qmail是一個數學家搞的,算法無比精妙,四度快效率相當高,但是因為後期支援不夠,現在已經沒落了。postfix是後起之秀,與sendmail相比有以下優點:1.更快2.相容性好3.更強壯,個已在重負荷下繼續工作。4.更靈活5.安全性更高。雖然sendmail沒有後起之秀那麼多的優點,但是由于sendmail發展的早積累了相當大的客戶群體,現在學習sendmail還是相當有必要的。
需要安裝的軟體包
[root@localhost ~]# rpm -qa sendma*
sendmail-8.13.8-2.el5
sendmail-cf-8.13.8-2.el5
sendmail-devel-8.13.8-2.el5
sendmail-doc-8.13.8-2.el5
[root@localhost ~]# rpm -qa m4
m4-1.4.5-3.el5.1 //轉換工具
通過配置本地yum我們可以使用本地yum進行安裝
檢視sendmail的可配置文檔
[root@localhost ~]# rpm -qc sendmail
/etc/mail/Makefile
/etc/mail/access //中繼
/etc/mail/domaintable
/etc/mail/helpfile
/etc/mail/local-host-names
/etc/mail/mailertable
/etc/mail/sendmail.cf //主配置文檔
/etc/mail/sendmail.mc //我們當做主配置文檔直接編輯的檔案
/etc/mail/submit.cf
/etc/mail/submit.mc
/etc/mail/trusted-users
/etc/mail/virtusertable
/etc/pam.d/smtp.sendmail
/etc/rc.d/init.d/sendmail
/etc/sysconfig/sendmail
/usr/lib/sasl2/Sendmail.conf
/var/log/mail/statistics
sendmail的主配置文檔sendmail.cf文法古怪,配置難度相當大,我們一般配置sendmai.mc,然後同轉換工具m4将sendmail.mc轉換為新的sendmail.cf文檔。
執行個體:
北京上海兩地公司需要mail服務,通過sendmail實作mail服務。
mail服務同時需要dns服務的支援,是以先安裝配置dns。
[root@localhost ~]# rpm -qa bind
bind-9.3.3-7.el5
安裝配置bind
[root@localhost Server]# rpm -ivh bind-9.3.3-7.el5.i386.rpm
[root@localhost Server]# rpm -ivh bind-chroot-9.3.3-7.el5.i386.rpm
[root@localhost Server]# rpm -ivh caching-nameserver-9.3.3-7.el5.i386.rpm
[root@localhost ~]# cd /var/named/chroot/etc/
[root@localhost etc]# cp named.caching-nameserver.conf named.conf
[root@localhost etc]# vim named.conf
14 options {
15 listen-on port 53 { any; };
16 listen-on-v6 port 53 { ::1; };
17 directory "/var/named";
18 dump-file "/var/named/data/cache_dump.db";
19 statistics-file "/var/named/data/named_stats.txt";
20 memstatistics-file "/var/named/data/named_mem_stats.txt";
21 query-source port 53;
22 query-source-v6 port 53;
23 allow-query { any; };
24 allow-query-cache {any;};
25 forwarders { 192.168.10.2};
26 };
33 view localhost_resolver {
34 match-clients { any; };
35 match-destinations { any; };
36 recursion yes;
37 include "/etc/named.rfc1912.zones";
38 };