In this exercise you will setup an email server with a filter(spamassassin).
In this assignment, you need two hosts (lab1 and lab2). Configure the network between the hosts and add the IPv4 addresses and aliases on both computers to the /etc/hosts file. Stop any daemons that might be listening on the default smtp port.
man hosts (5), netstat (8)
On lab1, verify that the following packages are installed (dpkg -l):
postfix,procmail, spamassassin, and mailx.
On lab2, remove packages of postfix, sendmail and then install exim4.
Edit postfix main configuration file (main.cf, postconf (5)) on lab1. You have to change the following fields:
Disable ETRN and VRFY commands. Remember to reload postfix configuration (/etc/init.d/postfix).
Configure exim4 on lab2 to handle local emails and send all the rest to lab1. You might want to use standard debian package configuration tools.
Send a message from lab2 to labrat@lab1 using mail (1). Read the message on lab1 (with mail (1)). See also email message headers. See incoming message information from/var/log/mail.log using tail (1).
3.1 | Explain shortly the incoming mail log messages | 2 p |
3.2 | Explain shortly the email headers. At what point is each header added? | 2 p |
3.3 |
What is purpose of the main.cf setting "mydestination"? |
1 p |
3.4 | What is the idea behind the ETRN and VRFY verbs? | 2 p |
3.5 | Why it is really bad idea to set mynetworks broader than necessary (e.g. to 0.0.0.0/0)? |
1 p |
Edit (create if necessary) /etc/procmailrc (5) and add the following lines:
:0fw
| /usr/bin/spamassassin
In main.cf, you have to enable procmail with line
/usr/bin/procmail -a "$USER"
to appropriate field (hint: mailbox_command). Remember to reload postfix configuration. You may need to start the SpamAssassin daemon after flipping the enabling bit in the configuration file (hint: try starting the daemon).
Send an email message from lab2 to labrat@lab1. Read the message on lab1. See email headers. If you do not see spamassassin headers there is something wrong, go back to previous step and see /var/log/maillog.
4.1 |
How you can automatically filter spam messages to different folder using procmail? Demonstrate by sending a message that gets flagged as spam. |
2 p |
4.2 |
Explain briefly the additional email headers (compared to step 3.2) | 1 p |
Show only changed fields from main.cf.
5.1 |
What information is stored in MX records in the DNS system? | 1 p |
5.2 |
Explain briefly two ways to make redundant email servers using multiple servers and dns. (hint: see MX records for hut.fi, smtp.hut.fi and tml.hut.fi) | 3 p |