Jump to content

Amavis: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Hojendiz (talk | contribs)
 
(29 intermediate revisions by 16 users not shown)
Line 1: Line 1:
{{Short description|Open-source email content filter}}
{{Third-party|date=January 2019}}
{{Manual |date=May 2024}}
{{Infobox software
{{Infobox software
| name = Amavis
| name = Amavis
Line 8: Line 11:
| collapsible =
| collapsible =
| author =
| author =
| developer = Mark Martinec
| developer = Patrick Ben Koetter
| released = {{Start date|1997}}
| released = {{Start date|1997}}
| latest release version = {{wikidata|property|edit|reference|P348}}
| latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}}
| discontinued =
| discontinued =
| latest release version = 2.11.0
| latest release date = {{Start date and age|2016|04|26}}
| programming language = [[Perl]]
| programming language = [[Perl]]
| operating system = [[Unix-like]]
| operating system = [[Unix-like]]
Line 18: Line 21:
| size =
| size =
| language =
| language =
| status = Active
| genre = Mail filtering
| genre = Mail filtering
| license = [[GNU General Public License#Version 2|GPLv2]], [[Simplified BSD License]]
| license = [[GNU General Public License#Version 2|GPLv2]], [[Simplified BSD License]]
| alexa =
| alexa =
| website = {{URL|https://www.amavis.org/}}
| website = {{Official URL}}
}}
}}


''Amavis'' is an [[Open Source|open source]] content filter for [[Email|electronic mail]], implementing mail message transfer, decoding, some processing and checking, and interfacing with external content filters to provide protection against [[E-mail spam|spam]] and [[Computer virus|viruses]] and other [[malware]]. It can be considered an interface between a mailer ([[Message transfer agent|MTA]], Mail Transfer Agent) and one or more [[Content filtering|content filters]].
'''Amavis''' is an [[open-source software|open-source]] content filter for [[Email|electronic mail]], implementing mail message transfer, decoding, some processing and checking, and interfacing with external content filters to provide protection against [[E-mail spam|spam]] and [[Computer virus|viruses]] and other [[malware]]. It can be considered an interface between a mailer ([[Message transfer agent|MTA]], Mail Transfer Agent) and one or more [[Content filtering|content filters]].<ref>{{Cite web |last=LeBlanc |first=Robert |date=2004-11-11 |title=Beating Spam and Viruses with amavisd-new and Maia Mailguard {{!}} Linux Journal |url=https://www.linuxjournal.com/article/7427 |url-status=live |archive-url=https://archive.today/20220410024443/https://www.linuxjournal.com/article/7427#selection-503.39-531.297 |archive-date=2022-04-10 |access-date=2022-04-10 |website=[[Linux Journal]]}}</ref>


''Amavis'' can be used to:
''Amavis'' can be used to:
* detect viruses, spam, banned content types or syntax errors in mail messages
* detect viruses, spam, banned content types or syntax errors in mail messages
* block, tag, redirect (using [[Email address#Address tags|sub-addressing]]), or forward mail depending on its content, origin or size
* block, tag, redirect (using [[Email address#Address tags|sub-addressing]]), or forward mail depending on its content, origin or size
* quarantine (and release), or archive mail messages to files, to mailboxes, or to an SQL database
* quarantine (and release), or archive mail messages to files, to mailboxes, or to a [[relational database]]
* sanitize passed messages using an external sanitizer
* sanitize passed messages using an external sanitizer
* generate [[DomainKeys Identified Mail|DKIM]] signatures
* generate [[DomainKeys Identified Mail|DKIM]] signatures
* verify DKIM signatures and provide DKIM-based whitelisting.
* verify DKIM signatures and provide DKIM-based [[whitelisting]]


Notable features:
Notable features:
* provides [[Simple Network Management Protocol|SNMP]] statistics and status monitoring using an extensive [[Management information base|MIB]] with more than 300 variables
* provides [[Simple Network Management Protocol|SNMP]] statistics and status monitoring using an extensive [[Management information base|MIB]] with more than 300 variables
* provides structured event log in [[JSON]] format
* provides structured [[event logging|event log]] in [[JSON]] format
* [[IPv6]] protocol is supported in interfacing, and [[IPv6 address|IPv6 address forms]] in mail header section
* [[IPv6]] protocol is supported in interfacing, and [[IPv6 address|IPv6 address forms]] in mail header section
* properly honors per-recipient settings even in multi-recipient messages, while scanning a message only once.
* properly honors per-recipient settings even in multi-recipient messages, while scanning a message only once.
* supports Internationalized Email (RFC 6530, [[Extended SMTP#SMTPUTF8|SMTPUTF8]], [[Email Address Internationalization|EAI]], [[Internationalized domain name|IDN]])
* supports [[international email]] (RFC 6530, [[Simple Mail Transfer Protocol#SMTPUTF8|SMTPUTF8]], [[Email Address Internationalization|EAI]], [[Internationalized domain name|IDN]])


A common mail filtering installation with ''Amavis'' consists of a [[Postfix (software)|Postfix]] as an MTA, [[SpamAssassin]] as a [[E-mail spam|spam]] classifier, and [[ClamAV]] as an anti-virus protection, all running under a [[Unix-like]] operating system. Many other virus scanners (about 30) and some other spam scanners ([[CRM114 (program)|CRM114]], [[DSPAM]], [[Bogofilter]]) are supported too, as well as some other MTAs.
A common mail filtering installation with ''Amavis'' consists of a [[Postfix (software)|Postfix]] as an MTA, [[SpamAssassin]] as a [[E-mail spam|spam]] classifier, and [[ClamAV]] as an anti-virus protection, all running under a [[Unix-like]] operating system. Many other virus scanners (about 30) and some other spam scanners ([[CRM114 (program)|CRM114]], [[DSPAM]], [[Bogofilter]]) are supported, too, as well as some other MTAs.


== Interfacing topology ==
== Interfacing topology ==
Line 58: Line 60:


== Interfacing protocols ==
== Interfacing protocols ==
''Amavis'' can receive mail messages from an MTA over one or more [[Berkeley sockets|sockets]] of [[Berkeley sockets#Protocol and address families|protocol families]] PF_INET ([[IPv4]]), PF_INET6 ([[IPv6]]) or PF_LOCAL ([[Unix domain socket]]), using protocols [[ESMTP]], [[LMTP]], or a simple private protocol AM.PDP can be used with a helper program like ''amavisd-milter''<ref name="amavisd-milter" /> to interface with [[milter]]s. On the output side protocols ESMTP or LMTP can be used to pass a message to a back-end MTA instance or to an [[Local delivery agent|LDA]], or a message can be passed to a spawned process over a [[Pipeline (Unix)|Unix pipe]]. When ESMTP or LMTP are used, a session can optionally be encrypted using a [[Transport Layer Security|TLS]] [[STARTTLS]] (RFC 3207) extension to the protocol. SMTP Command Pipelining (RFC 2920) is supported in client and server code.
''Amavis'' can receive mail messages from an MTA over one or more [[Berkeley sockets|sockets]] of [[Berkeley sockets#Protocol and address families|protocol families]] PF_INET ([[IPv4]]), PF_INET6 ([[IPv6]]) or PF_LOCAL ([[Unix domain socket]]), via protocols [[Simple Mail Transfer Protocol|SMTP]], [[LMTP]], or a simple private protocol AM.PDP can be used with a helper program like ''amavisd-milter''<ref name="amavisd-milter" /> to interface with [[milter]]s. On the output side protocols SMTP or LMTP can be used to pass a message to a back-end MTA instance or to an [[Local delivery agent|LDA]], or a message can be passed to a spawned process over a [[Pipeline (Unix)|Unix pipe]]. When SMTP or LMTP are used, a session can optionally be encrypted using a [[Transport Layer Security|TLS]] [[STARTTLS]] (RFC 3207) extension to the protocol. SMTP Command Pipelining (RFC 2920) is supported in client and server code.


== Interfacing with SpamAssassin ==
== Interfacing with SpamAssassin ==
When [[E-mail spam|spam]] scanning is enabled, a daemon process ''amavisd'' is conceptually very similar to a ''spamd'' process of a [[SpamAssassin]] project. In both cases forked child processes call SpamAssassin [[Perl]] modules directly, hence their performance is similar.
When [[E-mail spam|spam]] scanning is enabled, a daemon process ''amavisd'' is conceptually very similar to a ''spamd'' process of a [[SpamAssassin]] project. In both cases forked child processes call SpamAssassin [[Perl]] modules directly, hence their performance is similar.


The main difference is in protocols used: ''Amavis'' typically speaks a standard [[Extended SMTP|ESMTP]] protocol to an MTA, while in the spamc/spamd case an MTA typically spawns a ''spamc'' program passing a message to it over a Unix pipe, then the ''spamc'' process transfers the message to a ''spamd'' daemon using a private protocol, and ''spamd'' then calls SpamAssassin Perl modules.
The main difference is in protocols used: ''Amavis'' typically speaks a standard [[Simple Mail Transfer Protocol|SMTP]] protocol to an MTA, while in the spamc/spamd case an MTA typically spawns a ''spamc'' program passing a message to it over a Unix pipe, then the ''spamc'' process transfers the message to a ''spamd'' daemon using a private protocol, and ''spamd'' then calls SpamAssassin Perl modules.


== Design priorities ==
== Design priorities ==
Line 76: Line 78:
A great deal of attention is given to security aspects, required by handling potentially malicious, nonstandard or just garbled data in mail messages coming from untrusted sources.
A great deal of attention is given to security aspects, required by handling potentially malicious, nonstandard or just garbled data in mail messages coming from untrusted sources.


The process which is handling mail messages runs with reduced privileges under a dedicated user ID. Optionally it can run [[chroot]]-ed. Risks of [[buffer overflow]]s and memory allocation bugs is largely avoided by implementing all protocol handling and mail processing in [[Perl]], which handles dynamic memory management transparently. Care is taken that content of processed messages does not inadvertently propagate to the system. Perl provides an additional security safety net with its marking of [[Taint checking|taint]]ed data origination from
The process which is handling mail messages runs with reduced privileges under a dedicated user ID. Optionally it can run [[chroot]]-ed. Risks of [[buffer overflow]]s and memory allocation bugs is largely avoided by implementing all protocol handling and mail processing in [[Perl]], which handles dynamic memory management transparently. Care is taken that content of processed messages does not inadvertently propagate to the system. Perl provides an additional security safety net with its marking of [[Taint checking|taint]]ed data originating from the wild, and Amavis is careful to put this Perl feature to good use by avoiding automatic untainting of data (''use re "taint"'') and only untainting it explicitly at strategic points, late in a data flow.
the wild, and Amavis is careful to put this Perl feature to good use by avoiding automatic untainting of data (''use re "taint"'') and only untainting it explicitly at strategic points, late in the data flow.


''Amavis'' can use several external programs to enhance its functionality. These are de-[[File archiver|archivers]], de-[[Data compression|compressors]], [[Computer virus|virus]] scanners and [[E-mail spam|spam]] scanners. As these programs are often implemented in languages like [[C (programming language)|C]] or [[C++]], there is a potential risk that a mail message passed to one of these programs can cause its failure or even open a security hole. The risk is limited by running these programs as an unprivileged user ID, and possibly chroot-ed. Nevertheless, external programs like unmaintained de-archivers should be avoided. The use of these external programs is configurable, and they can be disabled selectively or as a group (like all decoders or all virus scanners).
''Amavis'' can use several external programs to enhance its functionality. These are de-[[File archiver|archivers]], de-[[Data compression|compressors]], [[Computer virus|virus]] scanners and [[E-mail spam|spam]] scanners. As these programs are often implemented in languages like [[C (programming language)|C]] or [[C++]], there is a potential risk that a mail message passed to one of these programs can cause its failure or even open a security hole. The risk is limited by running these programs as an unprivileged user ID, and possibly chroot-ed. Nevertheless, external programs like unmaintained de-archivers should be avoided. The use of these external programs is configurable, and they can be disabled selectively or as a group (like all decoders or all virus scanners).
Line 88: Line 89:
Components like external mail decoders, virus scanners and [[E-mail spam|spam]] scanners can each be selectively disabled if they are not needed. What remains is functionality implemented by Amavis itself, like transferring mail message from and to an MTA using an [[SMTP]] or [[LMTP]] protocol, checking mail header section validity, checking for banned mail content types, verifying and generating [[DomainKeys Identified Mail|DKIM]] signatures.
Components like external mail decoders, virus scanners and [[E-mail spam|spam]] scanners can each be selectively disabled if they are not needed. What remains is functionality implemented by Amavis itself, like transferring mail message from and to an MTA using an [[SMTP]] or [[LMTP]] protocol, checking mail header section validity, checking for banned mail content types, verifying and generating [[DomainKeys Identified Mail|DKIM]] signatures.


As a consequence, mail processing tasks like DKIM signing and verification (with other mail checking disabled) can be exceptionally fast and can rival implementations in compiled languages <ref name="opendkim-benchm-1" /> .<ref name="opendkim-benchm-2" /><ref name="opendkim-benchm-3" /> Even full checks using a fast virus scanner but with spam scanning disabled can be surprisingly fast.
As a consequence, mail processing tasks like DKIM signing and verification (with other mail checking disabled) can be exceptionally fast and can rival implementations in compiled languages.<ref name="opendkim-benchm-1" /><ref name="opendkim-benchm-2" /><ref name="opendkim-benchm-3" /> Even full checks using a fast virus scanner but with spam scanning disabled can be surprisingly fast.


=== Adherence to standards ===
=== Adherence to standards ===
Line 101: Line 102:
Next the tool was re-implemented as a [[Perl]] program, which later evolved into a [[Daemon (computing)|daemonized]] process. A dozen of developers took turns during the first five years of the project, developing several variants while keeping a common goal, the project name and some of the development infrastructure.
Next the tool was re-implemented as a [[Perl]] program, which later evolved into a [[Daemon (computing)|daemonized]] process. A dozen of developers took turns during the first five years of the project, developing several variants while keeping a common goal, the project name and some of the development infrastructure.


Since December 2008 the only active branch is officially ''amavisd-new'', which is being actively developed and maintained by Mark Martinec since March 2002. This was agreed between the developers at the time in a private correspondence: Christian Bricart, Lars Hecking, Hilko Bengen, Rainer Link and Mark Martinec. The project name ''Amavis'' is now largely interchangeable with the name of the ''amavisd-new'' branch.
Since December 2008 (until 2018-10-09) the only active branch was officially ''amavisd-new'', which was being developed and maintained by Mark Martinec since March 2002. This was agreed between the developers at the time in a private correspondence: Christian Bricart, Lars Hecking, Hilko Bengen, Rainer Link and Mark Martinec. The project name ''Amavis'' is largely interchangeable with the name of the ''amavisd-new'' branch.


Lots of functionality has been added through the years, like adding protection against [[E-mail spam|spam]] and other unwanted content, besides the original virus protection. The focus is kept on reliability, security, adherence to standards and performance.
Much functionality has been added through the years, like adding protection against [[E-mail spam|spam]] and other unwanted content, besides the original virus protection. The focus is kept on reliability, security, adherence to standards and performance.


A domain ''amavis.org'' in use by the project was registered in 1998 by Christian Bricart, one of the early developers, who is still maintaining the domain name registration. The domain is now entirely dedicated to the only active branch ''amavisd-new''. The project mailing list was moved from [[SourceForge]] to amavis.org in March 2011, and is hosted by Ralf Hildebrandt and Patrick Ben Koetter. The project web page and the main distribution site is located at the [[Jožef Stefan Institute]], Ljubljana, [[Slovenia]], where most of the development is taking place since 2002.
A domain ''amavis.org'' in use by the project was registered in 1998 by Christian Bricart, one of the early developers, who is still maintaining the domain name registration. The domain is now entirely dedicated to the only active branch. The project mailing list was moved from [[SourceForge]] to amavis.org in March 2011, and is hosted by Ralf Hildebrandt and Patrick Ben Koetter. The project web page and the main distribution site was located at the [[Jožef Stefan Institute]], Ljubljana, [[Slovenia]] (until the handover in 2018), where most of the development was taking place between years 2002 and 2018.


=== Change of Project Leaders Announcement ===
=== Change of Project Leaders Announcement ===
On october 9 of 2018 Mark Martinec announced <ref name="new-project-leaders"/> at the general support and discussion mailing list his retirement of the project and also that Patrick Ben Koetter will continue a new project leader
On October 9 of 2018 Mark Martinec announced <ref name="new-project-leaders"/> at the general support and discussion mailing list his retirement from the project and also that Patrick Ben Koetter will continue as new project leader.


{{quote|text=I know Ben personally, he is one of the two authors of The Book of Postfix, and uses Amavis in his professional life too, so I think the project will be in good hands.<ref name="new-project-leaders"/>|author=Mark Martinec}}
{{quote|text=I know Ben personally, he is one of the two authors of The Book of Postfix, and uses Amavis in his professional life too, so I think the project will be in good hands.<ref name="new-project-leaders"/>|author=Mark Martinec}}
Line 119: Line 120:


In March 2002 the ''amavisd-new'' branch was introduced by Mark Martinec, initially as a [[Patch (computing)|patch]] against ''amavisd-snapshot-20020300''. This later evolved into a self-contained project, which is now the only surviving and actively maintained branch. Nowadays a project name is preferably spelled ''Amavis'' (while the name of the program itself is ''amavisd''). The name ''Amavis'' is now mostly interchangeable with ''amavisd-new''.
In March 2002 the ''amavisd-new'' branch was introduced by Mark Martinec, initially as a [[Patch (computing)|patch]] against ''amavisd-snapshot-20020300''. This later evolved into a self-contained project, which is now the only surviving and actively maintained branch. Nowadays a project name is preferably spelled ''Amavis'' (while the name of the program itself is ''amavisd''). The name ''Amavis'' is now mostly interchangeable with ''amavisd-new''.

== History of the project ==

=== shell program ===
* 1997 (original code by Mogens Kjær - Carlsberg Laboratory,<ref name="Kjaer19Dec96"/> modified by Jürgen Quade) initial, not released officially<ref name="AMaViS-tech" /><ref name="Mausefalle" />
* 1998-01-17 AMaViS 0.1 (Christian Bricart) AMaViS, first official release
* 1998-01-28 AMaViS 0.1.1
* 1998-12-08 AMaViS 0.2.0-pre1
* 1999-02-25 AMaViS 0.2.0-pre2
* 1999-03-29 AMaViS 0.2.0-pre3
* 1999-03-31 AMaViS 0.2.0-pre4
* 1999-07-19 AMaViS 0.2.0-pre5
* 1999-07-20 AMaViS 0.2.0-pre6
* 2000-10-31 AMaViS 0.2.1<ref name="AMaViS-tech" /> (Christian Bricart, Rainer Link, Chris Mason)

=== Perl program ===

* 2000-01 Amavis-perl (Chris Mason)
* 2000-08 Amavis-perl-8
* 2000-12 Amavis-perl-10
* 2001-04 Amavis-perl-11 (split to amavisd)
* 2003-03-07<ref name="AMaViS-historical" /> Amavis-0.3.12 (Lars Hecking)

=== Perl daemon: amavisd ===

* 2001-01 daemonization (Geoff Winkless)
* 2001-04 amavisd-snapshot-20010407 (Lars Hecking)
* 2001-07 amavisd-snapshot-20010714
* 2002-03 amavisd-snapshot-20020300 (split to amavisd-new)
* 2003-03-03<ref name="AMaViS-historical" /> amavisd-0.1

=== Perl, modular re-design ===
(Hilko Bengen)
* 2002-03 amavis-ng-0.1
* 2003-03 amavis-ng-0.1.6.2

=== amavisd-new ===
(Mark Martinec)
* 2002-03-30 amavisd-new, pre-forked, Net::Server
* 2002-05-17
* 2002-06-30 packages, [[SQL]] lookups
* 2002-11-16 integrated - one file
* 2002-12-27
* 2003-03-14 [[LDAP]] lookups
* 2003-06-16
* 2003-08-25 p5
* 2003-11-10 p6 @*_maps
* 2004-01-05 p7
* 2004-03-09 p8
* 2004-04-02 p9
* 2004-06-29 p10
* 2004-07-01 2.0 policy banks, [[IPv6 address]] formats
* 2004-08-15 2.1.0 amavisd-nanny monitoring utility
* 2004-09-06 2.1.2
* 2004-11-02 2.2.0
* 2004-12-22 2.2.1
* 2005-04-24 2.3.0 @decoders, per-recipient banning rules
* 2005-05-09 2.3.1
* 2005-06-29 2.3.2
* 2005-08-22 2.3.3
* 2006-04-02 2.4.0 [[Non delivery report|DSN]] in SMTP, %*_by_ccat
* 2006-05-08 2.4.1
* 2006-06-27 2.4.2 pen pals, SQL logging and quarantine
* 2006-09-30 2.4.3
* 2006-11-20 2.4.4
* 2007-01-30 2.4.5
* 2007-04-23 2.5.0 blocking content categories, rewritten [[SMTP]] client
* 2007-05-31 2.5.1 amavisd-requeue
* 2007-06-27 2.5.2
* 2007-12-12 2.5.3
* 2008-03-12 2.5.4
* 2008-04-23 2.6.0 [[DKIM]], [[Non delivery report|bounce]] killer, [[Transport Layer Security|TLS]]
* 2008-06-29 2.6.1
* 2008-12-12 Amavis is amavisd-new
* 2008-12-15 2.6.2
* 2009-04-22 2.6.3 support for [[CRM114]] and [[DSPAM]], truncation
* 2009-06-25 2.6.4 monitoring over [[SNMP]]
* 2010-04-25 2.7.0-pre4
* 2011-02-03 2.7.0-pre14
* 2011-03-07 mailing list moved from SourceForge to amavis.org
* 2011-04-07 2.6.5
* 2011-05-19 2.6.6
* 2011-06-01 2.7.0 pre-queue improvements, speedup
* 2012-04-29 2.7.1
* 2012-06-30 2.7.2
* 2012-06-30 2.8.0 use [[ØMQ]] instead of [[Berkeley DB|BDB]], performance optimizations
* 2013-04-27 2.8.1-rc1
* 2013-06-28 2.8.1 can use [[Redis]] for pen pals storage
* 2013-09-04 2.8.2-rc1 (2.8.2 not released)
* 2014-05-09 2.9.0 structured log in [[JSON]] format, [[IP address]] auto-reputation
* 2014-06-27 2.9.1
* 2014-10-22 2.10.0 Internationalized Email (RFC 6530, [[Extended SMTP#SMTPUTF8|SMTPUTF8]], [[Email Address Internationalization|EAI]], [[Internationalized domain name|IDN]])
* 2014-10-22 2.10.1
* 2016-04-26 2.11.0
* 2018-10-09 2.11.1 Minor changes for source code migration to a GitLab repository


== See also ==
== See also ==
{{Portal|Free and open-source software}}

{{Portal|Free software}}

* [[List of antivirus software]]
* [[List of antivirus software]]
* [[SpamAssassin]], a popular open source spam classifier
* [[SpamAssassin]], a popular open source spam classifier


== References ==
== References ==

{{Reflist|
{{Reflist|
refs=
refs=
<ref name="§206 StGB (Germany)">{{Cite web|last= |first= |title=StGB (Germany), § 206 Verletzung des Post- oder Fernmeldegeheimnisses |work= |publisher=Bundesgesetzblattes |date= |url=http://www.gesetze-im-internet.de/stgb/__206.html |archiveurl=https://www.webcitation.org/6A5LIkaU4?url=http://www.gesetze-im-internet.de/stgb/__206.html |archivedate=2012-08-21 |deadurl=no |df= }}</ref>
<ref name="§206 StGB (Germany)">{{Cite web|title=StGB (Germany), § 206 Verletzung des Post- oder Fernmeldegeheimnisses |publisher=Bundesgesetzblattes |url=http://www.gesetze-im-internet.de/stgb/__206.html |archive-url=https://web.archive.org/web/20121019121357/http://www.gesetze-im-internet.de/stgb/__206.html |archive-date=2012-10-19 |url-status=live }}</ref>
<ref name="Mausefalle">{{cite journal|last=Quade |first=Jürgen |year=1998 |title=Mausefalle - EMail-Viren-Check unter Linux |journal=iX - Magazin für professionelle Computertechnik |volume= |issue=2/1998 |pages=136 |language=German |publisher=Heise online |doi= |url=http://www.heise.de/ix/artikel/1998/02/136/ |accessdate= |archiveurl=https://www.webcitation.org/69TanIhEz?url=http://www.heise.de/ix/artikel/Mausefalle-505480.html?view=print |archivedate=2012-07-27 |deadurl=no |df= }}</ref>
<!--<ref name="Mausefalle">{{cite journal|last=Quade |first=Jürgen |year=1998 |title=Mausefalle - EMail-Viren-Check unter Linux |journal=IX - Magazin für professionelle Computertechnik |issue=2/1998 |pages=136 |language=de |publisher=Heise online |url=http://www.heise.de/ix/artikel/1998/02/136/ |archive-url=https://www.webcitation.org/69TanIhEz?url=http://www.heise.de/ix/artikel/Mausefalle-505480.html?view=print |archive-date=2012-07-27 |url-status=live }}</ref>-->
<!-- <ref name="EMail-Viren-Check unter Linux (2)">{{cite journal |year=1999 |title=? |language=German |journal=iX - Magazin für professionelle Computertechnik |volume= |issue=2/1999 |pages=30 |publisher= |doi= |url= |accessdate= }}</ref> -->
<!-- <ref name="EMail-Viren-Check unter Linux (2)">{{cite journal |year=1999 |title=? |language=de |journal=iX - Magazin für professionelle Computertechnik |issue=2/1999 |pages=30 }}</ref> -->
<!-- <ref name="Magazin für Computertechnik">{{cite journal |year=1999 |language=German |title=? |journal=iX - Magazin für professionelle Computertechnik |volume= |issue=11/1999 |pages=132-133 |publisher= |doi= |url= |accessdate= }}</ref> -->
<!-- <ref name="Magazin für Computertechnik">{{cite journal |year=1999 |language=de |title=? |journal=iX - Magazin für professionelle Computertechnik |issue=11/1999 |pages=132-133 }}</ref> -->
<ref name="AMaViS-historical">{{Cite web|last= |first= |title=AMaViS - A Mail Virus Scanner |work= |publisher= |date=2004-10-07 |url=http://amavis.sourceforge.net/ |archiveurl=https://www.webcitation.org/69TVg2EET?url=http://amavis.sourceforge.net/ |archivedate=2012-07-27 |deadurl=no |df= }}</ref>
<ref name="amavisd-milter">{{Cite web|last=Rehor |first=Petr |title=amavisd-milter |date=2010-05-02 |url=http://amavisd-milter.sourceforge.net/ |archive-url=https://web.archive.org/web/20120630170421/http://amavisd-milter.sourceforge.net/ |archive-date=2012-06-30 |url-status=live }}</ref>
<ref name="AMaViS-tech">{{Cite web|last1=Bricart |first1=Christian |last2=Link |first2=Rainer |title=AMaViS - A Mail Virus Scanner - Technical Information and Installation Instructions |work= |publisher= |date=2000-10-31 |url=http://amavis.sourceforge.net/amavis.html |archiveurl=https://www.webcitation.org/69TXAHPvH?url=http://amavis.sourceforge.net/amavis.html |archivedate=2012-07-27 |deadurl=no |df= }}</ref>
<ref name="opendkim-benchm-1">{{Cite web|last=Martinec |first=Mark |title=amavisd 2.7.0 and Mail::OpenDKIM |date=2011-06-10 |url=http://marc.info/?l=amavis-user&m=130772228532647 |archive-url=https://archive.today/20130218040725/http://marc.info/?l=amavis-user&m=130772228532647 |archive-date=2013-02-18 |url-status=live }}</ref>
<ref name="amavisd-milter">{{Cite web|last=Rehor |first=Petr |title=amavisd-milter |work= |publisher= |date=2010-05-02 |url=http://amavisd-milter.sourceforge.net/ |archiveurl=https://www.webcitation.org/69TU1x6me?url=http://amavisd-milter.sourceforge.net/ |archivedate=2012-07-27 |deadurl=no |df= }}</ref>
<ref name="opendkim-benchm-2">{{Cite web|last=Martinec |first=Mark |title=amavisd 2.7.0 and Mail::OpenDKIM |date=2011-06-10 |url=http://marc.info/?l=amavis-user&m=130772403902102 |archive-url=https://archive.today/20130218022226/http://marc.info/?l=amavis-user&m=130772403902102 |archive-date=2013-02-18 |url-status=live }}</ref>
<ref name="opendkim-benchm-1">{{Cite web|last=Martinec |first=Mark |title=amavisd 2.7.0 and Mail::OpenDKIM |work= |publisher= |date=2011-06-10 |url=http://marc.info/?l=amavis-user&m=130772228532647 |archiveurl=https://www.webcitation.org/69Y5S6TVD?url=http://marc.info/?l=amavis-user&m=130772228532647 |archivedate=2012-07-30 |deadurl=no }}</ref>
<ref name="opendkim-benchm-3">{{Cite web|last=Martinec |first=Mark |title=amavisd 2.7.0 and Mail::OpenDKIM |date=2011-06-10 |url=http://marc.info/?l=amavis-user&m=130773268712771 |archive-url=https://archive.today/20130218015712/http://marc.info/?l=amavis-user&m=130773268712771 |archive-date=2013-02-18 |url-status=live }}</ref>
<ref name="opendkim-benchm-2">{{Cite web|last=Martinec |first=Mark |title=amavisd 2.7.0 and Mail::OpenDKIM |work= |publisher= |date=2011-06-10 |url=http://marc.info/?l=amavis-user&m=130772403902102 |archiveurl=https://www.webcitation.org/69Y5mnJ2u?url=http://marc.info/?l=amavis-user&m=130772403902102 |archivedate=2012-07-30 |deadurl=no }}</ref>
<ref name="before-queue">{{Cite web|last=Venema |first=Wietse |title=Postfix Before-Queue Content Filter |date=2009-12-11 |url=http://www.postfix.org/SMTPD_PROXY_README.html |archive-url=https://web.archive.org/web/20120616173630/http://www.postfix.org/SMTPD_PROXY_README.html |archive-date=2012-06-16 |url-status=live }}</ref>
<ref name="opendkim-benchm-3">{{Cite web|last=Martinec |first=Mark |title=amavisd 2.7.0 and Mail::OpenDKIM |work= |publisher= |date=2011-06-10 |url=http://marc.info/?l=amavis-user&m=130773268712771 |archiveurl=https://www.webcitation.org/69Y5xJJGp?url=http://marc.info/?l=amavis-user&m=130773268712771 |archivedate=2012-07-30 |deadurl=no }}</ref>
<ref name="after-queue">{{Cite web|last=Venema |first=Wietse |title=Postfix After-Queue Content Filter |date=2010-01-17 |url=http://www.postfix.org/FILTER_README.html |archive-url=https://web.archive.org/web/20120729120652/http://www.postfix.org/FILTER_README.html |archive-date=2012-07-29 |url-status=live }}</ref>
<ref name="before-queue">{{Cite web|last=Venema |first=Wietse |title=Postfix Before-Queue Content Filter |work= |publisher= |date=2009-12-11 |url=http://www.postfix.org/SMTPD_PROXY_README.html |archiveurl=https://www.webcitation.org/69asbEtYt?url=http://www.postfix.org/SMTPD_PROXY_README.html |archivedate=2012-08-01 |deadurl=no |df= }}</ref>
<ref name="postfix-2.7.0-rel">{{Cite web|last=Venema |first=Wietse |title=Postfix stable release 2.7.0 |date=2010-02-14 |url=http://www.postfix.org/announcements/postfix-2.7.0.html |archive-url=https://web.archive.org/web/20120719024446/http://www.postfix.org/announcements/postfix-2.7.0.html |archive-date=2012-07-19 |url-status=live }}</ref>
<!--
<ref name="after-queue">{{Cite web|last=Venema |first=Wietse |title=Postfix After-Queue Content Filter |work= |publisher= |date=2010-01-17 |url=http://www.postfix.org/FILTER_README.html |archiveurl=https://www.webcitation.org/69asCmAi1?url=http://www.postfix.org/FILTER_README.html |archivedate=2012-08-01 |deadurl=no |df= }}</ref>
<ref name="Kjaer19Dec96">{{cite newsgroup | first = Mogens | last = Kjaer | url = https://groups.google.com/forum/?fromgroups=#!topic/comp.mail.sendmail/0LArYGQQGE4 | newsgroup = comp.mail.sendmail | title = How safe is this: Automatic scanning of mails for virus (LONG)}}</ref>
<ref name="postfix-2.7.0-rel">{{Cite web|last=Venema |first=Wietse |title=Postfix stable release 2.7.0 |work= |publisher= |date=2010-02-14 |url=http://www.postfix.org/announcements/postfix-2.7.0.html |archiveurl=https://www.webcitation.org/69e6TasBS?url=http://www.postfix.org/announcements/postfix-2.7.0.html |archivedate=2012-08-03 |deadurl=no |df= }}</ref>
-->
<ref name="Kjaer19Dec96">{{cite newsgroup | first = Mogens | last = Kjaer | url = https://groups.google.com/forum/?fromgroups=#!topic/comp.mail.sendmail/0LArYGQQGE4 | newsgroup = comp.mail.sendmail | title = How safe is this: Automatic scanning of mails for virus (LONG)}}</ref><ref name="new-project-leaders">{{Cite web|last=Martinec |first=Mark |title=ANNOUNCE: Amavis project handed over to new project leaders |work= |publisher= |date=2018-10-09 |url= https://lists.amavis.org/pipermail/amavis-users/2018-October/005458.html | deadurl=no }}</ref><ref name="next-steps">{{Cite web|last=Koetter |first=Patrick Ben |title=amavis: Next Steps |work= |publisher= |date=2018-10-09 |url= https://lists.amavis.org/pipermail/amavis-users/2018-October/005458.html | deadurl=no }}</ref>
<ref name="new-project-leaders">{{Cite web|last=Martinec |first=Mark |title=ANNOUNCE: Amavis project handed over to new project leaders |website=The amavis-users-list Archives |publisher=The amavisd-new Project |date=2018-10-09 |url= https://lists.amavis.org/pipermail/amavis-users/2018-October/005458.html }}</ref><ref name="next-steps">{{Cite web|last=Koetter |first=Patrick Ben |title=amavis: Next Steps |website=The amavis-users-list Archives |publisher=The amavisd-new Project |date=2018-10-09 |url= https://lists.amavis.org/pipermail/amavis-users/2018-October/005458.html }}</ref>
}}
}}


== External links ==
== External links ==
<!-- Per [[WP:ELMINOFFICIAL]], choose one official website only -->
* {{official website}}
* {{official website|https://www.amavis.org/}}
* {{official website|https://www.ijs.si/software/amavisd/}}


{{Perl}}
{{Perl}}
Line 252: Line 154:
[[Category:Free software programmed in Perl]]
[[Category:Free software programmed in Perl]]
[[Category:Perl software]]
[[Category:Perl software]]
[[Category:Spam filtering]]
[[Category:Anti-spam]]

Latest revision as of 06:55, 18 May 2024

Developer(s)Patrick Ben Koetter
Initial release1997 (1997)
Stable release
2.13.1[1] Edit this on Wikidata / 7 March 2024; 5 months ago (7 March 2024)
Repository
Written inPerl
Operating systemUnix-like
TypMail filtering
LicenseGPLv2, Simplified BSD License
Websitewww.amavis.org Edit this at Wikidata

Amavis is an open-source content filter for electronic mail, implementing mail message transfer, decoding, some processing and checking, and interfacing with external content filters to provide protection against spam and viruses and other malware. It can be considered an interface between a mailer (MTA, Mail Transfer Agent) and one or more content filters.[2]

Amavis can be used to:

  • detect viruses, spam, banned content types or syntax errors in mail messages
  • block, tag, redirect (using sub-addressing), or forward mail depending on its content, origin or size
  • quarantine (and release), or archive mail messages to files, to mailboxes, or to a relational database
  • sanitize passed messages using an external sanitizer
  • generate DKIM signatures
  • verify DKIM signatures and provide DKIM-based whitelisting

Notable features:

  • provides SNMP statistics and status monitoring using an extensive MIB with more than 300 variables
  • provides structured event log in JSON format
  • IPv6 protocol is supported in interfacing, and IPv6 address forms in mail header section
  • properly honors per-recipient settings even in multi-recipient messages, while scanning a message only once.
  • supports international email (RFC 6530, SMTPUTF8, EAI, IDN)

A common mail filtering installation with Amavis consists of a Postfix as an MTA, SpamAssassin as a spam classifier, and ClamAV as an anti-virus protection, all running under a Unix-like operating system. Many other virus scanners (about 30) and some other spam scanners (CRM114, DSPAM, Bogofilter) are supported, too, as well as some other MTAs.

Interfacing topology

[edit]

Three topologies for interfacing with an MTA are supported. The amavisd process can be sandwiched between two instances of an MTA, yielding a classical after-queue[3] mail filtering setup, or amavisd can be used as an SMTP proxy filter in a before-queue[4] filtering setup, or the amavisd process can be consulted to provide mail classification but not to forward a mail message by itself, in which case the consulting client remains in charge of mail forwarding. This last approach is used in a Milter setup (with some limitations), or with a historical client program amavisd-submit.

Since version 2.7.0 a before-queue setup is preferred, as it allows for a mail message transfer to be rejected during an SMTP session[4] with a sending client. In an after-queue setup filtering takes place after a mail message has already been received and enqueued by an MTA, in which case a mail filter can no longer reject a message, but can only deliver it (possibly tagged), or discard it, or generate a non-delivery notification, which can cause unwanted backscatter in case of bouncing a message with a fake sender address.

A disadvantage of a before-queue setup[4] is that it requires resources (CPU, memory) proportional to a current (peak) mail transfer rate, unlike an after-queue setup, where some delay is acceptable and resource usage corresponds to average mail transfer rate. With introduction of an option smtpd_proxy_options=speed_adjust in Postfix 2.7.0 the resource requirements for a before-queue content filter have been much reduced.[5]

In some countries[6] the legislation does not permit mail filtering to discard a mail message once it has been accepted by an MTA, so this rules out an after-queue filtering setup with discarding or quarantining of messages, but leaves a possibility of delivering (possibly tagged) messages, or rejecting them in a before-queue setup (SMTP proxy or milter).

Interfacing protocols

[edit]

Amavis can receive mail messages from an MTA over one or more sockets of protocol families PF_INET (IPv4), PF_INET6 (IPv6) or PF_LOCAL (Unix domain socket), via protocols SMTP, LMTP, or a simple private protocol AM.PDP can be used with a helper program like amavisd-milter[7] to interface with milters. On the output side protocols SMTP or LMTP can be used to pass a message to a back-end MTA instance or to an LDA, or a message can be passed to a spawned process over a Unix pipe. When SMTP or LMTP are used, a session can optionally be encrypted using a TLS STARTTLS (RFC 3207) extension to the protocol. SMTP Command Pipelining (RFC 2920) is supported in client and server code.

Interfacing with SpamAssassin

[edit]

When spam scanning is enabled, a daemon process amavisd is conceptually very similar to a spamd process of a SpamAssassin project. In both cases forked child processes call SpamAssassin Perl modules directly, hence their performance is similar.

The main difference is in protocols used: Amavis typically speaks a standard SMTP protocol to an MTA, while in the spamc/spamd case an MTA typically spawns a spamc program passing a message to it over a Unix pipe, then the spamc process transfers the message to a spamd daemon using a private protocol, and spamd then calls SpamAssassin Perl modules.

Design priorities

[edit]

Design priorities of the amavisd-new (from here on just called Amavis) are: reliability, security, adherence to standards, performance, and functionality.

Reliability

[edit]

With the intention that no mail message could be lost due to unexpected events like I/O failures, resources depletion and unexpected program terminations, the amavisd program meticulously checks a completion status of every system call and I/O operation. Unexpected events are logged if at all possible, and handled with several layers of event handling. Amavis never takes a responsibility for a mail message delivery away from an MTA: the final success status is reported to an MTA only after the message has been passed on to the back-end MTA instance and reception was confirmed. In case of any fatal failures during processing or transferring of a message, the message being processed just stays in a queue of the front-end MTA instance, to be re-tried later. This approach also covers potential unexpected host failures, crashes of the amavisd process or one of its components.

The use of program resources like memory size, file descriptors, disk usage and creation of subprocesses is controlled. Large mail messages are not kept in memory, so the available memory size does not impose a limit on the size of mail messages that can be processed, and memory resources are not wasted unnecessarily.

Sicherheit

[edit]

A great deal of attention is given to security aspects, required by handling potentially malicious, nonstandard or just garbled data in mail messages coming from untrusted sources.

The process which is handling mail messages runs with reduced privileges under a dedicated user ID. Optionally it can run chroot-ed. Risks of buffer overflows and memory allocation bugs is largely avoided by implementing all protocol handling and mail processing in Perl, which handles dynamic memory management transparently. Care is taken that content of processed messages does not inadvertently propagate to the system. Perl provides an additional security safety net with its marking of tainted data originating from the wild, and Amavis is careful to put this Perl feature to good use by avoiding automatic untainting of data (use re "taint") and only untainting it explicitly at strategic points, late in a data flow.

Amavis can use several external programs to enhance its functionality. These are de-archivers, de-compressors, virus scanners and spam scanners. As these programs are often implemented in languages like C or C++, there is a potential risk that a mail message passed to one of these programs can cause its failure or even open a security hole. The risk is limited by running these programs as an unprivileged user ID, and possibly chroot-ed. Nevertheless, external programs like unmaintained de-archivers should be avoided. The use of these external programs is configurable, and they can be disabled selectively or as a group (like all decoders or all virus scanners).

Performance

[edit]

Despite being implemented in an interpreted programming language Perl, Amavis itself is not slow. The good performance of the functionality implemented by Amavis itself (not speaking of external components) is achieved by dealing with data in large chunks (e.g. not line-by-line), by avoiding unnecessary data copying, by optimizing frequently traversed code paths, by using suitable data structures and algorithms, as well as by some low-level optimizations. Bottlenecks are detected during development by profiling code and by benchmarking. Detailed timing report in the log can help recognize bottlenecks in a particular installation.

Certain external modules or programs like SpamAssassin or some command-line virus scanners can be very slow, and using these would constitute a vast majority of elapsed time and processing resources, making resources used by Amavis itself proportionally quite small.

Components like external mail decoders, virus scanners and spam scanners can each be selectively disabled if they are not needed. What remains is functionality implemented by Amavis itself, like transferring mail message from and to an MTA using an SMTP or LMTP protocol, checking mail header section validity, checking for banned mail content types, verifying and generating DKIM signatures.

As a consequence, mail processing tasks like DKIM signing and verification (with other mail checking disabled) can be exceptionally fast and can rival implementations in compiled languages.[8][9][10] Even full checks using a fast virus scanner but with spam scanning disabled can be surprisingly fast.

Adherence to standards

[edit]

Implementation of protocols and message structures closely follows a set of applicable standards such as RFC 5322, RFC 5321, RFC 2033, RFC 3207, RFC 2045, RFC 2046, RFC 2047, RFC 3461, RFC 3462, RFC 3463, RFC 3464, RFC 4155, RFC 5965, RFC 6376, RFC 5451, RFC 6008, and RFC 4291. In several cases some functionality was re-implemented in the Amavis code even though a public (CPAN) Perl module exists, but lacks attention to detail in following a standard or lacks sufficient checking and handling of errors.

License

[edit]

Amavis is licensed under a GPLv2 license. This applies to the current code, as well as to historical branches. An exception to this are some of the supporting programs (like monitoring and statistics reporting), which are covered by a New BSD License.

The project

[edit]

The project started in 1997 as a Unix shell script to detect and block e-mail messages containing a virus. It was intended to block viruses at the MTA (mail transfer agent) or LDA (local delivery) stage, running on a Unix-like platform, complementing other virus protection mechanisms running on end-user personal computers.

Next the tool was re-implemented as a Perl program, which later evolved into a daemonized process. A dozen of developers took turns during the first five years of the project, developing several variants while keeping a common goal, the project name and some of the development infrastructure.

Since December 2008 (until 2018-10-09) the only active branch was officially amavisd-new, which was being developed and maintained by Mark Martinec since March 2002. This was agreed between the developers at the time in a private correspondence: Christian Bricart, Lars Hecking, Hilko Bengen, Rainer Link and Mark Martinec. The project name Amavis is largely interchangeable with the name of the amavisd-new branch.

Much functionality has been added through the years, like adding protection against spam and other unwanted content, besides the original virus protection. The focus is kept on reliability, security, adherence to standards and performance.

A domain amavis.org in use by the project was registered in 1998 by Christian Bricart, one of the early developers, who is still maintaining the domain name registration. The domain is now entirely dedicated to the only active branch. The project mailing list was moved from SourceForge to amavis.org in March 2011, and is hosted by Ralf Hildebrandt and Patrick Ben Koetter. The project web page and the main distribution site was located at the Jožef Stefan Institute, Ljubljana, Slovenia (until the handover in 2018), where most of the development was taking place between years 2002 and 2018.

Change of Project Leaders Announcement

[edit]

On October 9 of 2018 Mark Martinec announced [11] at the general support and discussion mailing list his retirement from the project and also that Patrick Ben Koetter will continue as new project leader.

I know Ben personally, he is one of the two authors of The Book of Postfix, and uses Amavis in his professional life too, so I think the project will be in good hands.[11]

— Mark Martinec

After that Patrick notified[12] the migration of the source code to a public GitLab repository and his plan for the next steps regarding the project development.

Branches and the project name

[edit]

Through the history of the project the name of the project or its branches varied somewhat. Initially the spelling of the project name was AMaViS (A Mail Virus Scanner), introduced by Christian Bricart. With a rewrite to Perl the name of the program was Amavis-perl. Daemonized versions were initially distributed under a name amavisd-snapshot and then as amavisd. A modular rewrite by Hilko Bengen was called Amavis-ng.

In March 2002 the amavisd-new branch was introduced by Mark Martinec, initially as a patch against amavisd-snapshot-20020300. This later evolved into a self-contained project, which is now the only surviving and actively maintained branch. Nowadays a project name is preferably spelled Amavis (while the name of the program itself is amavisd). The name Amavis is now mostly interchangeable with amavisd-new.

See also

[edit]

References

[edit]
  1. ^ https://gitlab.com/amavis/amavis/-/tags/v2.13.1. Retrieved 25 August 2024. {{cite web}}: Missing or empty |title= (help)
  2. ^ LeBlanc, Robert (2004-11-11). "Beating Spam and Viruses with amavisd-new and Maia Mailguard | Linux Journal". Linux Journal. Archived from the original on 2022-04-10. Retrieved 2022-04-10.
  3. ^ Venema, Wietse (2010-01-17). "Postfix After-Queue Content Filter". Archived from the original on 2012-07-29.
  4. ^ a b c Venema, Wietse (2009-12-11). "Postfix Before-Queue Content Filter". Archived from the original on 2012-06-16.
  5. ^ Venema, Wietse (2010-02-14). "Postfix stable release 2.7.0". Archived from the original on 2012-07-19.
  6. ^ "StGB (Germany), § 206 Verletzung des Post- oder Fernmeldegeheimnisses". Bundesgesetzblattes. Archived from the original on 2012-10-19.
  7. ^ Rehor, Petr (2010-05-02). "amavisd-milter". Archived from the original on 2012-06-30.
  8. ^ Martinec, Mark (2011-06-10). "amavisd 2.7.0 and Mail::OpenDKIM". Archived from the original on 2013-02-18.
  9. ^ Martinec, Mark (2011-06-10). "amavisd 2.7.0 and Mail::OpenDKIM". Archived from the original on 2013-02-18.
  10. ^ Martinec, Mark (2011-06-10). "amavisd 2.7.0 and Mail::OpenDKIM". Archived from the original on 2013-02-18.
  11. ^ a b Martinec, Mark (2018-10-09). "ANNOUNCE: Amavis project handed over to new project leaders". The amavis-users-list Archives. The amavisd-new Project.
  12. ^ Koetter, Patrick Ben (2018-10-09). "amavis: Next Steps". The amavis-users-list Archives. The amavisd-new Project.
[edit]