sendmail搭建mail服務 (1)

 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

popimap協議與ssl結合,分別形成了更加安全的協議,smtpspopsimaps協議。

 

關於mail的一些術語

1.    MUAmail user agent,郵件的用戶代理,相當於郵件接收發送的客戶端。

windows下主要有:outlookexpressfoxmail等;

linux下主要有:muttthunderbirdevolution等。

2.    MTA,mail transfer agent,因特網郵件傳送代理。顧名思義,傳送服務器。

window下主要有:exchange20032007),mdaemonlotus notes

linux下主要有:sendmailpostfixqmail

3.    MAA,接收服務器,dovecot

4.    MDAmail delivery agent,相當於郵件投遞員。

 

 

當今mail服務有許多功能,必須完成,保護郵件服務的安全有效運行,比如:

1.    垃圾郵件方面,需要安裝反垃圾郵件的應用,例如spamassian

2.    病毒方面,查病毒使用clamav,但它只有查病毒的功能,並無殺病毒的功能,而且需要自行下載特徵碼庫,殺毒也許就得使用另一款應用了。

 

 

  mail服務是一個相當複雜的服務,我只着將sendmail的配置使用進行展示。

 

  sendmail算是mail界大爺級的存在了,無比的古老,甚至在電子郵件協議發明之前就出現了,那是後用的是另一套協議,具體我就不知道了。相比於postfixqmail它有不少缺點。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,然後同轉換工具m4sendmail.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 };

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章