This page is designed for the re-attachment of existing EBS volumes previously created by completing this whole guide. If you do not have these 3 EBS volumes with all data configured on them you are on the wrong page and should use the contents below!
Configure ClamAV
ClamAV will be our anti-virus system and is very easy to set-up! We just need to update some permissions:
sudo adduser clamav amavis
sudo adduser amavis clamav
Configure SpamAssassin
SpamAssassin’s function is given away by it’s name. We will use this for spam filtering our e-mails.
sudo nano /etc/default/spamassassin
[...]
ENABLED=1
[...]
CRON=1
[...]
We need to create a razor config file for it to work:
sudo razor-admin -create
Start the service:
sudo service spamassassin start
Configure Amavisd-New
Amavisd-New will be our interface between our mail transport program (Postfix) and our spam and virus filters (SpamAssassin / ClamAV).
sudo nano /etc/amavis/conf.d/15-content_filter_mode
Uncomment the spam and anti-virus lines.
use strict;
# You can modify this file to re-enable SPAM checking through spamassassin
# and to re-enable antivirus checking.
#
# Default antivirus checking mode
# Uncomment the two lines below to enable it
#
@bypass_virus_checks_maps = (
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
#
# Default SPAM checking mode
# Uncomment the two lines below to enable it
#
@bypass_spam_checks_maps = (
\%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);
1; # insure a defined return
Some fairly key definitions are missing because they are not “free” – thanks Ubuntu. Enable / uncomment them!
sudo nano /etc/amavis/conf.d/01-debian
[...]
$unfreeze = ['unfreeze', 'freeze -d', 'melt', 'fcat'];
[...]
$lha = 'lha';
[...]
Amavis needs permissions here:
sudo chmod -R 775 /var/lib/amavis/tmp
sudo service amavis restart
Configure Mail Logging
Because we mounted parts of our file system through EBS volumes we need to update the mail log locations.
sudo nano /etc/rsyslog.d/50-default.conf
[...]
mail.* -/var/log/postfix/mail.log
[...]
mail.info -/var/log/postfix/mail.info
mail.warn -/var/log/postfix/mail.warn
mail.err /var/log/postfix/mail.err
[..]
sudo service rsyslog restart
Restart Postfix / Dovecot
Make sure that Amavisd-New is plugged in correctly:
sudo service postfix restart
sudo service dovecot restart
Download this guide
To make this guide more useful I've added a feature to allow you to save it offline in a simple HTML format. If you have not customised this guide to your own values you may wish to do so here before you download it. There are a few options here:
Guide contents
- Hosting a website on Amazon EC2 - The goals and assumptions of this guide
- Preparing required tools - Create an AWS account, configure Elastic Fox and add an SSH tool
- Customise this guide - Allow all commands to be tailored to you (optional)
- Core software installation - Install some common software to the server image
- Depending upon your chosen configuration there is a choice here:
- Create and attach new EBS volumes - New server that you may want to split in future
- Attach existing EBS volumes - If you have used this guide before and have EBS volumes
- No attached EBS volumes - If you are not using the cloud or don't want to use them
- Depending upon your chosen configuration there is another choice here:
- Software Configuration - Set up the system to work as a multi-function server (from 5a or 5c)
- Software Configuration from existing EBS volumes - Use settings from EBS volumes (from 5b)
- Backing up and clean up - Configure Crons, log rotation etc