You are on page 1of 39

Mail Server

1
self = {

2
傑洛
Zero

3
4
eecesnmg
Mail Server

5
} # self

6
What is Mail Server?

7
郵 8
件 9
伺 10
服 11
器 12
The Most IMPORTANT
Server

13
Why?

14
Because they use it
everyday!

15
Concepts

16
Traditional Mail Delivery

17
Electronic equivalent

18
MUA Mail User Agent
MTA Mail Transfer Agent
MDA Mail Delivery Agent

19
M U A
ail ser gent

20
MT A ail ransfer gent

a.k.a 郵件伺服器

e.g. Sendmail, Postfix


21
M D A
ail elivery gent

幫忙把郵件放到個人的信箱去

22
e-Mail delivery

Servers (MTA, MDA)

Sender
(MUA)

Receiver
(MUA)
23
Let’s play.

24
228-205:~ Zero$ telnet localhost 25

25
228-205:~ Zero$ telnet localhost 25
Connected to localhost.
Escape character is '^]'.
220 228-205.dorm.ncu.edu.tw ESMTP Postfix

26
228-205:~ Zero$ telnet localhost 25
Connected to localhost.
Escape character is '^]'.
跟主機打招呼
220 228-205.dorm.ncu.edu.tw ESMTP Postfix
helo ce.ncu.edu.tw
250 228-205.dorm.ncu.edu.tw

27
228-205:~ Zero$ telnet localhost 25
Connected to localhost.
Escape character is '^]'.
220 228-205.dorm.ncu.edu.tw ESMTP Postfix
helo ce.ncu.edu.tw
250 228-205.dorm.ncu.edu.tw
mail from:Zero<zero@ce.ncu.edu.tw>
250 2.1.0 Ok
rcpt to:Target<target@my.target.edu.tw>
250 2.1.5 Ok
說明寄信者跟收信人

28
228-205:~ Zero$ telnet localhost 25
Connected to localhost.
Escape character is '^]'.
220 228-205.dorm.ncu.edu.tw ESMTP Postfix
helo ce.ncu.edu.tw
250 228-205.dorm.ncu.edu.tw
mail from:Zero<zero@ce.ncu.edu.tw>
250 2.1.0 Ok
rcpt to:Target<target@my.target.edu.tw>
250 2.1.5 Ok
data 再來就是要寫信 !
354 End data with <CR><LF>.<CR><LF>
This is a test mail.
.
250 2.0.0 Ok: queued as 2F516B326C
29
quit
221 2.0.0 Bye
Connection closed by foreign host.

30
概念 定了

31
那來教你怎麼裝
(本範例 供參考?)

32
33
Why ?

34
FreeBSD/i386 (MailSec.ce.ncu.edu.tw) (ttyv0)
login: Zero
password:

Welcome to FreeBSD!
[Zero@MailSec] /home/Zero$

35
[Zero@MailSec] /home/Zero$ sudo su
[root@MailSec] /home/Zero$ cd /usr/ports/mail/postfix
[root@MailSec] /usr/ports/mail/postfix $ make install
......
....

最後加入 些東西到/etc/rc.conf
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
postfix_enable="YES"

36
Service Control
• Start
sudo postfix start
• Stop
sudo postfix stop
• Restart
sudo postfix restart
• Log
tail -F /var/log/maillog

37
Then? Cross your finger.

38
After Postfix installed
• SASL Authentication
• Some configuration
• Anti-Spam
• Anti-Virus
• Webmail
• ....
39

You might also like