csie 1 filtering mail speaker: chung yu wu adviser: quincy wu date: 2005/12/07

22
CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

Upload: jane-dixon

Post on 11-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 1

Filtering mail

Speaker: Chung yu WuAdviser: Quincy WuDate: 2005/12/07

Page 2: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 2

Outilne

Mail protocol MUA 、 MTA 、 MDA Procmail Sendmail Predicament Regular Expression

Page 3: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 3

POP3

POP3(Post Office Protocol, version 3) • Is a client/server protocol in which e-mail

is received and held for you by your Internet server. Periodically, you check your mail-box on the server and download any mail .

• port: 110

Page 4: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 4

SMTP

SMTP (Simple Mail Transfer Protocol) • Is a protocol used in sending e-mail. • port:25

Page 5: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 5

IMAP

IMAP (Internet Message Access Protocol)• Is a standard protocol for accessing e-mail

from your local server. • Can view just the heading and the sender

of the letter and then decide whether to download the mail

Page 6: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 6

Send and received mail

Client AClient B

MTAMTA

MTA

relay mail

SMTP

send mail

relay mail

POP3

receive mail

IMAP read or manage mail

Page 7: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 7

MUA 、 MTA 、 MDA

MUA: Mail User AgentOutlook Express 、 Netscape Mail

MTA: Mail Transfer AgentSend mailReceived mail

MDA: Mail Delivery AgentMail filtering

Page 8: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 8

Send mail

Page 9: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 9

Received mail

Page 10: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 10

Relay

Mail server

sender

Spam Company

Open relay

Page 11: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 11

Procmail

MDA Filtering spam and virus Header: sender 、 receiver 、 address 、 title 。 Body: content Regular Expression

Page 12: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 12

Use Procmail

Forward

#vi $HOME/.forward

Insert “|exec /usr/local/bin/procmail” Procmailrc

#vi ~/.procmailrc

Page 13: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 13

.Procmailrc Rules

Notation Meaning

:0 Begin a recipe

: Use a lock file

* Begin a condition

^TO_ Look for a header that begins with To, Cc, Resent-To, or another destination specification

Page 14: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 14

.Procmailrc Rules(cont)

:0[flags] <one or more rules>

<which folder to store the matched mail> :0:

* ^Subject:*test/usr/mail/spam

:0:* ^Body:*test/usr/mail/spam

:0:* ^[email protected]

/usr/mail/s94321544

Page 15: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 15

Sendmail

MTA Relay-domains Access Aliases Local-host-names

Page 16: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 16

Relay-domains

Allow configure domains relay mail

#touch /etc/mail/relay-domains

#vi /etc/mail/relay-domains

163.22.16. / *allow 163.22.16.xxx */

www.john.ipv6.club.tw

Page 17: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 17

Access

Process configure source mail Rules:

Ok: Unconditional accept RELAY: Accept configure source mail REJECT: Refusal configure source mail

#vi /etc/mail/access163.22.16.40 OK163.22.16.33 RELAYJohn.ipv6.club.tw REJECT

Page 18: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 18

Aliases

Create a aliases to root

#vi /etc/mail/aliases

root: mutanwo

staff: Mary,Bill,Jordan

#newaliases

Page 19: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 19

Local-host-names

Received localhost send mail

#vi /etc/mail/local-host-names

ipv6.club.tw

john.ipv6.club.tw

[email protected]

ok

error

[email protected]

Page 20: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 20

Predicament

Freebsd 5.4

Perl5.8.6+sendmail+procmail+spamassassin

MTA: Sendmail

MDA: Procmail+Spamassassin

MUA: ELM

Q1:Procmail path:

ex:MAILDIR, PATH。

Q2: Procmail Log:

Q3:.forward file。 All mail send to /var/mail/mailnull not root

Page 21: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 21

Regular Expression

Search string

^ ^string ex: ’^test’ => testxxxx

$ string$ ex: ‘test&’ => xxxxtest

* string* ex: ‘b*’ => ,b,bb,bbb,bbbb…..△. any string ex: ‘a.c’ =>abc,acc,foc….

[ ] String set ex: ‘[br]ear’ =>bear,rear

Page 22: CSIE 1 Filtering mail Speaker: Chung yu Wu Adviser: Quincy Wu Date: 2005/12/07

CSIE 22

References

http://spamassassin.apache.org/ http://www.procmail.org/ http://www.sendmail.org/ http://www.regular-expressions.info/tutorial.html