Skip to main content

Integration - amavis

amavis is a popular open-source content filter used to scan and process email messages, integrating antivirus and anti-spam tools with mail servers. It acts as a bridge between the mail server (such as Postfix, Exim, or Sendmail) and various antivirus and anti-spam engines. Below, we show how to integrate amavis with Contextal Platform.

Integration Steps

1. Prepare Python virtual environment and install the ctx tool:

# virtualenv /opt/python
# /opt/python/pip install contextal

2. Configure platform profile for amavis user:

# su amavis
$ /opt/python/bin/ctx config create --set-default amavis http://platform_local_address

3. Activate amavis antivirus scanning in the file /etc/amavis/conf.d/15-content_filter_mode (uncomment @bypass_virus_checks_maps variable)

4. Add ctx-scan to @av_scanners in /etc/amavis/conf.d/15-av_scanners:

['Contextal',
['/opt/python/bin/ctx-scan'],
'{}/../email.txt',
[0],
[1],
qr/Contextal-Action-.*$/m
],

5. Setup quarantine and spam rules (if needed).

6. Restart amavis.