| |
Practical Exercises
Postfix installation, configuration and testing
Your desktop machine, say desktop18, is going to be an e-mail client;
your node host, say node18, should be configured as a Postfix e-mail server.
You need to change the host names in the configurations below
for those of your machines.
Download file hosts and copy it into /etc/hosts
on both your desktop and the node.
On the node, install Postfix
During the installation, a configurator started:
choose "No configuration"
Create a new file, /etc/postfix/main.cf, with the following content:
Generate aliases database by running command:
Restart the server:
Test the server by telneting to it from the desktop, say desktop18:
Check for e-mail in file /var/mail/root
on node18
Setup aliases to re-direct e-mail for root to youself on the server.
Modify /etc/aliases
Run command
Try to e-mail again something to root@node18
Install UW-IMAP server on node18:
Choose "Yes" for Allow insecure authentication using plaintext passwords.
Choose "Yes" for Continue installing libc-client without Maildir support
Select "imap2 and "imaps".
Check if there are entries in /etc/inetd.conf for IMAP and
IMAPS:
Generate new self-signed SSL certificates for imap:
Restart inetd and
verify that the IMAP and IMAPS ports are open (tcp/143 and tcp/993), run
On your desktop, configure an e-mail program. It can be either Mozilla or
alpine. You can install the alpine by running apt
In the configuration, specify the name of the
domain, outgoing SMTP server, and the Inbox IMAP server, for example
Install ntpdate on both the desktop and the node in order to
synchronize the clocks. Otherwise, e-mail time stamps would be inconsistent.
Run pine or Mozilla to send and receive emails at node18.linux.class.
Sending e-mail to remote hosts.
Modify mynetworks in /etc/postfix/main.cf and
also add disable_dns_lookups as follows:
Reload postfix:
Send e-mail to the other people in the class (their e-mail servers). You can use either their
user name or aliased root on nodes as the recepient e-mail address,
such as root@node01.linux.class, root@node02.linux.class, etc.
Check if they can receive your e-mails.
Try to email yourself at any remote host outside of
our private subnet.
The email should bounce back to you with an error like below
5.1.8 ... Domain of sender address
jonny@node18.linux.class does not exist (in reply to MAIL FROM command)
Modify /etc/postfix/main.cf by adding line
Create a new file, /etc/postfix/canonical with the following
content:
Rebuild canonical maps and reload the server:
If you send email again, it should be delivered fine and appear as
coming from User_Name@capone.rutgers.edu. Don't try to respond to it
as it won't be delivered to the private network.
Comment out the line in
/etc/postfix/main.cf
otherwise, email for local destinations will end up at capone.
Reload postfix server again.
Header Filtering.
Modify /etc/postfix/main.cf file by including an extra line with
Reload the postfix as you always do after modifying /etc/postfix/main.cf:
Create a new file, /etc/postfix/bad_headers with the following
content:
Try to send emails to yourself at the node with the following subjects:
'Viagra', 'Mortgage Low Rates', 'Cialis' and notice how emails bounce off.
Body content filtering
Modify /etc/postfix/main.cf file by including an extra line with
Reload the postfix as you always do after modifying
/etc/postfix/main.cf:
Create a new file, /etc/postfix/bad_content with the following
content:
Try to send emails to yourself containing 'Nude Celebrities' and
'FREE MEMBERSHIP' in the text and watch for error messages.
Reject email from hosts with unresolvable names.
Modify /etc/postfix/main.cf file by including extra two lines with
Reload the postfix. Email to youself at the node machine. You should get
a bounce off error similar to the following:
Since we don't have a local DNS, your desktop machine is unresolvable.
Comment out these lines in /etc/postfix/main.cf, otherwise, you
won't be able to send emails from your desktop.
Setting SMTP AUTH
Install Simple Authentication and Security Layer (SASL) libraries:
Edit /etc/default/saslauthd and set
the following parameters:
Start SASL
Create file /etc/postfix/sasl/smtpd.conf with the following entry
Add user postfix into group sasl:
Set permission on the SASL working directory
Edit the postfix configuration file /etc/postfix/main.cf and enable
SASL authentication by adding the following entries:
Reload postfix
To test the server side, connect to the Postfix SMTP server port via telnet and you should be able to have a conversation as shown below. Information sent by the client (that is, you) is shown in bold font.
Instead of AHJvb3QAY2FpcDE=, specify the base64 encoded form of
\0username\0password (the \0 is a null byte). The example above is for a user named root with password testpass.
Setting up TLS
Generate certificates in directory /usr/lib/ssl/misc
The entries can be arbitrary, except the 'Common Name' where you should use
the name of the server, for example, node18.linux.class.
Then, create the server certificate request
Finally, sign the certificate request with the new CA.
Make the certificates available for the postfix
Add TLS in the postfix configuration by editing file /etc/postfix/main.cf:
Reload postfix
See if STARTTLS is available at handshake with the SMTP server:
Include the TLS on the client (desktop). Edit .pinerc in the home
directory on the desktop and modify the entry for the smpt-server:
Try sending e-mail from the client.
Setting up Maildir
By default, postfix delivers e-mail into Inbox.
We are going to replace the Inbox by Maildir on the server.
Edit file /etc/postfix/main.cf and add the Maildir configuration:
Reload postfix:
Install dovecot-imap server, which supports both Maildir and Inbox type of
mail storage.
Edit the configuration file, /etc/dovecot/dovecot.conf and
set mail location in Maildir:
Set path to the SSL certificates in the configuration file:
Restart dovecot IMAP server:
Run the e-mail program on the desktop and try to sending and
receiveing e-mail on the node.
Check out directory Maildir in the user home directory on the server.
|
|