Skip to content

technicalguru/docker-mailserver-amavis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-mailserver-amavis

This is a Docker image for an Amavisd-new mail scanner. The project is part of the docker-mailserver project but can run separately without the other components. The image listens at one port (10024) for mails to be scanned (using SMTP protocol) and forwards messages and results after the scan back to a SMTP server (usually the originating server on port 10025).

Related images:

Tags

The following versions are available from DockerHub. The image tag matches the Amavisd-new version.

Features

License

docker-mailserver-amavis is licensed under GNU LGPL 3.0. As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

Prerequisites

None

Usage

Environment Variables

docker-mailserver-amavis requires various environment variables to be set. The container startup will fail when the setup is incomplete.

Variable Description Default Value
AV_MYDOMAIN The first and primary mail domain of your mailserver. Amavis uses this to add headers in a mail. localdomain
AV_POSTFIX_SERVICE_NAME The hostname or IP address of the SMTP server where Amavis will deliver scanned mails and results to. 127.0.0.1
AV_POSTFIX_SERVICE_PORT The port of the SMTP server for delivering scanned mails and results. 10025
AV_VIRUSADMIN_EMAIL The global administrator to be informed about virus detection and quarantines. postmaster@AV_MYDOMAIN
AV_NOTIFY_SENDER sender envelope address, from which notification reports are sent from postmaster@AV_MYDOMAIN
AV_NOTIFY_ADMIN sender envelope address, from which notification reports are sent from postmaster@AV_MYDOMAIN

Volumes

You shall provide a data volume in order to secure your quarantine data from data loss. Map the volume to /var/virusmails folder inside the container.

Ports

docker-mailserver-amavis exposes port 10024. This is an unprotected SMTP listener port to request AntiVirus and AntiSpam scans. Attention! You need to make sure that this port is not accessible by any other host than your SMTP mail service. Otherwise it can be used for SPAM attacks.

Running the Container

The main mailserver project has examples of container configurations:

Refreshing AV signatures and Spam detection rules

Every once in a while you will need to run sa-compile and freshclamin order to refresh you virus and spam detection rules. The current images does not do this yet (see #4)

Additional customization

You can further customize Amavis, ClamAV and SpamAssassin configuration files. Please follow these instructions:

  1. Check the /usr/local/amavis/templates folder for already existing customizations.
  2. If you configuration file is not present yet, take a copy of the file from /etc/amavis, /etc/clamav or /etc/spamassassin folders.
  3. Customize your configuration file.
  4. Provide your customized file(s) back into the appropriate template folder at /usr/local/amavis/templates by using volume mappings.
  5. (Re)Start the container. If you configuration was not copied correctly then log into the container (bash is available) and delete the changed files from the corresponding /etc folders. Then restart the container.

Issues

This Docker image is mature and provides scanning for my mailserver in production. However, several issues are still unresolved:

  • #2 - DKIM support is missing
  • #3 - SPF support is missing
  • #4 - Add automatic SA and ClamAV rules refresh

Contribution

Report a bug, request an enhancement or pull request at the GitHub Issue Tracker. Make sure you have checked out the Contribution Guideline