2008年6月16日 星期一

Sendmail Server 建立

Chkconfig sendmail on
Vi /etc/mail/sendmail.mc
找到127.0.0.1複製並修改為192.168.1.196
m4 sendmail.mc > sendmail.cf
vi /etc/hosts
192.168.1.196 station00.example.com www00.exapmle.com
vi /etc/mail/access
192.168.1.196 RELAY
vi /etc/mail/local-host-names
station00.example.com
vi /etc/mail/virtusertabl
sysadmin@station00.example.com g2
service sendmail restart
netstat –ntlupgrep sendmail
cd /var/spool/mail
rm –rf *
echo “12345”mail g1@station00.example.com –s test1
ls 應該要有g1的檔案,可用cat看檔暗內容
echo “12345”mail sysadmin@station00.example.com –s test2
ls 應該要有g2的檔案,可用cat看檔暗內容

要求 SMTP 使用身份認証
vi /etc/mail/sendmail.mc
找到CRAM-MD5並將以下兩行的dnl去除
m4 sendmail.mc > sendmail.cf
chkconfig saslauthd on
service saslauthd restart
service sendmail restart
telnet 127.0.0.1 25
ehlo station00.example.com
應該要能看到250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN

smtp over ssl
vi /etc/mail/sendmail.mc
找到CACERT 並將以下四行dnl去除
m4 sendmail.mc > sendmail.cf
cd /usr/share/ssl/certs
make sendmail.pem

不允許192.168.0.0/24網段進行存取
iptable –A INPUT –p tcp –dport 25 –s 192.168.0.0/255.255.255.0 –j REJECT
service iptables save

沒有留言: