<s>
Amavis	B-Language
is	O
an	O
open-source	B-Application
content	B-Protocol
filter	I-Protocol
for	O
electronic	O
mail	O
,	O
implementing	O
mail	O
message	O
transfer	O
,	O
decoding	O
,	O
some	O
processing	O
and	O
checking	O
,	O
and	O
interfacing	O
with	O
external	O
content	B-Protocol
filters	I-Protocol
to	O
provide	O
protection	O
against	O
spam	O
and	O
viruses	O
and	O
other	O
malware	O
.	O
</s>
<s>
It	O
can	O
be	O
considered	O
an	O
interface	O
between	O
a	O
mailer	O
(	O
MTA	B-Protocol
,	O
Mail	B-Protocol
Transfer	I-Protocol
Agent	I-Protocol
)	O
and	O
one	O
or	O
more	O
content	B-Protocol
filters	I-Protocol
.	O
</s>
<s>
Amavis	B-Language
can	O
be	O
used	O
to	O
:	O
</s>
<s>
A	O
common	O
mail	O
filtering	O
installation	O
with	O
Amavis	B-Language
consists	O
of	O
a	O
Postfix	B-Application
as	O
an	O
MTA	B-Protocol
,	O
SpamAssassin	B-Language
as	O
a	O
spam	O
classifier	O
,	O
and	O
ClamAV	B-Application
as	O
an	O
anti-virus	O
protection	O
,	O
all	O
running	O
under	O
a	O
Unix-like	B-Operating_System
operating	I-Operating_System
system	I-Operating_System
.	O
</s>
<s>
Many	O
other	O
virus	O
scanners	O
(	O
about	O
30	O
)	O
and	O
some	O
other	O
spam	O
scanners	O
(	O
CRM114	O
,	O
DSPAM	O
,	O
Bogofilter	B-Protocol
)	O
are	O
supported	O
,	O
too	O
,	O
as	O
well	O
as	O
some	O
other	O
MTAs	O
.	O
</s>
<s>
Three	O
topologies	O
for	O
interfacing	O
with	O
an	O
MTA	B-Protocol
are	O
supported	O
.	O
</s>
<s>
program	O
amavisd-submit	O
.	O
</s>
<s>
Since	O
version	O
2.7.0	O
a	O
before-queue	O
setup	O
is	O
preferred	O
,	O
as	O
it	O
allows	O
for	O
a	O
mail	O
message	O
transfer	O
to	O
be	O
rejected	O
during	O
an	O
SMTP	B-Protocol
session	O
with	O
a	O
sending	O
client	O
.	O
</s>
<s>
In	O
an	O
after-queue	O
setup	O
filtering	O
takes	O
place	O
after	O
a	O
mail	O
message	O
has	O
already	O
been	O
received	O
and	O
enqueued	O
by	O
an	O
MTA	B-Protocol
,	O
in	O
which	O
case	O
a	O
mail	O
filter	O
can	O
no	O
longer	O
reject	O
a	O
message	O
,	O
but	O
can	O
only	O
deliver	O
it	O
(	O
possibly	O
tagged	O
)	O
,	O
or	O
discard	O
it	O
,	O
or	O
generate	O
a	O
non-delivery	O
notification	O
,	O
which	O
can	O
cause	O
unwanted	O
backscatter	O
in	O
case	O
of	O
bouncing	O
a	O
message	O
with	O
a	O
fake	O
sender	O
address	O
.	O
</s>
<s>
With	O
introduction	O
of	O
an	O
option	O
smtpd_proxy_options	O
=	O
speed_adjust	O
in	O
Postfix	B-Application
2.7.0	O
the	O
resource	O
requirements	O
for	O
a	O
before-queue	O
content	B-Protocol
filter	I-Protocol
have	O
been	O
much	O
reduced	O
.	O
</s>
<s>
In	O
some	O
countries	O
the	O
legislation	O
does	O
not	O
permit	O
mail	O
filtering	O
to	O
discard	O
a	O
mail	O
message	O
once	O
it	O
has	O
been	O
accepted	O
by	O
an	O
MTA	B-Protocol
,	O
so	O
this	O
rules	O
out	O
an	O
after-queue	O
filtering	O
setup	O
with	O
discarding	O
or	O
quarantining	O
of	O
messages	O
,	O
but	O
leaves	O
a	O
possibility	O
of	O
delivering	O
(	O
possibly	O
tagged	O
)	O
messages	O
,	O
or	O
rejecting	O
them	O
in	O
a	O
before-queue	O
setup	O
(	O
SMTP	B-Protocol
proxy	O
or	O
milter	B-Application
)	O
.	O
</s>
<s>
Amavis	B-Language
can	O
receive	O
mail	O
messages	O
from	O
an	O
MTA	B-Protocol
over	O
one	O
or	O
more	O
sockets	B-Protocol
of	O
protocol	O
families	O
PF_INET	O
(	O
IPv4	B-Protocol
)	O
,	O
PF_INET6	O
(	O
IPv6	B-Protocol
)	O
or	O
PF_LOCAL	O
(	O
Unix	B-Protocol
domain	I-Protocol
socket	I-Protocol
)	O
,	O
via	O
protocols	O
SMTP	B-Protocol
,	O
LMTP	B-Protocol
,	O
or	O
a	O
simple	O
private	O
protocol	O
AM.PDP	O
can	O
be	O
used	O
with	O
a	O
helper	O
program	O
like	O
amavisd-milter	O
to	O
interface	O
with	O
milters	B-Application
.	O
</s>
<s>
On	O
the	O
output	O
side	O
protocols	O
SMTP	B-Protocol
or	O
LMTP	B-Protocol
can	O
be	O
used	O
to	O
pass	O
a	O
message	O
to	O
a	O
back-end	O
MTA	B-Protocol
instance	O
or	O
to	O
an	O
LDA	B-Protocol
,	O
or	O
a	O
message	O
can	O
be	O
passed	O
to	O
a	O
spawned	O
process	O
over	O
a	O
Unix	B-Operating_System
pipe	I-Operating_System
.	O
</s>
<s>
When	O
SMTP	B-Protocol
or	O
LMTP	B-Protocol
are	O
used	O
,	O
a	O
session	O
can	O
optionally	O
be	O
encrypted	O
using	O
a	O
TLS	B-Protocol
STARTTLS	B-Protocol
(	O
RFC	O
3207	O
)	O
extension	O
to	O
the	O
protocol	O
.	O
</s>
<s>
SMTP	B-Protocol
Command	O
Pipelining	O
(	O
RFC	O
2920	O
)	O
is	O
supported	O
in	O
client	O
and	O
server	O
code	O
.	O
</s>
<s>
When	O
spam	O
scanning	O
is	O
enabled	O
,	O
a	O
daemon	B-Operating_System
process	I-Operating_System
amavisd	B-Language
is	O
conceptually	O
very	O
similar	O
to	O
a	O
spamd	O
process	O
of	O
a	O
SpamAssassin	B-Language
project	O
.	O
</s>
<s>
In	O
both	O
cases	O
forked	O
child	O
processes	O
call	O
SpamAssassin	B-Language
Perl	B-Language
modules	O
directly	O
,	O
hence	O
their	O
performance	O
is	O
similar	O
.	O
</s>
<s>
The	O
main	O
difference	O
is	O
in	O
protocols	O
used	O
:	O
Amavis	B-Language
typically	O
speaks	O
a	O
standard	O
SMTP	B-Protocol
protocol	I-Protocol
to	O
an	O
MTA	B-Protocol
,	O
while	O
in	O
the	O
spamc/spamd	O
case	O
an	O
MTA	B-Protocol
typically	O
spawns	O
a	O
spamc	O
program	O
passing	O
a	O
message	O
to	O
it	O
over	O
a	O
Unix	B-Operating_System
pipe	I-Operating_System
,	O
then	O
the	O
spamc	O
process	O
transfers	O
the	O
message	O
to	O
a	O
spamd	O
daemon	B-Operating_System
using	O
a	O
private	O
protocol	O
,	O
and	O
spamd	O
then	O
calls	O
SpamAssassin	B-Language
Perl	B-Language
modules	O
.	O
</s>
<s>
Design	O
priorities	O
of	O
the	O
amavisd-new	B-Language
(	O
from	O
here	O
on	O
just	O
called	O
Amavis	B-Language
)	O
are	O
:	O
reliability	O
,	O
security	O
,	O
adherence	O
to	O
standards	O
,	O
performance	O
,	O
and	O
functionality	O
.	O
</s>
<s>
With	O
the	O
intention	O
that	O
no	O
mail	O
message	O
could	O
be	O
lost	O
due	O
to	O
unexpected	O
events	O
like	O
I/O	O
failures	O
,	O
resources	O
depletion	O
and	O
unexpected	O
program	O
terminations	O
,	O
the	O
amavisd	B-Language
program	O
meticulously	O
checks	O
a	O
completion	O
status	O
of	O
every	O
system	O
call	O
and	O
I/O	O
operation	O
.	O
</s>
<s>
Amavis	B-Language
never	O
takes	O
a	O
responsibility	O
for	O
a	O
mail	O
message	O
delivery	O
away	O
from	O
an	O
MTA	B-Protocol
:	O
the	O
final	O
success	O
status	O
is	O
reported	O
to	O
an	O
MTA	B-Protocol
only	O
after	O
the	O
message	O
has	O
been	O
passed	O
on	O
to	O
the	O
back-end	O
MTA	B-Protocol
instance	O
and	O
reception	O
was	O
confirmed	O
.	O
</s>
<s>
In	O
case	O
of	O
any	O
fatal	O
failures	O
during	O
processing	O
or	O
transferring	O
of	O
a	O
message	O
,	O
the	O
message	O
being	O
processed	O
just	O
stays	O
in	O
a	O
queue	O
of	O
the	O
front-end	O
MTA	B-Protocol
instance	O
,	O
to	O
be	O
re-tried	O
later	O
.	O
</s>
<s>
This	O
approach	O
also	O
covers	O
potential	O
unexpected	O
host	O
failures	O
,	O
crashes	O
of	O
the	O
amavisd	B-Language
process	O
or	O
one	O
of	O
its	O
components	O
.	O
</s>
<s>
Optionally	O
it	O
can	O
run	O
chroot-ed	O
.	O
</s>
<s>
Risks	O
of	O
buffer	B-General_Concept
overflows	I-General_Concept
and	O
memory	O
allocation	O
bugs	O
is	O
largely	O
avoided	O
by	O
implementing	O
all	O
protocol	O
handling	O
and	O
mail	O
processing	O
in	O
Perl	B-Language
,	O
which	O
handles	O
dynamic	O
memory	O
management	O
transparently	O
.	O
</s>
<s>
Perl	B-Language
provides	O
an	O
additional	O
security	O
safety	O
net	O
with	O
its	O
marking	O
of	O
tainted	O
data	O
originating	O
from	O
the	O
wild	O
,	O
and	O
Amavis	B-Language
is	O
careful	O
to	O
put	O
this	O
Perl	B-Language
feature	O
to	O
good	O
use	O
by	O
avoiding	O
automatic	O
untainting	O
of	O
data	O
(	O
use	O
re	O
"	O
taint	O
"	O
)	O
and	O
only	O
untainting	O
it	O
explicitly	O
at	O
strategic	O
points	O
,	O
late	O
in	O
a	O
data	O
flow	O
.	O
</s>
<s>
Amavis	B-Language
can	O
use	O
several	O
external	O
programs	O
to	O
enhance	O
its	O
functionality	O
.	O
</s>
<s>
These	O
are	O
de-archivers	O
,	O
de-compressors	O
,	O
virus	O
scanners	O
and	O
spam	O
scanners	O
.	O
</s>
<s>
As	O
these	O
programs	O
are	O
often	O
implemented	O
in	O
languages	O
like	O
C	B-Language
or	O
C++	B-Language
,	O
there	O
is	O
a	O
potential	O
risk	O
that	O
a	O
mail	O
message	O
passed	O
to	O
one	O
of	O
these	O
programs	O
can	O
cause	O
its	O
failure	O
or	O
even	O
open	O
a	O
security	O
hole	O
.	O
</s>
<s>
The	O
risk	O
is	O
limited	O
by	O
running	O
these	O
programs	O
as	O
an	O
unprivileged	O
user	O
ID	O
,	O
and	O
possibly	O
chroot-ed	O
.	O
</s>
<s>
Nevertheless	O
,	O
external	O
programs	O
like	O
unmaintained	O
de-archivers	O
should	O
be	O
avoided	O
.	O
</s>
<s>
Despite	O
being	O
implemented	O
in	O
an	O
interpreted	O
programming	O
language	O
Perl	B-Language
,	O
Amavis	B-Language
itself	O
is	O
not	O
slow	O
.	O
</s>
<s>
The	O
good	O
performance	O
of	O
the	O
functionality	O
implemented	O
by	O
Amavis	B-Language
itself	O
(	O
not	O
speaking	O
of	O
external	O
components	O
)	O
is	O
achieved	O
by	O
dealing	O
with	O
data	O
in	O
large	O
chunks	O
(	O
e.g.	O
</s>
<s>
Certain	O
external	O
modules	O
or	O
programs	O
like	O
SpamAssassin	B-Language
or	O
some	O
command-line	O
virus	O
scanners	O
can	O
be	O
very	O
slow	O
,	O
and	O
using	O
these	O
would	O
constitute	O
a	O
vast	O
majority	O
of	O
elapsed	O
time	O
and	O
processing	O
resources	O
,	O
making	O
resources	O
used	O
by	O
Amavis	B-Language
itself	O
proportionally	O
quite	O
small	O
.	O
</s>
<s>
What	O
remains	O
is	O
functionality	O
implemented	O
by	O
Amavis	B-Language
itself	O
,	O
like	O
transferring	O
mail	O
message	O
from	O
and	O
to	O
an	O
MTA	B-Protocol
using	O
an	O
SMTP	B-Protocol
or	O
LMTP	B-Protocol
protocol	O
,	O
checking	O
mail	O
header	O
section	O
validity	O
,	O
checking	O
for	O
banned	O
mail	O
content	O
types	O
,	O
verifying	O
and	O
generating	O
DKIM	B-Protocol
signatures	O
.	O
</s>
<s>
As	O
a	O
consequence	O
,	O
mail	O
processing	O
tasks	O
like	O
DKIM	B-Protocol
signing	O
and	O
verification	O
(	O
with	O
other	O
mail	O
checking	O
disabled	O
)	O
can	O
be	O
exceptionally	O
fast	O
and	O
can	O
rival	O
implementations	O
in	O
compiled	O
languages	O
.	O
</s>
<s>
Implementation	O
of	O
protocols	O
and	O
message	O
structures	O
closely	O
follows	O
a	O
set	O
of	O
applicable	O
standards	O
such	O
as	O
RFC	O
5322	O
,	O
RFC	B-Protocol
5321	I-Protocol
,	O
RFC	O
2033	O
,	O
RFC	O
3207	O
,	O
RFC	O
2045	O
,	O
RFC	O
2046	O
,	O
RFC	O
2047	O
,	O
RFC	O
3461	O
,	O
RFC	O
3462	O
,	O
RFC	O
3463	O
,	O
RFC	O
3464	O
,	O
RFC	O
4155	O
,	O
RFC	O
5965	O
,	O
RFC	O
6376	O
,	O
RFC	O
5451	O
,	O
RFC	O
6008	O
,	O
and	O
RFC	O
4291	O
.	O
</s>
<s>
In	O
several	O
cases	O
some	O
functionality	O
was	O
re-implemented	O
in	O
the	O
Amavis	B-Language
code	O
even	O
though	O
a	O
public	O
(	O
CPAN	B-Language
)	O
Perl	B-Language
module	O
exists	O
,	O
but	O
lacks	O
attention	O
to	O
detail	O
in	O
following	O
a	O
standard	O
or	O
lacks	O
sufficient	O
checking	O
and	O
handling	O
of	O
errors	O
.	O
</s>
<s>
Amavis	B-Language
is	O
licensed	O
under	O
a	O
GPLv2	O
license	O
.	O
</s>
<s>
The	O
project	O
started	O
in	O
1997	O
as	O
a	O
Unix	O
shell	B-Operating_System
script	O
to	O
detect	O
and	O
block	O
e-mail	O
messages	O
containing	O
a	O
virus	O
.	O
</s>
<s>
It	O
was	O
intended	O
to	O
block	O
viruses	O
at	O
the	O
MTA	B-Protocol
(	O
mail	B-Protocol
transfer	I-Protocol
agent	I-Protocol
)	O
or	O
LDA	B-Protocol
(	O
local	O
delivery	O
)	O
stage	O
,	O
running	O
on	O
a	O
Unix-like	B-Operating_System
platform	O
,	O
complementing	O
other	O
virus	O
protection	O
mechanisms	O
running	O
on	O
end-user	O
personal	O
computers	O
.	O
</s>
<s>
Next	O
the	O
tool	O
was	O
re-implemented	O
as	O
a	O
Perl	B-Language
program	O
,	O
which	O
later	O
evolved	O
into	O
a	O
daemonized	B-Operating_System
process	O
.	O
</s>
<s>
Since	O
December	O
2008	O
(	O
until	O
2018-10-09	O
)	O
the	O
only	O
active	O
branch	O
was	O
officially	O
amavisd-new	B-Language
,	O
which	O
was	O
being	O
developed	O
and	O
maintained	O
by	O
Mark	O
Martinec	O
since	O
March	O
2002	O
.	O
</s>
<s>
The	O
project	O
name	O
Amavis	B-Language
is	O
largely	O
interchangeable	O
with	O
the	O
name	O
of	O
the	O
amavisd-new	B-Language
branch	O
.	O
</s>
<s>
A	O
domain	O
amavis.org	O
in	O
use	O
by	O
the	O
project	O
was	O
registered	O
in	O
1998	O
by	O
Christian	O
Bricart	O
,	O
one	O
of	O
the	O
early	O
developers	O
,	O
who	O
is	O
still	O
maintaining	O
the	O
domain	O
name	O
registration	O
.	O
</s>
<s>
The	O
project	O
mailing	O
list	O
was	O
moved	O
from	O
SourceForge	B-Application
to	O
amavis.org	O
in	O
March	O
2011	O
,	O
and	O
is	O
hosted	O
by	O
Ralf	O
Hildebrandt	O
and	O
Patrick	O
Ben	O
Koetter	O
.	O
</s>
<s>
Initially	O
the	O
spelling	O
of	O
the	O
project	O
name	O
was	O
AMaViS	B-Language
(	O
A	O
Mail	O
Virus	O
Scanner	O
)	O
,	O
introduced	O
by	O
Christian	O
Bricart	O
.	O
</s>
<s>
With	O
a	O
rewrite	O
to	O
Perl	B-Language
the	O
name	O
of	O
the	O
program	O
was	O
Amavis-perl	O
.	O
</s>
<s>
Daemonized	B-Operating_System
versions	O
were	O
initially	O
distributed	O
under	O
a	O
name	O
amavisd-snapshot	O
and	O
then	O
as	O
amavisd	B-Language
.	O
</s>
<s>
A	O
modular	O
rewrite	O
by	O
Hilko	O
Bengen	O
was	O
called	O
Amavis-ng	O
.	O
</s>
<s>
In	O
March	O
2002	O
the	O
amavisd-new	B-Language
branch	O
was	O
introduced	O
by	O
Mark	O
Martinec	O
,	O
initially	O
as	O
a	O
patch	O
against	O
amavisd-snapshot-20020300	O
.	O
</s>
<s>
Nowadays	O
a	O
project	O
name	O
is	O
preferably	O
spelled	O
Amavis	B-Language
(	O
while	O
the	O
name	O
of	O
the	O
program	O
itself	O
is	O
amavisd	B-Language
)	O
.	O
</s>
<s>
The	O
name	O
Amavis	B-Language
is	O
now	O
mostly	O
interchangeable	O
with	O
amavisd-new	B-Language
.	O
</s>
