Mail System Hint Homework 3. Software SMTP mail/postfix POP/IMAP mail/dovecot MTA filter ...

14
Mail System Hint Homework 3

Transcript of Mail System Hint Homework 3. Software SMTP mail/postfix POP/IMAP mail/dovecot MTA filter ...

Page 1: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Mail System Hint

Homework 3

Page 2: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Software

SMTP mail/postfix

POP/IMAP mail/dovecot

MTA filter mail/bogofilter mail/p5-Mail-SpamAssassin security/amavisd-new

Interface between MTA and content filter

MDA filter mail/procmail

2

Anti-virus security/clamav

Grey listing mail/postgrey

Webmail www/horde-base mail/roundcube

Page 3: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Postfix - installation make config Options

Installation notices

3

Added group "postfix".Added group "maildrop".Added user "postfix".You need user "postfix" added to group "mail".Would you like me to add it [y]? y…..install -o root -g wheel -m 444 /usr/ports/mail/postfix/work/postfix-2.7.0/man/man1/qshape.1 /usr/local/man/man1Would you like to activate Postfix in /etc/mail/mailer.conf [n]?y

[X] PCRE Perl Compatible Regular Expressions[X] DOVECOT Dovecot SASL authentication method[X] TLS Enable SSL and TLS support

Page 4: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Postfix - configure Stop sendmail

Edit /etc/default/periodic.conf

Edit /etc/rc.conf

Edit /usr/local/etc/postfix/main.cf myhostname 、 mydomain…4

daily_clean_hoststat_enable="NO" daily_status_mail_rejects_enable="NO"daily_status_include_submit_mailq="NO"daily_submit_queuerun="NO"

sendmail_enable="NO"sendmail_submit_enable="NO"sendmail_outbound_enable="NO"sendmail_msp_queue_enable="NO"postfix_enable="YES"

/etc/rc.d/sendmail stop

Page 5: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Postfix - start

Start postfix

You should check if any error

5

tail -F /var/log/messagestail -F /var/log/maillog

/usr/local/etc/rc.d/postfix start

Appendix: TLS key generation

Page 6: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Dovecot

In this hw3 it can… Provide POP(s)/IMAP(s) services Support SMTP AUTH through Dovecot SASL

Configure by yourself /usr/local/etc/dovecot.conf /usr/local/etc/postfix/main.cf

Edit /etc/rc.conf

Start

6

/usr/local/etc/rc.d/dovecot start

dovecot_enable="YES"

Ref: /usr/local/share/doc/postfix/SASL_READMEAppendix: TLS key generation

Page 7: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Test for mail

Before the next steps, you should test for mail, how to ?

Ex: outlook

7

Page 8: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Test for mail - Outlook

Page 9: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Amavisd-new

Edit /etc/rc.conf

Configure by yourself /usr/local/etc/amavisd.conf /usr/local/etc/postfix/main.cf /usr/local/etc/postfix/master.cf

First time you need to sa-update Start

9

amavisd_enable="YES"

/usr/local/etc/rc.d/amavisd start

Page 10: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Auto authentication robot - flow

Mail to xxx.cs@yourdomaion

HTTP GET REQUEST`

TA

Your mail server

web site

Page 11: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Auto authentication robot - configure

Edit main.cf virtual_maps = …. transport_maps = ….

Edit master.cf autovaild unix - n n - - pipe flags=FR user=nobody

argv=/usr/local/etc/postfix/autovaild.pl $sender $recipient

autovaild.pl http://nasa.cs.nctu.edu.tw/nahw3/autovaild.pl

11

Page 12: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Auto authentication robot - result

What autovaild.pl need to do? TA will send mail contained the following

You should parse above and send GET request by autovaild.pl, store the content in /tmp/VirtualMail/

12

site: http://xxx.xxx.xxx/vaild.php?register=key=3345678

> cat /tmp/VirtualMail/vaild.php authentication successful!

Page 13: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Important!

You are not sure if components work normally, logs would provide sufficient information /var/log/maillog /var/log/messages /var/log/…

Page 14: Mail System Hint Homework 3. Software SMTP  mail/postfix POP/IMAP  mail/dovecot MTA filter  mail/bogofilter  mail/p5-Mail-SpamAssassin  security/amavisd-new.

Appendix - Key generation

ReferenceSA course: Public-key Infrastructure /usr/src/crypto/openssl/apps/CA.sh

http://www.octaldream.com/~scottm/talks/ssl/opensslca.html