看中小型企業如何配置Sendmail 實例介紹
其實中小企業配置Sendmail 無非就是那么幾步,其實很簡單,請看下文。
我們假定該企業采用專線接入Internet,有兩臺Linux服務器(Redhat 6.1 )
一臺作為防火墻直接接入Chinanet,是通向Internet的***出入口,同時也作為DNS/SMTP 服務器,且申請了域名domain.com,由該防火墻服務器(DNS服務器)對域domain.com進行解析。另一臺郵件服務器是在內部網段運行,完全與外部世界無關。作為內部局域網上用戶的收/發郵件服務器。地址:假定防火墻Linux服務器的***外部地址為a.b.c.d(eth0),內部網卡地址
192.168.11.5(eth1),機器名為firewall.domain.com, 內部的郵件服務器地址為192.168.11.1,機器名為mail.domain.com , 且注冊域時填寫的主機名為dns.domain.com(a.b.c.d) .思路:先配置DNS服務器,用來解析@domain.com的域名,并指明MX記錄到內部郵件主機mail.domain.com. 把這臺防火墻僅作為mail relay主機,任何從外部
世界發往@domain.com域的郵件均由它處理且relay到內部郵件主機,僅接受@domain.com后綴的郵件進入,這樣阻止了spammer發送垃圾郵件。在內部郵件服務器上,配置Sendmail的DS部分為firewall.domain.com,任何發往非內部員工的郵件直接送往firewall.domain.com,且設置domain.com為
本地域,任何發往@domain.com域的郵件被內部別名處理并送往內部各用戶的郵件緩沖池中。
旅行用戶的考慮:
若公司員工出差在外需從公司的服務器接收郵件,一種方法是直接撥當地ISP,然后設置接收郵件服務器為mail.domain.com,但要求mail.domain.com在外地被解析成防火墻的外部***地址,這樣再在防火墻上設置plug-gw代理,代理任何到防火墻外部地址的110端口的請求到內部192.168.11.1的110端口。另一種方法,也可以再建一服務器為Linux撥入服務器,直接撥到公司來接收郵件。
重點:Sendmail的各項配置及相關設置
一:防火墻上的Sendmail配置:
我們采用Redhat Linux 6.1 加 Sendmail 8.9.3作為操作環境:
安裝操作系統和防火墻的配置略,建議采用3c905b或者Intel pro100 的網卡,先配置DNS。
設置/etc/named.conf象這樣:
============
zone "."{
type hint;
file "named.ca";
};
zone "0.0.127.in-addr.arpa"{
notify no;
type master;
file "127.0.0";
};
zone "11.168.192.in-addr.arpa"{
notify no;
type master;
file "192.168.11";
};
zone "domain.com" {
notify no;
type master;
file "domain.com";
};
文件 192.168.11象下面這樣:
@ IN SOA dns.domain.com. root.mail.domain.com. (
1999092201 86400 3600 3600000 86400 )
NS dns.domain.com.
1 PTR mail.domain.com.
5 PTR firewall.domain.com.
文件 domain.com象下面這樣:
@ IN SOA dns.domain.com. root.mail.domain.com. (
1999120401 86400 3600 3600000 86400 )
NS dns.domain.com.
A a.b.c.d
MX 10 mail.domain.com.
firewall A a.b.c.d
mail A a.b.c.d
dns A a.b.c.d
加下面的行到/etc/hosts
192.168.11.1 mail.domain.com mail
192.168.11.5 firewall.domain.com firewall
#p#
二、下面配置Sendmail,首先要先創建一個用來生成/etc/sendmail.cf的sendmail.mc文件,
在Redhat 安裝的過程中有一個默認地redhat.mc在/usr/lib/sendmail-cf/cf目錄下。
我們修改為如下:
divert(-1)
dnl This is the macro config file used to generate the /etc/sendmail.cf
dnl file. If you modify thei file you will have to regenerate the
dnl /etc/sendmail.cf by running this macro config through the m4
dnl preprocessor:
dnl
dnl m4 /etc/sendmail.mc > /etc/sendmail.cf
dnl
dnl You will need to have the sendmail-cf package installed for this to
dnl work.
include(`../m4/cf.m4')
define(`confDEF_USER_ID',``8:12'')
OSTYPE(`linux')
undefine(`UUCP_RELAY')
undefine(`BITNET_RELAY')
define(`confAUTO_REBUILD')
define(`confTO_CONNECT', `1m')
define(`confTRY_NULL_MX_LIST',true)
define(`confDONT_PROBE_INTERFACES',true)
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')
define(`ALIAS_FILE',`/etc/mail/aliases')
FEATURE(`smrsh',`/usr/sbin/smrsh')
FEATURE(`mailertable',`hash -o /etc/mail/mailertable')
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable')
FEATURE(`domaintable',`hash -o /etc/mail/domaintable')
FEATURE(redirect)
FEATURE(always_add_domain)
FEATURE(use_cw_file)
FEATURE(local_procmail)
MAILER(procmail)
MAILER(smtp)
FEATURE(`access_db')
FEATURE(`blacklist_recipients')
dnl We strongly recommend to comment this one out if you want to protect
dnl yourself from spam. However, the laptop and users on computers that do
dnl not hav 24x7 DNS do need this.
dnl FEATURE(`accept_unresolvable_domains')
dnl FEATURE(`relay_based_on_MX')
然后用m4 redhat.mc > sendmail.cf生成sendmail.cf放到/etc目錄下。且做如下操作:
1. 更改/etc/sendmail.cf中Fw定義為Fw/etc/mail/sendmail.cw
并創建一個空文件sendmail.cw (#touch /etc/mail/sendmail.cw)
2. 更改/etc/mail/mailertable象下面這樣:
domain.com relay:[192.168.11.1]
并運行makemap hash /etc/mail/mailertable.db
怎么樣,看完這篇文章了解到沒,中小企業是如何配置sendmail的么。希望對你們有用!
【編輯推薦】