<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Takahisa's Weblog &#187; postfix</title>
	<atom:link href="http://takahisa.info/tag/postfix/feed/" rel="self" type="application/rss+xml" />
	<link>http://takahisa.info</link>
	<description>weblog of lifetips?</description>
	<lastBuildDate>Fri, 02 Sep 2011 18:27:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>username@domain login name for email account with virtualmin and postfix</title>
		<link>http://takahisa.info/2010/03/20/usernamedomain-login-name-for-email-account-with-virtualmin-and-postfix/</link>
		<comments>http://takahisa.info/2010/03/20/usernamedomain-login-name-for-email-account-with-virtualmin-and-postfix/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 15:50:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[sasl]]></category>
		<category><![CDATA[virtualmin]]></category>

		<guid isPermaLink="false">http://takahisa.info/?p=261</guid>
		<description><![CDATA[For IMAP and POP3 authentication, all you have to do is change the &#8220;Format for usernames that include domain&#8221; in: Virtualmin > System Settings > Server Templates > Default Settings > Mail for Domain to be &#8220;user@domain&#8221;. However, Cyrus SASL, which is what handles the SMTP authentication, requires a special flag on it to handle [...]]]></description>
			<content:encoded><![CDATA[<p>For IMAP and POP3 authentication, all you have to do is change the &#8220;Format for usernames that include domain&#8221; in:</p>
<p>Virtualmin > System Settings > Server Templates > Default Settings > Mail for Domain</p>
<p>to be &#8220;user@domain&#8221;.</p>
<p>However, Cyrus SASL, which is what handles the SMTP authentication, requires a special flag on it to handle user@domain usernames, a -r in the settings. The magical file you need to edit is /etc/sysconfig/saslauthd. At the bottom you will see the following:</p>
<p>Additional flags to pass to saslauthd on the command line.<br />
See saslauthd(8) for the list of accepted flags. FLAGS=-r</p>
<p>Just make your FLAGS= like mine does. This will pass the -r to the sasl authentication daemon, and your user@domain authentication will work!</p>
<p>Let me know if you have any other questions.</p>
<p>Originally found at : http://blog.molski.nl/2009/10/07/virtualmin-and-userdomain-pop3smtp-login-style/</p>
]]></content:encoded>
			<wfw:commentRss>http://takahisa.info/2010/03/20/usernamedomain-login-name-for-email-account-with-virtualmin-and-postfix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup dkim on postfix with amavisd-new</title>
		<link>http://takahisa.info/2010/03/11/setup-dkim-on-postfix-with-amavisd-new/</link>
		<comments>http://takahisa.info/2010/03/11/setup-dkim-on-postfix-with-amavisd-new/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 05:26:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[amavisd]]></category>
		<category><![CDATA[dkim]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://takahisa.info/?p=248</guid>
		<description><![CDATA[step by step instruction coming soon&#8230; Setting up DKIM mail signing and verification from http://www.ijs.si/software/amavisd/ Setting up DKIM mail signing and verification A DKIM standard (RFC 4871) states the following, which applies to its predecessor DomainKeys (historical: RFC 4870) as well: DomainKeys Identified Mail (DKIM) defines a mechanism by which email messages can be cryptographically [...]]]></description>
			<content:encoded><![CDATA[<p>step by step instruction coming soon&#8230;</p>
<p>Setting up DKIM mail signing and verification from http://www.ijs.si/software/amavisd/</p>
<h2><a name="dkim">Setting up DKIM mail signing and verification</a></h2>
<p>A DKIM standard (RFC 4871) states the following, which applies<br />
to its predecessor DomainKeys (historical: RFC 4870) as well:</p>
<blockquote>
<p><i><br />
DomainKeys Identified Mail (DKIM)</i> defines a mechanism by which email<br />
messages can be cryptographically signed, permitting a signing domain<br />
to claim responsibility for the introduction of a message into the<br />
mail stream.  Message recipients can verify the signature by querying<br />
the signer&#8217;s domain directly to retrieve the appropriate public key,<br />
and thereby confirm that the message was attested to by a party in<br />
possession of the private key for the signing domain.</p>
</blockquote>
<blockquote>
<p>The <i>DomainKeys</i> specification was a primary source from which the<br />
<i>DomainKeys Identified Mail [DKIM]</i> specification has been derived.<br />
The purpose in submitting the RFC 4870 document is as an historical reference<br />
for deployed implementations written prior to the DKIM specification.</p>
</blockquote>
<p>The main advantage of DKIM signing <b>to sending domains</b><br />
is that it allows recipients to reliably validate mail origin for<br />
purposes of <b>whitelisting</b> on spam checks and whitelisting<br />
reception of otherwise banned mail contents. By signing outbound<br />
mail you give your correspondents a chance to distinguish between<br />
your genuine mail, and fraud or spam mail which may happen to carry<br />
your domain name as a sender address. Signing outbound mail is a<br />
<b>kind gesture towards recipients</b>, making it much easier for them<br />
to <b>treat your mail as important or desirable</b> if they choose so.</p>
<p>The main advantage of DKIM signature verification <b>to recipients</b><br />
is that it allows them to reliably distinguish genuine mail originating<br />
from a claimed sending domain from other (possibly faked) mail. It<br />
makes <b>signature-based whitelisting</b> a <b>reliable</b> mechanism.<br />
It also makes it possible to recognize and automatically discard<br />
<b>fake mail</b> claiming to be from domains which are known to always<br />
sign their outbound mail and to always send mail directly. Coupled<br />
with <b>reputation</b> schemes (mostly manual/static at present,<br />
or dynamic in the future) makes it possible to assign score points<br />
(positive or negative) based on merit and past experience<br />
with each signing domain. A valid signature also offers<br />
<b>non-repudiation</b>: a domain which signed a message can not<br />
disclaim message origin, which offers recipient a strong argument<br />
when <b>reporting abuse</b> to the signing domain.</p>
<h3><a name="dkim-impatient">For the impatient &#8211; signing from scratch</a></h3>
<p>Here is a quick Spartanic setup of DKIM signing and DKIM/DK<br />
verification by amavisd for the impatient, without much explanation,<br />
assuming all originating mail comes from internal networks (not<br />
from authenticated roaming clients), only one domain needs<br />
signing, using default signature tags, no milters are in use<br />
and no mailing list manager needs signing. No changes in Postfix<br />
configuration is necessary for this simple setup. For more<br />
information and more complex setups please see sections<br />
further on.</p>
<p>Generate a signing key:</p>
<pre>  $ amavisd genrsa /var/db/dkim/example-foo.key.pem
</pre>
<p>add to amavisd.conf:</p>
<pre>  $enable_dkim_verification = 1;
  $enable_dkim_signing = 1;
  dkim_key('example.com', 'foo', '/var/db/dkim/example-foo.key.pem');
  @dkim_signature_options_bysender_maps = (
    { '.' =&gt; { ttl =&gt; 21*24*3600, c =&gt; 'relaxed/simple' } } );
  @mynetworks = qw(0.0.0.0/8 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12
                   192.168.0.0/16);  # list your internal networks
</pre>
<p>run:</p>
<pre>  $ amavisd showkeys
</pre>
<p>add the public key (as displayed) to your DNS zone, increment SOA<br />
sequence number and reload DNS; then test signing and a published key:</p>
<pre>  $ amavisd testkeys
</pre>
<p>if all went well:</p>
<pre>  $ amavisd reload
</pre>
<h3><a name="dkim-impatient-from-milter">For the impatient &#8211; replacing<br />
signing by dkim-milter with signing by amavisd</a></h3>
<p>For sites already signing their mail by dkim-milter, most work<br />
of preparing signing keys and publishing public keys in DNS has<br />
already been done. All it needs to be done is to declare these<br />
signing keys in amavisd.conf and turn on $enable_dkim_signing.</p>
<p>To facilitate transition of DKIM signing from dkim-milter to amavisd-new,<br />
a new command-line tool is available with amavisd-new-2.6.2 (the extra<br />
utility code is not loaded during normal operation), taking a file name<br />
as its argument, e.g.:</p>
<pre>  $ amavisd convert_keysfile /var/db/dkim/keysfile.txt
</pre>
<p>and writing to stdout a set of lines that may be directly included into<br />
amavisd.conf configurations file, matching semantics of a dkim-filter<br />
keys file. It can be useful during transition, or for those who prefer<br />
to specify signing keys and sender-to-key mappings as a file in a syntax<br />
compatible with options -K -k of dkim-filter, and can live with limitations<br />
of such syntax. See dkim-filter(8) man page for details on the<br />
syntax.</p>
<p>The produced output consists of signing key declarations (calls to<br />
a procedure dkim_key), where each call normally corresponds to exactly<br />
one DNS resource record publishing a corresponding DKIM public key.<br />
When necessary output also produces an assignment to a list of lookup<br />
tables @dkim_signature_options_bysender_maps, which supplies non-default<br />
mappings of sender domains to signing keys, e.g. when third-party<br />
signatures are desired.</p>
<h3><a name="dkim-mail-flow">Implementation and mail flow</a></h3>
<p>Signing of originating mail (or mail being redistributed by our domain),<br />
and verifying signatures of incoming mail are two tasks that can be<br />
performed by the same program, or they can be performed by separate entities.<br />
Traditionally with sendmail, both tasks are performed by one milter,<br />
which may be easier to maintain, but has certain disadvantages.</p>
<p>Verifying signatures should be performed early, before any local mail<br />
transformations get a chance of invalidating a signature, e.g. by performing<br />
MIME conversions to quote-printable, by fixing syntactically invalid mail<br />
header section, by reformatting or reordering some header fields (some MTAs<br />
do it frivolously), by modifying/inserting/removing certain header<br />
fields, or by a local mailing list modifying mail text, e.g. by appending<br />
footers.</p>
<p>Signing outgoing mail should be performed late, after mail sanitation,<br />
after conversion to 7-bit characters (to avoid later uncontrollable<br />
changes by a relaying or receiving MTA), and after editing header<br />
section by a content filter. Similar applies to local mailing lists,<br />
which may be rewriting messages, requiring them to be re-signed by<br />
the domain hosting a mailing list, just before being sent out.</p>
<p>Starting with amavisd-new version 2.6.0, DKIM signing can be<br />
performed directly by amavisd (using a Perl module Mail::DKIM,<br />
which is the same module as used by DKIMproxy and by SpamAssassin).<br />
Signing directly by amavisd reduces setup complexity using a milter<br />
or DKIMproxy, and avoids additional data transfers. Regarding mail<br />
flow through the system there are similarities between signing in<br />
amavisd and signing by dkim-milter, which is why the diagram below<br />
shows both possibilities.</p>
<p>For verification there are three choices: either amavisd itself<br />
can do it by calling Mail::DKIM directly, or a SpamAssassin plugin<br />
can do it by calling the same Perl module, or a milter in<br />
verification-only mode can be invoked by an incoming Postfix<br />
smtpd service.</p>
<p>Advantage of invoking signature <i>verification by amavisd</i><br />
is that <i>all mail is checked</i> for signatures, regardless of<br />
whether SpamAssassin is called or not. Typically messages beyond<br />
a certain size are not passed to SpamAssassin, and neither are<br />
infected message or identified bounces. Amavisd also offers loading<br />
of policy banks based on valid DKIM/DK signatures (e.g. allowing<br />
some domains to send-in otherwise banned files, or whitelisting on<br />
spam), offers to add score points based on signing domain reputation,<br />
and adds Authentication-Results header field (like a dkim-milter<br />
does).</p>
<p>Invoking signature <i>verification by SpamAssassin</i> has an<br />
advantage that DKIM-based or DomainKeys-based whitelisting or scoring<br />
can be used, but has a disadvantage that possibly not all mail is<br />
checked (e.g. large mail and infected mail may be exempt from spam<br />
checks). Performing the same signature validation task twice (by<br />
amavisd and by SA) may seem wasteful, but in practice it is not<br />
too bad: thanks to DNS server caching a network lookup for a<br />
public signing key is only done once, and as SpamAssassin does not<br />
receive large mail for processing, its signature verification is<br />
very quick: few milliseconds for non-signed mail, and of the order<br />
of a tenth of a second for signed mail.</p>
<p>Invoking signature <i>verification by calling a milter</i> from<br />
incoming smtpd service has an advantage that it has the best chance<br />
of seeing mail in its pristine form (before canonical and virtual<br />
mapping or masquerading by MTA, regardless of their settings).<br />
Because it is poorly integrated with the rest of the chain (e.g. with<br />
SpamAssassin rules and amavisd policy banks), and because it adds<br />
one extra data transfer, it is mainly still useful as a way to<br />
double-check the correctness of DKIM validation by having two<br />
independent implementations in use, each inserting its independently<br />
derived Authentication-Results header field into passed mail.</p>
<p>To sign as late as possible with a dkim-milter, the signing<br />
milter can be invoked by a Postfix smtpd service which is receiving<br />
content-checked mail from a content filter such as amavisd-new.<br />
As this second-stage smtpd service does not reliably know how a<br />
given message came into a mail system and whether it is supposed<br />
to be signed or not, a clean solution is to provide two (or more)<br />
parallel paths through MTA and through a content filter, one used<br />
for mail that is eligible for being signed (originating mail),<br />
the other for all the rest. This same dual path approach through<br />
amavisd is beneficial for signing by amavisd too, for the same<br />
reason of providing a reliable source of information on mail<br />
origin to a signature choosing code:</p>
<pre>              +------+
              |verify|          (verify)
              +--+---+              | (by amavisd and/or SA)
                ^^^ milter          |
incoming:       |||             +---v-------+
  MX ----&gt;  25 smtpd ---&gt; 10024 &gt;           &gt;---&gt; 10025 smtpd --&gt;
                 ||             |           |
  SASL --&gt;  25 smtpd \          |  amavisd  | (notifications)
submission        |   +-&gt;       |           &gt;---&gt;_
  mynets-&gt;  25 smtpd ---&gt; 10026 &gt;ORIGINATING&gt;---&gt; 10027 smtpd --&gt;
submission            +-&gt;       +-------^---+            |
       --&gt; 587 smtpd /  :               |                v milter
                       (convert         |             +------+
                       to 7-bit)      (sign)          | sign |
                                                      +------+
</pre>
<p>There are other benefits to providing two parallel paths: a content<br />
filter may be configured to apply different rules and settings to mail<br />
that is known to be originating from our users. Some suggestions: apply<br />
less strict banning rules, enable spam administrator notifications for<br />
internally originating spam and viruses, letting SpamAssassin rules be<br />
conditionalized based on amavisd-new policy banks loaded, etc.</p>
<h3><a name="dkim-postfix-dual-path">Configuring multiple mail paths<br />
in Postfix</a></h3>
<p>Here is one way of configuring Postfix for providing two paths<br />
through a content filter. Locally submitted or authenticated mail<br />
will go to a content filter to its port 10026 and will be signed on<br />
its way out (either by amavisd or by a signing milter). All other<br />
mail (incoming) will be diverted to port 10024 for normal content<br />
filtering, and will not be eligible for signing.</p>
<p><i>main.cf:</i></p>
<pre>  # on re-queueing of a message smtpd_*_restrictions do not apply,
  # so we'd better provide a safe default for a content_filter,
  # even at an expense of later flipping the choice twice
  # (which adds a bit to log clutter, but never mind)
  #
  content_filter = amavisfeed:[127.0.0.1]:10024

  # each triggered FILTER deposits its argument into a
  # content_filter setting, the last deposited value applies
  #
  smtpd_sender_restrictions =
    check_sender_access regexp:/etc/postfix/tag_as_originating.re
    permit_mynetworks
    permit_sasl_authenticated
    permit_tls_clientcerts
    check_sender_access regexp:/etc/postfix/tag_as_foreign.re

  # Make sure to assign FILTER tags in restrictions which
  # are only invoked once per message, e.g. client or sender
  # restrictions, but NOT on smtpd_recipient_restrictions,
  # as a message may have multiple recipients, so multiple
  # passes through FILTER tag assignments can yield a
  # surprising (and incorrect) result.
</pre>
<p><i>/etc/postfix/tag_as_originating.re:</i></p>
<pre>  /^/  FILTER amavisfeed:[127.0.0.1]:10026
</pre>
<p><i>/etc/postfix/tag_as_foreign.re:</i></p>
<pre>  /^/  FILTER amavisfeed:[127.0.0.1]:10024
</pre>
<p>In master.cf set up two listening smtpd services for receiving<br />
filtered mail from amavisd (as per README.postfix), one on tcp<br />
port 10025 (for inbound mail) and the other on port 10027 (for<br />
originating mail). If a signing milter is in use it will be<br />
attached to a smtpd service on 10027 only. If no milters are<br />
in use and signing is done by amavisd, both smtpd services can<br />
have exactly the same settings, and in fact only one suffices,<br />
in which case redirecting $forward_method and $notify_method to<br />
&#8216;smtp:[127.0.0.1]:10027&#8242; in later example can be disregarded.</p>
<h3><a name="dkim-amavisd-path">Configuring multiple mail paths<br />
in amavisd</a></h3>
<p>In amavisd.conf two parallel paths need to be provided,<br />
one receiving on port 10024 and forwarding to 10025,<br />
the other receiving on port 10026 and forwarding to 10027.</p>
<pre>  $inet_socket_port = [10024,10026];  # listen on two ports
</pre>
<p>The 10024&gt;10025 path will be controlled by a default policy bank,<br />
the other (10026&gt;10027), dedicated to mail intended to be signed,<br />
will use a policy bank (arbitrarily) named ORIGINATING:</p>
<pre>  $forward_method = 'smtp:[127.0.0.1]:10025';  # MTA with non-signing service
  $notify_method  = 'smtp:[127.0.0.1]:10027';  # MTA with signing service

  # switch policy bank to 'ORIGINATING' for mail received on port 10026:
  $interface_policy{'10026'} = 'ORIGINATING';

  $policy_bank{'ORIGINATING'} = {  # mail originating from our users
    originating =&gt; 1,  # indicates client is ours, allows signing
    #
    # force MTA to convert mail to 7-bit before DKIM signing
    # to avoid later conversions which could destroy signature:
    smtpd_discard_ehlo_keywords =&gt; ['8BITMIME'],
    #
    # forward to a smtpd service providing DKIM signing service
    # (if using a signing milter instead of signing by amavisd):
    forward_method =&gt; 'smtp:[127.0.0.1]:10027',
    #
    # other special treatment of locally originating mail,
    # just some suggestions here:
    spam_admin_maps  =&gt; ["spamalert\@$mydomain"],  # warn of spam from us
    virus_admin_maps =&gt; ["virusalert\@$mydomain"],
    banned_filename_maps =&gt; ['ALT-RULES'],         # more relaxed rules
    spam_quarantine_cutoff_level_maps =&gt; undef,    # quarantine all spam
    spam_dsn_cutoff_level_maps =&gt; undef,
    spam_dsn_cutoff_level_bysender_maps =&gt; # bounce to local senders only
      [ { lc(".$mydomain") =&gt; undef,  '.' =&gt; 15 } ],
  };
</pre>
<p>The <tt>smtpd_discard_ehlo_keywords=&gt;['8BITMIME']</tt> serves<br />
to persuade Postfix to convert mail to 7-bit quoted-printable before<br />
submitting it to content filtering and signing. Avoiding 8-bit characters<br />
in mail body makes signatures less susceptible to breaking by some<br />
relaying or receiving MTA over which we have no control.<br />
The same effect (making Postfix convert outgoing mail to 7-bits<br />
before DKIM signing) could be achieved by a Postfix setting<br />
<tt>smtp_discard_ehlo_keywords=8bitmime</tt> on a smtp service<br />
feeding mail-to-be-signed to amavisd, but this would require setting<br />
up two such services, one with the option and one without.</p>
<p>Note that 8-bit to 7-bit conversion may break a S/MIME or PGP signature,<br />
so if mail signing is in use, it may not be desirable to let Postfix<br />
do the conversion, and it may be acceptable to take a risk that a remote<br />
MTA will clobber signatures if it decides the mail text is to be converted<br />
to 7-bits QP. The only reliable solution in this case is to configure<br />
MUA clients to stick to 7-bit characters/encodings before generating<br />
S/MIME or PGP signatures.</p>
<p>The following text from the Postfix documentation file MILTER_README<br />
<em>should be disregarded</em> &#8212; amavisd <em>is</em> 8-bit clean,<br />
and we do want Postfix to convert to 7-bits on the signing path<br />
but not on the other path:<br />
<span style="text-decoration:line-through;font-style:italic">Content<br />
filters may break domain key etc. signatures. If you use an SMTP-based<br />
content filter, then you should add a line to master.cf with<br />
&#8220;-o disable_mime_output_conversion=yes&#8221;, as described in the<br />
advanced content filter example.</span></p>
<p>While testing how the configured system plays with some mailing lists<br />
(such as <i>postfix-users</i> or SpamAssassin <i>users</i> list), one has<br />
to keep in mind that amavisd-new caches spam checking results of recently<br />
seen message bodies: a mail going out to a mailing list is not yet signed<br />
as it reaches a content filter, but the SpamAssassin verdict is remembered<br />
at that point (claiming the message is not signed). When this message<br />
with unchanged body comes back from a mailing list, this time signed<br />
in the header section by our domain, the signature should prove correct,<br />
yet the cached result from a minute ago still claims the message is not<br />
signed. If this is of concern, one can turn off caching of spam checking<br />
results for ham by setting:  <tt>$spam_check_negative_ttl = 0;</tt></p>
<p>While on the topic of providing multiple paths through amavisd,<br />
when one has to deal with a mailing list manager (e.g. Mailman) in the<br />
same setup, and re-signing of its fan-out mail is desired, it may be<br />
useful to add a third path through amavisd, this one stripped down to<br />
bare bones, providing only DKIM signing and nothing else (no virus or<br />
spam checks, no decoding), as these checks were already done once on<br />
mail before it reached a mailing list manager. Here is one possibility,<br />
accepting mail on port 10028 and sending it to 10025:</p>
<pre>  $inet_socket_port = [10024,10026,10028];

  $interface_policy{'10028'} = 'NOCHECKS';

  $policy_bank{'NOCHECKS'} = {  # no checks, just DKIM signing
    originating =&gt; 1,  # allows signing
    forward_method =&gt; 'smtp:[127.0.0.1]:10025',
    smtpd_greeting_banner =&gt;
      '${helo-name} ${protocol} ${product} NOCHECKS service ready',
    mynetworks_maps =&gt; [],  # avoids loading MYNETS policy unnecessarily
    os_fingerprint_method =&gt; undef,
    penpals_bonus_score =&gt; undef,
    bounce_killer_score =&gt; 0,
    bypass_decode_parts =&gt; 1,
    bypass_header_checks_maps =&gt; [1],
    bypass_virus_checks_maps  =&gt; [1],
    bypass_spam_checks_maps   =&gt; [1],
    bypass_banned_checks_maps =&gt; [1],
    spam_lovers_maps          =&gt; [1],
    banned_files_lovers_maps  =&gt; [1],
    archive_quarantine_to_maps =&gt; [],
    remove_existing_x_scanned_headers =&gt; undef,
    remove_existing_spam_headers =&gt; undef,
    signed_header_fields =&gt; { 'Sender' =&gt; 1 },
  };
</pre>
<p>amavisd.conf example</p>
<div class="code">
<p>use strict;</p>
<p># a minimalistic configuration file for amavisd-new with all necessary settings<br />
  #<br />
  #   see amavisd.conf-default for a list of all variables with their defaults;<br />
  #   see amavisd.conf-sample for a traditional-style commented file;<br />
  #   for more details see documentation in INSTALL, README_FILES/*<br />
  #   and at http://www.ijs.si/software/amavisd/amavisd-new-docs.html</p>
<p># HEADER<br />
  $allowed_added_header_fields{lc(&#8216;X-Spam-Checker-Version&#8217;)} = 0;</p>
<p># COMMONLY ADJUSTED SETTINGS:</p>
<p># @bypass_virus_checks_maps = (1);  # controls running of anti-virus code<br />
  # @bypass_spam_checks_maps  = (1);  # controls running of anti-spam code<br />
  # $bypass_decode_parts = 1;         # controls running of decoders&amp;dearchivers</p>
<p>$max_servers = 2;            # num of pre-forked children (2..30 is common), -m<br />
  $daemon_user  = &quot;amavis&quot;;     # (no default;  customary: vscan or amavis), -u<br />
  $daemon_group = &quot;amavis&quot;;     # (no default;  customary: vscan or amavis), -g</p>
<p>$mydomain = &#8216;mail.example.com&#8217;;   # a convenient default for other settings</p>
<p># $MYHOME = &#8216;/var/amavis&#8217;;   # a convenient default for other settings, -H<br />
  $TEMPBASE = &quot;$MYHOME/tmp&quot;;   # working directory, needs to exist, -T<br />
  $ENV{TMPDIR} = $TEMPBASE;    # environment variable TMPDIR, used by SA, etc.<br />
  #$QUARANTINEDIR = &quot;/var/virusmails&quot;;<br />
  # $quarantine_subdir_levels = 1;  # add level of subdirs to disperse quarantine<br />
  # $release_format = &#8216;resend&#8217;;     # &#8216;attach&#8217;, &#8216;plain&#8217;, &#8216;resend&#8217;<br />
  # $report_format  = &#8216;arf&#8217;;        # &#8216;attach&#8217;, &#8216;plain&#8217;, &#8216;resend&#8217;, &#8216;arf&#8217;</p>
<p># $daemon_chroot_dir = $MYHOME;   # chroot directory or undef, -R</p>
<p>$db_home   = &quot;$MYHOME/db&quot;;      # dir for bdb nanny/cache/snmp databases, -D<br />
  # $helpers_home = &quot;$MYHOME/var&quot;;  # working directory for SpamAssassin, -S<br />
  # $lock_file = &quot;$MYHOME/var/amavisd.lock&quot;;  # -L<br />
  # $pid_file  = &quot;$MYHOME/var/amavisd.pid&quot;;   # -P<br />
  #NOTE: create directories $MYHOME/tmp, $MYHOME/var, $MYHOME/db manually</p>
<p>$log_level = 0;              # verbosity 0..5, -d<br />
  $log_recip_templ = undef;    # disable by-recipient level-0 log entries<br />
  $DO_SYSLOG = 1;              # log via syslogd (preferred)<br />
  $syslog_facility = &#8216;mail&#8217;;   # Syslog facility as a string<br />
  # e.g.: mail, daemon, user, local0, &#8230; local7<br />
  $syslog_priority = &#8216;debug&#8217;;  # Syslog base (minimal) priority as a string,<br />
  # choose from: emerg, alert, crit, err, warning, notice, info, debug</p>
<p>$enable_db = 1;              # enable use of BerkeleyDB/libdb (SNMP and nanny)<br />
  $enable_global_cache = 1;    # enable use of libdb-based cache if $enable_db=1<br />
  $nanny_details_level = 2;    # nanny verbosity: 1: traditional, 2: detailed<br />
  $enable_dkim_verification = 1;  # enable DKIM signatures verification<br />
  $enable_dkim_signing = 1;    # load DKIM signing code, keys defined by dkim_key</p>
<p>dkim_key(&#8216;example.com&#8217;, &#8216;dkim&#8217;, &#8216;/etc/dkim/example.com.key.pem&#8217;);<br />
  @dkim_signature_options_bysender_maps = (    { &#8216;.&#8217; =&gt; { ttl =&gt; 21*24*3600, c =&gt; &#8216;relaxed/simple&#8217; } } );<br />
  @mynetworks = qw(127.0.0.0/8 [::1] [FE80::]/10 [FEC0::]/10<br />
  );  # list your internal networks</p>
<p>#@local_domains_maps = ( [&quot;.$mydomain&quot;] );  # list of all local domains<br />
  @local_domains_maps = ( 1 );<br />
  #@local_domains_maps = ( [&quot;.&quot;] );  # list of all local domains</p>
<p>#@mynetworks = qw( 127.0.0.0/8 [::1] [FE80::]/10 [FEC0::]/10<br />
  #                  10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 );</p>
<p>$unix_socketname = &quot;$MYHOME/amavisd.sock&quot;;  # amavisd-release or amavis-milter<br />
  # option(s) -p overrides $inet_socket_port and $unix_socketname</p>
<p># $inet_socket_port = 10024;   # listen on this local TCP port(s)<br />
  $inet_socket_port = [10024,10026];  # listen on multiple TCP ports</p>
<p>$policy_bank{&#8216;MYNETS&#8217;} = {   # mail originating from @mynetworks<br />
  originating =&gt; 1,  # is true in MYNETS by default, but let&#8217;s make it explicit<br />
  os_fingerprint_method =&gt; undef,  # don&#8217;t query p0f for internal clients<br />
  };</p>
<p># it is up to MTA to re-route mail from authenticated roaming users or<br />
  # from internal hosts to a dedicated TCP port (such as 10026) for filtering<br />
  $interface_policy{&#8217;10026&#8242;} = &#8216;ORIGINATING&#8217;;</p>
<p>$policy_bank{&#8216;ORIGINATING&#8217;} = {  # mail supposedly originating from our users<br />
  originating =&gt; 1,  # declare that mail was submitted by our smtp client<br />
  allow_disclaimers =&gt; 1,  # enables disclaimer insertion if available<br />
  # notify administrator of locally originating malware<br />
  virus_admin_maps =&gt; [&quot;virusalert\@$mydomain&quot;],<br />
  spam_admin_maps  =&gt; [&quot;virusalert\@$mydomain&quot;],<br />
  warnbadhsender   =&gt; 1,<br />
  # forward to a smtpd service providing DKIM signing service<br />
  forward_method =&gt; &#8216;smtp:[127.0.0.1]:10027&#8242;,<br />
  # force MTA conversion to 7-bit (e.g. before DKIM signing)<br />
  smtpd_discard_ehlo_keywords =&gt; ['8BITMIME'],<br />
  bypass_banned_checks_maps =&gt; [1],  # allow sending any file names and types<br />
  terminate_dsn_on_notify_success =&gt; 0,  # don&#8217;t remove NOTIFY=SUCCESS option<br />
  };</p>
<p>$interface_policy{&#8216;SOCK&#8217;} = &#8216;AM.PDP-SOCK&#8217;; # only applies with $unix_socketname</p>
<p># Use with amavis-release over a socket or with Petr Rehor&#8217;s amavis-milter.c<br />
  # (with amavis-milter.c from this package or old amavis.c client use &#8216;AM.CL&#8217;):<br />
  $policy_bank{&#8216;AM.PDP-SOCK&#8217;} = {<br />
  protocol =&gt; &#8216;AM.PDP&#8217;,<br />
  auth_required_release =&gt; 0,  # do not require secret_id for amavisd-release<br />
  };</p>
<p>$sa_tag_level_deflt  = 2.0;  # add spam info headers if at, or above that level<br />
  $sa_tag2_level_deflt = 14;  # add &#8216;spam detected&#8217; headers at that level<br />
  $sa_kill_level_deflt = 11.9;  # triggers spam evasive actions (e.g. blocks mail)<br />
  $sa_dsn_cutoff_level = 13;   # spam level beyond which a DSN is not sent<br />
  $sa_crediblefrom_dsn_cutoff_level = 18; # likewise, but for a likely valid From<br />
  # $sa_quarantine_cutoff_level = 25; # spam level beyond which quarantine is off<br />
  $penpals_bonus_score = 8;    # (no effect without a @storage_sql_dsn database)<br />
  $penpals_threshold_high = $sa_kill_level_deflt;  # don&#8217;t waste time on hi spam<br />
  $bounce_killer_score = 100;  # spam score points to add for joe-jobbed bounces</p>
<p>$sa_mail_body_size_limit = 400*1024; # don&#8217;t waste time on SA if mail is larger<br />
  $sa_local_tests_only = 0;    # only tests which do not require internet access?</p>
<p># @lookup_sql_dsn =<br />
  #   ( ['DBI:mysql:database=mail;host=127.0.0.1;port=3306', 'user1', 'passwd1'],<br />
  #     ['DBI:mysql:database=mail;host=host2', 'username2', 'password2'],<br />
  #     [&quot;DBI:SQLite:dbname=$MYHOME/sql/mail_prefs.sqlite&quot;, '', ''] );<br />
  # @storage_sql_dsn = @lookup_sql_dsn;  # none, same, or separate database</p>
<p># $timestamp_fmt_mysql = 1; # if using MySQL *and* msgs.time_iso is TIMESTAMP;<br />
  #   defaults to 0, which is good for non-MySQL or if msgs.time_iso is CHAR(16)</p>
<p>$virus_admin               = &quot;virusalert\@$mydomain&quot;;  # notifications recip.</p>
<p>$mailfrom_notify_admin     = &quot;virusalert\@$mydomain&quot;;  # notifications sender<br />
  $mailfrom_notify_recip     = &quot;virusalert\@$mydomain&quot;;  # notifications sender<br />
  $mailfrom_notify_spamadmin = &quot;spam.police\@$mydomain&quot;; # notifications sender<br />
  $mailfrom_to_quarantine = &#8221;; # null return path; uses original sender if undef
</p>
<p>$hdr_encoding = &#8216;utf-8&#8242;;	# header field bodies charset<br />
  $bdy_encoding = &#8216;utf-8&#8242;;	# notification body text charset<br />
  $hdr_encoding_qb = &#8216;Q&#8217;;	# quoted-printable (Q or B)<br />
  $warnvirussender = 1;	# I want to warn people, who have got virus.<br />
  $warnbannedsender = 1;<br />
  $warnbadhsender = 1;<br />
  $warnspamsender = 1;<br />
  $warnvirusrecip  = 1;	# I want to warn my users about virus send to them.<br />
  $warnbannedrecip = 1;<br />
  $warnbadhrecip = 1;<br />
  $warn_offsite = 0;	# I want to warn senders/recipients, that are not<br />
  #$hdrfrom_notify_sender     = &#8216;spam.police&#8217;; <br />
  $hdrfrom_notify_sender = &quot;\&quot;Content-filter at mx.example.com\&quot; &lt;spam.police\@$myhostname&gt;&quot;;<br />
  @addr_extension_virus_maps      = (&#8216;virus&#8217;);<br />
  @addr_extension_banned_maps     = (&#8216;banned&#8217;);<br />
  @addr_extension_spam_maps       = (&#8216;spam&#8217;);<br />
  @addr_extension_bad_header_maps = (&#8216;badh&#8217;);<br />
  # $recipient_delimiter = &#8216;+&#8217;;  # undef disables address extensions altogether<br />
  # when enabling addr extensions do also Postfix/main.cf: recipient_delimiter=+</p>
<p>$path = &#8216;/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin&#8217;;<br />
  # $dspam = &#8216;dspam&#8217;;</p>
<p>$MAXLEVELS = 14;<br />
  $MAXFILES = 1500;<br />
  $MIN_EXPANSION_QUOTA =      100*1024;  # bytes  (default undef, not enforced)<br />
  $MAX_EXPANSION_QUOTA = 300*1024*1024;  # bytes  (default undef, not enforced)</p>
<p>$sa_spam_subject_tag = &#8216;***SPAM*** &#8216;;<br />
  $defang_virus  = 1;  # MIME-wrap passed infected mail<br />
  $defang_banned = 1;  # MIME-wrap passed mail containing banned name<br />
  # for defanging bad headers only turn on certain minor contents categories:<br />
  $defang_by_ccat{+CC_BADH.&quot;,3&quot;} = 1;  # NUL or CR character in header<br />
  $defang_by_ccat{+CC_BADH.&quot;,5&quot;} = 1;  # header line longer than 998 characters<br />
  $defang_by_ccat{+CC_BADH.&quot;,6&quot;} = 1;  # header field syntax error
</p>
<p># OTHER MORE COMMON SETTINGS (defaults may suffice):</p>
<p> $myhostname = &#8216;mx.example.com&#8217;;  # must be a fully-qualified domain name!</p>
<p> $notify_method  = &#8216;smtp:[127.0.0.1]:10027&#8242;;<br />
  $forward_method = &#8216;smtp:[127.0.0.1]:10025&#8242;;  # set to undef with milter!</p>
<p> $final_virus_destiny      = D_DISCARD;<br />
  $final_banned_destiny     = D_BOUNCE;<br />
  $final_spam_destiny       = D_PASS;<br />
  $final_bad_header_destiny = D_PASS;<br />
  # $bad_header_quarantine_method = undef;</p>
<p># $os_fingerprint_method = &#8216;p0f:*:2345&#8242;;  # to query p0f-analyzer.pl</p>
<p>## hierarchy by which a final setting is chosen:<br />
  ##   policy bank (based on port or IP address) -&gt; *_by_ccat<br />
  ##   *_by_ccat (based on mail contents) -&gt; *_maps<br />
  ##   *_maps (based on recipient address) -&gt; final configuration value
</p>
<p># SOME OTHER VARIABLES WORTH CONSIDERING (see amavisd.conf-default for all)</p>
<p># $warnbadhsender,<br />
  # $warnvirusrecip, $warnbannedrecip, $warnbadhrecip, (or @warn*recip_maps)<br />
  #<br />
  # @bypass_virus_checks_maps, @bypass_spam_checks_maps,<br />
  # @bypass_banned_checks_maps, @bypass_header_checks_maps,<br />
  #<br />
  # @virus_lovers_maps, @spam_lovers_maps,<br />
  # @banned_files_lovers_maps, @bad_header_lovers_maps,<br />
  #<br />
  # @blacklist_sender_maps, @score_sender_maps,<br />
  #<br />
  # $clean_quarantine_method, $virus_quarantine_to, $banned_quarantine_to,<br />
  # $bad_header_quarantine_to, $spam_quarantine_to,<br />
  #<br />
  # $defang_bad_header, $defang_undecipherable, $defang_spam
</p>
<p># REMAINING IMPORTANT VARIABLES ARE LISTED HERE BECAUSE OF LONGER ASSIGNMENTS</p>
<p>@keep_decoded_original_maps = (new_RE(<br />
  qr&#8217;^MAIL$&#8217;,   # retain full original message for virus checking<br />
  qr&#8217;^MAIL-UNDECIPHERABLE$&#8217;, # recheck full mail if it contains undecipherables<br />
  qr&#8217;^(ASCII(?! cpio)|text|uuencoded|xxencoded|binhex)&#8217;i,<br />
  # qr&#8217;^Zip archive data&#8217;,     # don&#8217;t trust Archive::Zip<br />
  ));
</p>
<p># for $banned_namepath_re (a new-style of banned table) see amavisd.conf-sample</p>
<p>$banned_filename_re = new_RE(</p>
<p>### BLOCKED ANYWHERE<br />
  # qr&#8217;^UNDECIPHERABLE$&#8217;,  # is or contains any undecipherable components<br />
  #  qr&#8217;^\.(exe-ms|dll)$&#8217;,                   # banned file(1) types, rudimentary<br />
  qr&#8217;^\.(exe|lha|tnef|cab|dll)$&#8217;,         # banned file(1) types</p>
<p>### BLOCK THE FOLLOWING, EXCEPT WITHIN UNIX ARCHIVES:<br />
  # [ qr'^\.(gz|bz2)$'             =&gt; 0 ],  # allow any in gzip or bzip2<br />
  [ qr'^\.(rpm|cpio|tar)$'       =&gt; 0 ],  # allow any in Unix-type archives</p>
<p> qr&#8217;.\.(pif|scr)$&#8217;i,                     # banned extensions &#8211; rudimentary<br />
  # qr&#8217;^\.zip$&#8217;,                            # block zip type</p>
<p>### BLOCK THE FOLLOWING, EXCEPT WITHIN ARCHIVES:<br />
  # [ qr'^\.(zip|rar|arc|arj|zoo)$'=&gt; 0 ],  # allow any within these archives</p>
<p> qr&#8217;^application/x-msdownload$&#8217;i,        # block these MIME types<br />
  qr&#8217;^application/x-msdos-program$&#8217;i,<br />
  qr&#8217;^application/hta$&#8217;i,</p>
<p># qr&#8217;^message/partial$&#8217;i,         # rfc2046 MIME type<br />
  # qr&#8217;^message/external-body$&#8217;i,   # rfc2046 MIME type</p>
<p># qr&#8217;^(application/x-msmetafile|image/x-wmf)$&#8217;i,  # Windows Metafile MIME type<br />
  # qr&#8217;^\.wmf$&#8217;,                            # Windows Metafile file(1) type</p>
<p> # block certain double extensions in filenames<br />
  qr&#8217;\.[^./]*[A-Za-z][^./]*\.\s*(exe|vbs|pif|scr|bat|cmd|com|cpl|dll)[.\s]*$&#8217;i,</p>
<p># qr&#8217;\{[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}\}?&#8217;i, # Class ID CLSID, strict<br />
  # qr&#8217;\{[0-9a-z]{4,}(-[0-9a-z]{4,}){0,7}\}?&#8217;i, # Class ID extension CLSID, loose</p>
<p> qr&#8217;.\.(exe|vbs|pif|scr|cpl)$&#8217;i,             # banned extension &#8211; basic<br />
  # qr&#8217;.\.(exe|vbs|pif|scr|cpl|bat|cmd|com)$&#8217;i, # banned extension &#8211; basic+cmd<br />
  # qr&#8217;.\.(ade|adp|app|bas|bat|chm|cmd|com|cpl|crt|emf|exe|fxp|grp|hlp|hta|<br />
  #        inf|ins|isp|js|jse|lnk|mda|mdb|mde|mdw|mdt|mdz|msc|msi|msp|mst|<br />
  #        ops|pcd|pif|prg|reg|scr|sct|shb|shs|vb|vbe|vbs|<br />
  #        wmf|wsc|wsf|wsh)$&#8217;ix,  # banned ext &#8211; long<br />
  # qr&#8217;.\.(ani|cur|ico)$&#8217;i,                 # banned cursors and icons filename<br />
  # qr&#8217;^\.ani$&#8217;,                            # banned animated cursor file(1) type</p>
<p># qr&#8217;.\.(mim|b64|bhx|hqx|xxe|uu|uue)$&#8217;i,  # banned extension &#8211; WinZip vulnerab.<br />
  );<br />
  # See http://support.microsoft.com/default.aspx?scid=kb;EN-US;q262631<br />
  # and http://www.cknow.com/vtutor/vtextensions.htm
</p>
<p># ENVELOPE SENDER SOFT-WHITELISTING / SOFT-BLACKLISTING</p>
<p>@score_sender_maps = ({ # a by-recipient hash lookup table,<br />
  # results from all matching recipient tables are summed</p>
<p># ## per-recipient personal tables  (NOTE: positive: black, negative: white)<br />
  # &#8216;user1@example.com&#8217;  =&gt; [{'bla-mobile.press@example.com' =&gt; 10.0}],<br />
  # &#8216;user3@example.com&#8217;  =&gt; [{'.ebay.com'                 =&gt; -3.0}],<br />
  # &#8216;user4@example.com&#8217;  =&gt; [{'cleargreen@cleargreen.com' =&gt; -7.0,<br />
  #                           '.cleargreen.com'           =&gt; -5.0}],</p>
<p> ## site-wide opinions about senders (the &#8216;.&#8217; matches any recipient)<br />
  &#8216;.&#8217; =&gt; [  # the _first_ matching sender determines the score boost</p>
<p> new_RE(  # regexp-type lookup table, just happens to be all soft-blacklist<br />
  [qr'^(bulkmail|offers|cheapbenefits|earnmoney|foryou)@'i         =&gt; 5.0],<br />
  [qr'^(greatcasino|investments|lose_weight_today|market\.alert)@'i=&gt; 5.0],<br />
  [qr'^(money2you|MyGreenCard|new\.tld\.registry|opt-out|opt-in)@'i=&gt; 5.0],<br />
  [qr'^(optin|saveonlsmoking2002k|specialoffer|specialoffers)@'i   =&gt; 5.0],<br />
  [qr'^(stockalert|stopsnoring|wantsome|workathome|yesitsfree)@'i  =&gt; 5.0],<br />
  [qr'^(your_friend|greatoffers)@'i                                =&gt; 5.0],<br />
  [qr'^(inkjetplanet|marketopt|MakeMoney)\d*@'i                    =&gt; 5.0],<br />
  ),</p>
<p>#  read_hash(&quot;/var/amavis/sender_scores_sitewide&quot;),</p>
<p> { # a hash-type lookup table (associative array)<br />
  &#8216;nobody@cert.org&#8217;                        =&gt; -3.0,<br />
  &#8216;cert-advisory@us-cert.gov&#8217;              =&gt; -3.0,<br />
  &#8216;owner-alert@iss.net&#8217;                    =&gt; -3.0,<br />
  &#8216;slashdot@slashdot.org&#8217;                  =&gt; -3.0,<br />
  &#8216;securityfocus.com&#8217;                      =&gt; -3.0,<br />
  &#8216;ntbugtraq@listserv.ntbugtraq.com&#8217;       =&gt; -3.0,<br />
  &#8216;security-alerts@linuxsecurity.com&#8217;      =&gt; -3.0,<br />
  &#8216;mailman-announce-admin@python.org&#8217;      =&gt; -3.0,<br />
  &#8216;amavis-user-admin@lists.sourceforge.net&#8217;=&gt; -3.0,<br />
  &#8216;amavis-user-bounces@lists.sourceforge.net&#8217; =&gt; -3.0,<br />
  &#8216;spamassassin.apache.org&#8217;                =&gt; -3.0,<br />
  &#8216;notification-return@lists.sophos.com&#8217;   =&gt; -3.0,<br />
  &#8216;owner-postfix-users@postfix.org&#8217;        =&gt; -3.0,<br />
  &#8216;owner-postfix-announce@postfix.org&#8217;     =&gt; -3.0,<br />
  &#8216;owner-sendmail-announce@lists.sendmail.org&#8217;   =&gt; -3.0,<br />
  &#8216;sendmail-announce-request@lists.sendmail.org&#8217; =&gt; -3.0,<br />
  &#8216;donotreply@sendmail.org&#8217;                =&gt; -3.0,<br />
  &#8216;ca+envelope@sendmail.org&#8217;               =&gt; -3.0,<br />
  &#8216;noreply@freshmeat.net&#8217;                  =&gt; -3.0,<br />
  &#8216;owner-technews@postel.acm.org&#8217;          =&gt; -3.0,<br />
  &#8216;ietf-123-owner@loki.ietf.org&#8217;           =&gt; -3.0,<br />
  &#8216;cvs-commits-list-admin@gnome.org&#8217;       =&gt; -3.0,<br />
  &#8216;rt-users-admin@lists.fsck.com&#8217;          =&gt; -3.0,<br />
  &#8216;clp-request@comp.nus.edu.sg&#8217;            =&gt; -3.0,<br />
  &#8216;surveys-errors@lists.nua.ie&#8217;            =&gt; -3.0,<br />
  &#8216;emailnews@genomeweb.com&#8217;                =&gt; -5.0,<br />
  &#8216;yahoo-dev-null@yahoo-inc.com&#8217;           =&gt; -3.0,<br />
  &#8216;returns.groups.yahoo.com&#8217;               =&gt; -3.0,<br />
  &#8216;clusternews@linuxnetworx.com&#8217;           =&gt; -3.0,<br />
  lc(&#8216;lvs-users-admin@LinuxVirtualServer.org&#8217;)    =&gt; -3.0,<br />
  lc(&#8216;owner-textbreakingnews@CNNIMAIL12.CNN.COM&#8217;) =&gt; -5.0,</p>
<p> # soft-blacklisting (positive score)<br />
  &#8216;sender@example.net&#8217;                     =&gt;  3.0,<br />
  &#8216;.example.net&#8217;                           =&gt;  1.0,</p>
<p> },<br />
  ],  # end of site-wide tables<br />
  });
</p>
<p>@decoders = (<br />
  ['mail', \&amp;do_mime_decode],<br />
  ['asc',  \&amp;do_ascii],<br />
  ['uue',  \&amp;do_ascii],<br />
  ['hqx',  \&amp;do_ascii],<br />
  ['ync',  \&amp;do_ascii],<br />
  ['F',    \&amp;do_uncompress, ['unfreeze','freeze -d','melt','fcat'] ],<br />
  ['Z',    \&amp;do_uncompress, ['uncompress','gzip -d','zcat'] ],<br />
  ['gz',   \&amp;do_uncompress,  'gzip -d'],<br />
  ['gz',   \&amp;do_gunzip],<br />
  ['bz2',  \&amp;do_uncompress,  'bzip2 -d'],<br />
  ['lzo',  \&amp;do_uncompress,  'lzop -d'],<br />
  ['rpm',  \&amp;do_uncompress, ['rpm2cpio.pl','rpm2cpio'] ],<br />
  ['cpio', \&amp;do_pax_cpio,   ['pax','gcpio','cpio'] ],<br />
  ['tar',  \&amp;do_pax_cpio,   ['pax','gcpio','cpio'] ],<br />
  ['deb',  \&amp;do_ar,          'ar'],<br />
  # ['a',    \&amp;do_ar,          'ar'],  # unpacking .a seems an overkill<br />
  ['zip',  \&amp;do_unzip],<br />
  ['7z',   \&amp;do_7zip,       ['7zr','7za','7z'] ],<br />
  ['rar',  \&amp;do_unrar,      ['rar','unrar'] ],<br />
  ['arj',  \&amp;do_unarj,      ['arj','unarj'] ],<br />
  ['arc',  \&amp;do_arc,        ['nomarch','arc'] ],<br />
  ['zoo',  \&amp;do_zoo,        ['zoo','unzoo'] ],<br />
  ['lha',  \&amp;do_lha,         'lha'],<br />
  # ['doc',  \&amp;do_ole,         'ripole'],<br />
  ['cab',  \&amp;do_cabextract,  'cabextract'],<br />
  ['tnef', \&amp;do_tnef_ext,    'tnef'],<br />
  ['tnef', \&amp;do_tnef],<br />
  # ['sit',  \&amp;do_unstuff,     'unstuff'],  # broken/unsafe decoder<br />
  ['exe',  \&amp;do_executable, ['rar','unrar'], &#8216;lha&#8217;, ['arj','unarj'] ],<br />
  );
</p>
<p>@av_scanners = (</p>
<p># ### http://www.clanfield.info/sophie/ (http://www.vanja.com/tools/sophie/)<br />
  # ['Sophie',<br />
  #   \&amp;ask_daemon, [&quot;{}/\n&quot;, '/var/run/sophie'],<br />
  #   qr/(?x)^ 0+ ( : | [\000\r\n]* $)/m,  qr/(?x)^ 1 ( : | [\000\r\n]* $)/m,<br />
  #   qr/(?x)^ [-+]? \d+ : (.*?) [\000\r\n]* $/m ],</p>
<p># ### http://www.csupomona.edu/~henson/www/projects/SAVI-Perl/<br />
  # ['Sophos SAVI', \&amp;sophos_savi ],</p>
<p># ### http://www.clamav.net/<br />
  # ['ClamAV-clamd',<br />
  #   \&amp;ask_daemon, [&quot;CONTSCAN {}\n&quot;, &quot;/var/run/clamav/clamd&quot;],<br />
  #   qr/\bOK$/m, qr/\bFOUND$/m,<br />
  #   qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],<br />
  # # NOTE: run clamd under the same user as amavisd, or run it under its own<br />
  # #   uid such as clamav, add user clamav to the amavis group, and then add<br />
  # #   AllowSupplementaryGroups to clamd.conf;<br />
  # # NOTE: match socket name (LocalSocket) in clamav.conf to the socket name in<br />
  # #   this entry; when running chrooted one may prefer socket &quot;$MYHOME/clamd&quot;.
</p>
<p>### http://www.clamav.net/<br />
  ['ClamAV-clamd',<br />
  \&amp;ask_daemon, [&quot;CONTSCAN {}\n&quot;, &quot;/var/run/clamav/clamd.sock&quot;],<br />
  qr/\bOK$/, qr/\bFOUND$/,<br />
  qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],</p>
<p># ### http://www.clamav.net/ and CPAN  (memory-hungry! clamd is preferred)<br />
  # # note that Mail::ClamAV requires perl to be build with threading!<br />
  # ['Mail::ClamAV', \&amp;ask_clamav, &quot;*&quot;, [0], [1], qr/^INFECTED: (.+)/m ],</p>
<p># ### http://www.openantivirus.org/<br />
  # ['OpenAntiVirus ScannerDaemon (OAV)',<br />
  #   \&amp;ask_daemon, [&quot;SCAN {}\n&quot;, '127.0.0.1:8127'],<br />
  #   qr/^OK/m, qr/^FOUND: /m, qr/^FOUND: (.+)/m ],</p>
<p># ### http://www.vanja.com/tools/trophie/<br />
  # ['Trophie',<br />
  #   \&amp;ask_daemon, [&quot;{}/\n&quot;, '/var/run/trophie'],<br />
  #   qr/(?x)^ 0+ ( : | [\000\r\n]* $)/m,  qr/(?x)^ 1 ( : | [\000\r\n]* $)/m,<br />
  #   qr/(?x)^ [-+]? \d+ : (.*?) [\000\r\n]* $/m ],</p>
<p># ### http://www.grisoft.com/<br />
  # ['AVG Anti-Virus',<br />
  #   \&amp;ask_daemon, [&quot;SCAN {}\n&quot;, '127.0.0.1:55555'],<br />
  #   qr/^200/m, qr/^403/m, qr/^403 .*?: ([^\r\n]+)/m ],</p>
<p># ### http://www.f-prot.com/<br />
  # ['F-Prot fpscand',  # F-PROT Antivirus for BSD/Linux/Solaris, version 6<br />
  #   \&amp;ask_daemon,<br />
  #   [&quot;SCAN FILE {}/*\n&quot;, '127.0.0.1:10200'],<br />
  #   qr/^(0|8|64) /m,<br />
  #   qr/^([1235679]|1[01345]) |&lt;[^&gt;:]*(?i)(infected|suspicious|unwanted)/m,<br />
  #   qr/(?i)&lt;[^&gt;:]*(?:infected|suspicious|unwanted)[^&gt;:]*: ([^&gt;]*)&gt;/m ],</p>
<p># ### http://www.f-prot.com/<br />
  # ['F-Prot f-protd',  # old version<br />
  #   \&amp;ask_daemon,<br />
  #   [&quot;GET {}/*?-dumb%20-archive%20-packed HTTP/1.0\r\n\r\n&quot;,<br />
  #     ['127.0.0.1:10200', '127.0.0.1:10201', '127.0.0.1:10202',<br />
  #      '127.0.0.1:10203', '127.0.0.1:10204'] ],<br />
  #   qr/(?i)&lt;summary[^&gt;]*&gt;clean&lt;\/summary&gt;/m,<br />
  #   qr/(?i)&lt;summary[^&gt;]*&gt;infected&lt;\/summary&gt;/m,<br />
  #   qr/(?i)&lt;name&gt;(.+)&lt;\/name&gt;/m ],</p>
<p># ### http://www.sald.com/, http://www.dials.ru/english/, http://www.drweb.ru/<br />
  # ['DrWebD', \&amp;ask_daemon,   # DrWebD 4.31 or later<br />
  #   [pack('N',1).  # DRWEBD_SCAN_CMD<br />
  #    pack('N',0x00280001).   # DONT_CHANGEMAIL, IS_MAIL, RETURN_VIRUSES<br />
  #    pack('N',     # path length<br />
  #      length(&quot;$TEMPBASE/amavis-yyyymmddTHHMMSS-xxxxx/parts/pxxx&quot;)).<br />
  #    '{}/*'.       # path<br />
  #    pack('N',0).  # content size<br />
  #    pack('N',0),<br />
  #    '/var/drweb/run/drwebd.sock',<br />
  #  # '/var/amavis/var/run/drwebd.sock',   # suitable for chroot<br />
  #  # '/usr/local/drweb/run/drwebd.sock',  # FreeBSD drweb ports default<br />
  #  # '127.0.0.1:3000',                    # or over an inet socket<br />
  #   ],<br />
  #   qr/\A\x00[\x10\x11][\x00\x10]\x00/sm,        # IS_CLEAN,EVAL_KEY; SKIPPED<br />
  #   qr/\A\x00[\x00\x01][\x00\x10][\x20\x40\x80]/sm,# KNOWN_V,UNKNOWN_V,V._MODIF<br />
  #   qr/\A.{12}(?:infected with )?([^\x00]+)\x00/sm,<br />
  # ],<br />
  # # NOTE: If using amavis-milter, change length to:<br />
  # # length(&quot;$TEMPBASE/amavis-milter-xxxxxxxxxxxxxx/parts/pxxx&quot;).</p>
<p> ### http://www.kaspersky.com/  (kav4mailservers)<br />
  #  ['KasperskyLab AVP - aveclient',<br />
  #    ['/usr/local/kav/bin/aveclient','/usr/local/share/kav/bin/aveclient',<br />
  #     '/opt/kav/5.5/kav4mailservers/bin/aveclient','aveclient'],<br />
  #    &#8216;-p /var/run/aveserver -s {}/*&#8217;,<br />
  #    [0,3,6,8], qr/\b(INFECTED|SUSPICION|SUSPICIOUS)\b/m,<br />
  #    qr/(?:INFECTED|WARNING|SUSPICION|SUSPICIOUS) (.+)/m,<br />
  #  ],<br />
  # NOTE: one may prefer [0],[2,3,4,5], depending on how suspicious,<br />
  # currupted or protected archives are to be handled</p>
<p> ### http://www.kaspersky.com/<br />
  #  ['KasperskyLab AntiViral Toolkit Pro (AVP)', ['avp'],<br />
  #    &#8216;-* -P -B -Y -O- {}&#8217;, [0,3,6,8], [2,4],    # any use for -A -K   ?<br />
  #    qr/infected: (.+)/m,<br />
  #    sub {chdir(&#8216;/opt/AVP&#8217;) or die &quot;Can&#8217;t chdir to AVP: $!&quot;},<br />
  #    sub {chdir($TEMPBASE) or die &quot;Can&#8217;t chdir back to $TEMPBASE $!&quot;},<br />
  #  ],</p>
<p> ### The kavdaemon and AVPDaemonClient have been removed from Kasperky<br />
  ### products and replaced by aveserver and aveclient<br />
  #  ['KasperskyLab AVPDaemonClient',<br />
  #    [ '/opt/AVP/kavdaemon',       'kavdaemon',<br />
  #      '/opt/AVP/AvpDaemonClient', 'AvpDaemonClient',<br />
  #      '/opt/AVP/AvpTeamDream',    'AvpTeamDream',<br />
  #      '/opt/AVP/avpdc', 'avpdc' ],<br />
  #    &quot;-f=$TEMPBASE {}&quot;, [0,8], [3,4,5,6], qr/infected: ([^\r\n]+)/m ],<br />
  # change the startup-script in /etc/init.d/kavd to:<br />
  #   DPARMS=&quot;-* -Y -dl -f=/var/amavis /var/amavis&quot;<br />
  #   (or perhaps:   DPARMS=&quot;-I0 -Y -* /var/amavis&quot; )<br />
  # adjusting /var/amavis above to match your $TEMPBASE.<br />
  # The &#8216;-f=/var/amavis&#8217; is needed if not running it as root, so it<br />
  # can find, read, and write its pid file, etc., see &#8216;man kavdaemon&#8217;.<br />
  # defUnix.prf: there must be an entry &quot;*/var/amavis&quot; (or whatever<br />
  #   directory $TEMPBASE specifies) in the &#8216;Names=&#8217; section.<br />
  # cd /opt/AVP/DaemonClients; configure; cd Sample; make<br />
  # cp AvpDaemonClient /opt/AVP/<br />
  # su &#8211; vscan -c &quot;${PREFIX}/kavdaemon ${DPARMS}&quot;</p>
<p> ### http://www.centralcommand.com/<br />
  #  ['CentralCommand Vexira (new) vascan',<br />
  #    ['vascan','/usr/lib/Vexira/vascan'],<br />
  #    &quot;-a s &#8211;timeout=60 &#8211;temp=$TEMPBASE -y $QUARANTINEDIR &quot;.<br />
  #    &quot;&#8211;log=/var/log/vascan.log {}&quot;,<br />
  #    [0,3], [1,2,5],<br />
  #    qr/(?x)^\s* (?:virus|iworm|macro|mutant|sequence|trojan)\ found:\ ( [^\]\s&#8217;]+ )\ \.\.\.\ /m ],<br />
  # Adjust the path of the binary and the virus database as needed.<br />
  # &#8216;vascan&#8217; does not allow to have the temp directory to be the same as<br />
  # the quarantine directory, and the quarantine option can not be disabled.<br />
  # If $QUARANTINEDIR is not used, then another directory must be specified<br />
  # to appease &#8216;vascan&#8217;. Move status 3 to the second list if password<br />
  # protected files are to be considered infected.</p>
<p> ### http://www.avira.com/<br />
  ### Avira AntiVir (formerly H+BEDV) or (old) CentralCommand Vexira Antivirus<br />
  #  ['Avira AntiVir', ['antivir','vexira'],<br />
  #    &#8216;&#8211;allfiles -noboot -nombr -rs -s -z {}&#8217;, [0], qr/ALERT:|VIRUS:/m,<br />
  #    qr/(?x)^\s* (?: ALERT: \s* (?: \[ | [^']* &#8216; ) |<br />
  #         (?i) VIRUS:\ .*?\ virus\ &#8216;?) ( [^\]\s&#8217;]+ )/m ],<br />
  # NOTE: if you only have a demo version, remove -z and add 214, as in:<br />
  #  &#8216;&#8211;allfiles -noboot -nombr -rs -s {}&#8217;, [0,214], qr/ALERT:|VIRUS:/,</p>
<p> ### http://www.commandsoftware.com/<br />
  #  ['Command AntiVirus for Linux', 'csav',<br />
  #    '-all -archive -packed {}', [50], [51,52,53],<br />
  #    qr/Infection: (.+)/m ],</p>
<p> ### http://www.symantec.com/<br />
  #  ['Symantec CarrierScan via Symantec CommandLineScanner',<br />
  #    'cscmdline', '-a scan -i 1 -v -s 127.0.0.1:7777 {}',<br />
  #    qr/^Files Infected:\s+0$/m, qr/^Infected\b/m,<br />
  #    qr/^(?:Info|Virus Name):\s+(.+)/m ],</p>
<p> ### http://www.symantec.com/<br />
  #  ['Symantec AntiVirus Scan Engine',<br />
  #    'savsecls', '-server 127.0.0.1:7777 -mode scanrepair -details -verbose {}',<br />
  #    [0], qr/^Infected\b/m,<br />
  #    qr/^(?:Info|Virus Name):\s+(.+)/m ],<br />
  # NOTE: check options and patterns to see which entry better applies</p>
<p># ### http://www.f-secure.com/products/anti-virus/  version 4.65<br />
  #  ['F-Secure Antivirus for Linux servers',<br />
  #   ['/opt/f-secure/fsav/bin/fsav', 'fsav'],<br />
  #   &#8216;&#8211;delete=no &#8211;disinf=no &#8211;rename=no &#8211;archive=yes &#8211;auto=yes &#8216;.<br />
  #   &#8216;&#8211;dumb=yes &#8211;list=no &#8211;mime=yes {}&#8217;, [0], [3,6,8],<br />
  #   qr/(?:infection|Infected|Suspected): (.+)/m ],</p>
<p> ### http://www.f-secure.com/products/anti-virus/  version 5.52<br />
  #   ['F-Secure Antivirus for Linux servers',<br />
  #    ['/opt/f-secure/fsav/bin/fsav', 'fsav'],<br />
  #    &#8216;&#8211;virus-action1=report &#8211;archive=yes &#8211;auto=yes &#8216;.<br />
  #    &#8216;&#8211;dumb=yes &#8211;list=no &#8211;mime=yes {}&#8217;, [0], [3,4,6,8],<br />
  #    qr/(?:infection|Infected|Suspected|Riskware): (.+)/m ],<br />
  # NOTE: internal archive handling may be switched off by &#8216;&#8211;archive=no&#8217;<br />
  #   to prevent fsav from exiting with status 9 on broken archives</p>
<p># ### http://www.avast.com/<br />
  # ['avast! Antivirus daemon',<br />
  #   \&amp;ask_daemon,	# greets with 220, terminate with QUIT<br />
  #   [&quot;SCAN {}\015\012QUIT\015\012&quot;, '/var/run/avast4/mailscanner.sock'],<br />
  #   qr/\t\[\+\]/m, qr/\t\[L\]\t/m, qr/\t\[L\]\t([^[ \t\015\012]+)/m ],</p>
<p># ### http://www.avast.com/<br />
  # ['avast! Antivirus - Client/Server Version', 'avastlite',<br />
  #   '-a /var/run/avast4/mailscanner.sock -n {}', [0], [1],<br />
  #   qr/\t\[L\]\t([^[ \t\015\012]+)/m ],</p>
<p>#  ['CAI InoculateIT', 'inocucmd',  # retired product<br />
  #    '-sec -nex {}', [0], [100],<br />
  #    qr/was infected by virus (.+)/m ],<br />
  # see: http://www.flatmtn.com/computer/Linux-Antivirus_CAI.html</p>
<p> ### http://www3.ca.com/Solutions/Product.asp?ID=156  (ex InoculateIT)<br />
  #  ['CAI eTrust Antivirus', 'etrust-wrapper',<br />
  #    '-arc -nex -spm h {}', [0], [101],<br />
  #    qr/is infected by virus: (.+)/m ],<br />
  # NOTE: requires suid wrapper around inocmd32; consider flag: -mod reviewer<br />
  # see http://marc.theaimsgroup.com/?l=amavis-user&amp;m=109229779912783</p>
<p> ### http://mks.com.pl/english.html<br />
  #  ['MkS_Vir for Linux (beta)', ['mks32','mks'],<br />
  #    &#8216;-s {}/*&#8217;, [0], [1,2],<br />
  #    qr/&#8211;[ \t]*(.+)/m ],</p>
<p> ### http://mks.com.pl/english.html<br />
  #  ['MkS_Vir daemon', 'mksscan',<br />
  #    '-s -q {}', [0], [1..7],<br />
  #    qr/^&#8230; (\S+)/m ],</p>
<p># ### http://www.nod32.com/,  version v2.52 (old)<br />
  # ['ESET NOD32 for Linux Mail servers',<br />
  #   ['/opt/eset/nod32/bin/nod32cli', 'nod32cli'],<br />
  #    &#8216;&#8211;subdir &#8211;files -z &#8211;sfx &#8211;rtp &#8211;adware &#8211;unsafe &#8211;pattern &#8211;heur &#8216;.<br />
  #    &#8216;-w -a &#8211;action-on-infected=accept &#8211;action-on-uncleanable=accept &#8216;.<br />
  #    &#8216;&#8211;action-on-notscanned=accept {}&#8217;,<br />
  #   [0,3], [1,2], qr/virus=&quot;([^&quot;]+)&quot;/m ],</p>
<p># ### http://www.eset.com/, version v2.7 (old)<br />
  # ['ESET NOD32 Linux Mail Server - command line interface',<br />
  #   ['/usr/bin/nod32cli', '/opt/eset/nod32/bin/nod32cli', 'nod32cli'],<br />
  #   &#8216;&#8211;subdir {}&#8217;, [0,3], [1,2], qr/virus=&quot;([^&quot;]+)&quot;/m ],</p>
<p># ### http://www.eset.com/, version 2.71.12<br />
  # ['ESET Software ESETS Command Line Interface',<br />
  #   ['/usr/bin/esets_cli', 'esets_cli'],<br />
  #   &#8216;&#8211;subdir {}&#8217;, [0], [1,2,3], qr/virus=&quot;([^&quot;]+)&quot;/m ],</p>
<p> ### http://www.eset.com/, version 3.0<br />
  #  ['ESET Software ESETS Command Line Interface',<br />
  #    ['/usr/bin/esets_cli', 'esets_cli'],<br />
  #    &#8216;&#8211;subdir {}&#8217;, [0], [1,2,3],<br />
  #    qr/:\s*action=&quot;(?!accepted)[^&quot;]*&quot;\n.*:\s*virus=&quot;([^&quot;]*)&quot;/m ],</p>
<p> ## http://www.nod32.com/,  NOD32LFS version 2.5 and above<br />
  #  ['ESET NOD32 for Linux File servers',<br />
  #    ['/opt/eset/nod32/sbin/nod32','nod32'],<br />
  #    &#8216;&#8211;files -z &#8211;mail &#8211;sfx &#8211;rtp &#8211;adware &#8211;unsafe &#8211;pattern &#8211;heur &#8216;.<br />
  #    &#8216;-w -a &#8211;action=1 -b {}&#8217;,<br />
  #    [0], [1,10], qr/^object=.*, virus=&quot;(.*?)&quot;,/m ],</p>
<p># Experimental, based on posting from Rado Dibarbora (Dibo) on 2002-05-31<br />
  # ['ESET Software NOD32 Client/Server (NOD32SS)',<br />
  #   \&amp;ask_daemon2,    # greets with 200, persistent, terminate with QUIT<br />
  #   [&quot;SCAN {}/*\r\n&quot;, '127.0.0.1:8448' ],<br />
  #   qr/^200 File OK/m, qr/^201 /m, qr/^201 (.+)/m ],</p>
<p> ### http://www.norman.com/products_nvc.shtml<br />
  #  ['Norman Virus Control v5 / Linux', 'nvcc',<br />
  #    '-c -l:0 -s -u -temp:$TEMPBASE {}', [0,10,11], [1,2,14],<br />
  #    qr/(?i).* virus in .* -&gt; \&#8217;(.+)\&#8217;/m ],</p>
<p> ### http://www.pandasoftware.com/<br />
  #  ['Panda CommandLineSecure 9 for Linux',<br />
  #    ['/opt/pavcl/usr/bin/pavcl','pavcl'],<br />
  #    &#8216;-auto -aex -heu -cmp -nbr -nor -nos -eng -nob {}&#8217;,<br />
  #    qr/Number of files infected[ .]*: 0+(?!\d)/m,<br />
  #    qr/Number of files infected[ .]*: 0*[1-9]/m,<br />
  #    qr/Found virus :\s*(\S+)/m ],<br />
  # NOTE: for efficiency, start the Panda in resident mode with &#8216;pavcl -tsr&#8217;<br />
  # before starting amavisd &#8211; the bases are then loaded only once at startup.<br />
  # To reload bases in a signature update script:<br />
  #   /opt/pavcl/usr/bin/pavcl -tsr -ulr; /opt/pavcl/usr/bin/pavcl -tsr<br />
  # Please review other options of pavcl, for example:<br />
  #  -nomalw, -nojoke, -nodial, -nohackt, -nospyw, -nocookies</p>
<p># ### http://www.pandasoftware.com/<br />
  # ['Panda Antivirus for Linux', ['pavcl'],<br />
  #   &#8216;-TSR -aut -aex -heu -cmp -nbr -nor -nso -eng {}&#8217;,<br />
  #   [0], [0x10, 0x30, 0x50, 0x70, 0x90, 0xB0, 0xD0, 0xF0],<br />
  #   qr/Found virus :\s*(\S+)/m ],</p>
<p># GeCAD AV technology is acquired by Microsoft; RAV has been discontinued.<br />
  # Check your RAV license terms before fiddling with the following two lines!<br />
  # ['GeCAD RAV AntiVirus 8', 'ravav',<br />
  #   '--all --archive --mail {}', [1], [2,3,4,5], qr/Infected: (.+)/m ],<br />
  # # NOTE: the command line switches changed with scan engine 8.5 !<br />
  # # (btw, assigning stdin to /dev/null causes RAV to fail)</p>
<p> ### http://www.nai.com/<br />
  #  ['NAI McAfee AntiVirus (uvscan)', 'uvscan',<br />
  #    '--secure -rv --mime --summary --noboot - {}', [0], [13],<br />
  #    qr/(?x) Found (?:<br />
  #        \ the\ (.+)\ (?:virus|trojan)  |<br />
  #        \ (?:virus|trojan)\ or\ variant\ ([^ ]+)  |<br />
  #        :\ (.+)\ NOT\ a\ virus)/m,<br />
  # sub {$ENV{LD_PRELOAD}=&#8217;/lib/libc.so.6&#8242;},<br />
  # sub {delete $ENV{LD_PRELOAD}},<br />
  #  ],<br />
  # NOTE1: with RH9: force the dynamic linker to look at /lib/libc.so.6 before<br />
  # anything else by setting environment variable LD_PRELOAD=/lib/libc.so.6<br />
  # and then clear it when finished to avoid confusing anything else.<br />
  # NOTE2: to treat encrypted files as viruses replace the [13] with:<br />
  #  qr/^\s{5,}(Found|is password-protected|.*(virus|trojan))/</p>
<p> ### http://www.virusbuster.hu/en/<br />
  #  ['VirusBuster', ['vbuster', 'vbengcl'],<br />
  #    &quot;{} -ss -i &#8216;*&#8217; -log=$MYHOME/vbuster.log&quot;, [0], [1],<br />
  #    qr/: &#8216;(.*)&#8217; &#8211; Virus/m ],<br />
  # VirusBuster Ltd. does not support the daemon version for the workstation<br />
  # engine (vbuster-eng-1.12-linux-i386-libc6.tgz) any longer. The names of<br />
  # binaries, some parameters AND return codes have changed (from 3 to 1).<br />
  # See also the new Vexira entry &#8216;vascan&#8217; which is possibly related.</p>
<p># ### http://www.virusbuster.hu/en/<br />
  # ['VirusBuster (Client + Daemon)', 'vbengd',<br />
  #   '-f -log scandir {}', [0], [3],<br />
  #   qr/Virus found = (.*);/m ],<br />
  # # HINT: for an infected file it always returns 3,<br />
  # # although the man-page tells a different story</p>
<p> ### http://www.cyber.com/<br />
  #  ['CyberSoft VFind', 'vfind',<br />
  #    '--vexit {}/*', [0], [23], qr/##==&gt;&gt;&gt;&gt; VIRUS ID: CVDL (.+)/m,<br />
  # sub {$ENV{VSTK_HOME}=&#8217;/usr/lib/vstk&#8217;},<br />
  #  ],</p>
<p> ### http://www.avast.com/<br />
  #  ['avast! Antivirus', ['/usr/bin/avastcmd','avastcmd'],<br />
  #    &#8216;-a -i -n -t=A {}&#8217;, [0], [1], qr/\binfected by:\s+([^ \t\n\[\]]+)/m ],</p>
<p> ### http://www.ikarus-software.com/<br />
  #  ['Ikarus AntiVirus for Linux', 'ikarus',<br />
  #    '{}', [0], [40], qr/Signature (.+) found/m ],</p>
<p> ### http://www.bitdefender.com/<br />
  #  ['BitDefender', 'bdscan',  # new version<br />
  #    '--action=ignore --no-list {}', qr/^Infected files\s*:\s*0+(?!\d)/m,<br />
  #    qr/^(?:Infected files|Identified viruses|Suspect files)\s*:\s*0*[1-9]/m,<br />
  #    qr/(?:suspected|infected)\s*:\s*(.*)(?:\033|$)/m ],</p>
<p> ### http://www.bitdefender.com/<br />
  #  ['BitDefender', 'bdc',  # old version<br />
  #    '--arc --mail {}', qr/^Infected files *:0+(?!\d)/m,<br />
  #    qr/^(?:Infected files|Identified viruses|Suspect files) *:0*[1-9]/m,<br />
  #    qr/(?:suspected|infected): (.*)(?:\033|$)/m ],<br />
  # consider also: &#8211;all &#8211;nowarn &#8211;alev=15 &#8211;flev=15.  The &#8211;all argument may<br />
  # not apply to your version of bdc, check documentation and see &#8216;bdc &#8211;help&#8217;</p>
<p> ### ArcaVir for Linux and Unix http://www.arcabit.pl/<br />
  #  ['ArcaVir for Linux', ['arcacmd','arcacmd.static'],<br />
  #    &#8216;-v 1 -summary 0 -s {}&#8217;, [0], [1,2],<br />
  #    qr/(?:VIR|WIR):[ \t]*(.+)/m ],</p>
<p># ### a generic SMTP-client interface to a SMTP-based virus scanner<br />
  # ['av_smtp', \&amp;ask_av_smtp,<br />
  #   ['{}', 'smtp:[127.0.0.1]:5525&#8242;, &#8216;dummy@localhost&#8217;],<br />
  #   qr/^2/, qr/^5/, qr/^\s*(.*?)\s*$/m ],</p>
<p># ['File::Scan', sub {Amavis::AV::ask_av(sub{<br />
  #   use File::Scan; my($fn)=@_;<br />
  #   my($f)=File::Scan-&gt;new(max_txt_size=&gt;0, max_bin_size=&gt;0);<br />
  #   my($vname) = $f-&gt;scan($fn);<br />
  #   $f-&gt;error ? (2,&quot;Error: &quot;.$f-&gt;error)<br />
  #   : ($vname ne '') ? (1,&quot;$vname FOUND&quot;) : (0,&quot;Clean&quot;)}, @_) },<br />
  #   [&quot;{}/*&quot;], [0], [1], qr/^(.*) FOUND$/m ],</p>
<p># ### fully-fledged checker for JPEG marker segments of invalid length<br />
  # ['check-jpeg',<br />
  #   sub { use JpegTester (); Amavis::AV::ask_av(\&amp;JpegTester::test_jpeg, @_) },<br />
  #   [&quot;{}/*&quot;], undef, [1], qr/^(bad jpeg: .*)$/m ],<br />
  # # NOTE: place file JpegTester.pm somewhere where Perl can find it,<br />
  # #       for example in /usr/local/lib/perl5/site_perl</p>
<p>);
</p>
<p>@av_scanners_backup = (</p>
<p> ### http://www.clamav.net/   &#8211; backs up clamd or Mail::ClamAV<br />
  ['ClamAV-clamscan', 'clamscan',<br />
  &quot;--stdout --no-summary -r --tempdir=$TEMPBASE {}&quot;,<br />
  [0], qr/:.*\sFOUND$/m, qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],</p>
<p> ### http://www.f-prot.com/   &#8211; backs up F-Prot Daemon, V6<br />
  #  ['F-PROT Antivirus for UNIX', ['fpscan'],<br />
  #    &#8216;&#8211;report &#8211;mount &#8211;adware {}&#8217;,  # consider: &#8211;applications -s 4 -u 3 -z 10<br />
  #    [0,8,64],  [1,2,3, 4+1,4+2,4+3, 8+1,8+2,8+3, 12+1,12+2,12+3],<br />
  #    qr/^\[Found\s+[^\]]*\]\s+&lt;([^ \t(&gt;]*)/m ],</p>
<p> ### http://www.f-prot.com/   &#8211; backs up F-Prot Daemon (old)<br />
  #  ['FRISK F-Prot Antivirus', ['f-prot','f-prot.sh'],<br />
  #    &#8216;-dumb -archive -packed {}&#8217;, [0,8], [3,6],   # or: [0], [3,6,8],<br />
  #    qr/(?:Infection:|security risk named) (.+)|\s+contains\s+(.+)$/m ],</p>
<p> ### http://www.trendmicro.com/   &#8211; backs up Trophie<br />
  #  ['Trend Micro FileScanner', ['/etc/iscan/vscan','vscan'],<br />
  #    &#8216;-za -a {}&#8217;, [0], qr/Found virus/m, qr/Found virus (.+) in/m ],</p>
<p> ### http://www.sald.com/, http://drweb.imshop.de/   &#8211; backs up DrWebD<br />
  #  ['drweb - DrWeb Antivirus',  # security LHA hole in Dr.Web 4.33 and earlier<br />
  #    ['/usr/local/drweb/drweb', '/opt/drweb/drweb', 'drweb'],<br />
  #    &#8216;-path={} -al -go -ot -cn -upn -ok-&#8217;,<br />
  #    [0,32], [1,9,33], qr&#8217; infected (?:with|by)(?: virus)? (.*)$&#8217;m ],</p>
<p> ### http://www.kaspersky.com/<br />
  #   ['Kaspersky Antivirus v5.5',<br />
  #     ['/opt/kaspersky/kav4fs/bin/kav4fs-kavscanner',<br />
  #      '/opt/kav/5.5/kav4unix/bin/kavscanner',<br />
  #      '/opt/kav/5.5/kav4mailservers/bin/kavscanner', 'kavscanner'],<br />
  #     &#8216;-i0 -xn -xp -mn -R -ePASBME {}/*&#8217;, [0,10,15], [5,20,21,25],<br />
  #     qr/(?:INFECTED|WARNING|SUSPICION|SUSPICIOUS) (.*)/m,<br />
  #    sub {chdir(&#8216;/opt/kav/bin&#8217;) or die &quot;Can&#8217;t chdir to kav: $!&quot;},<br />
  #    sub {chdir($TEMPBASE) or die &quot;Can&#8217;t chdir back to $TEMPBASE $!&quot;},<br />
  #   ],</p>
<p># Commented out because the name &#8216;sweep&#8217; clashes with Debian and FreeBSD<br />
  # package/port of an audio editor. Make sure the correct &#8216;sweep&#8217; is found<br />
  # in the path when enabling.<br />
  #<br />
  # ### http://www.sophos.com/   &#8211; backs up Sophie or SAVI-Perl<br />
  # ['Sophos Anti Virus (sweep)', 'sweep',<br />
  #   '-nb -f -all -rec -ss -sc -archive -cab -mime -oe -tnef '.<br />
  #   '--no-reset-atime {}',<br />
  #   [0,2], qr/Virus .*? found/m,<br />
  #   qr/^&gt;&gt;&gt; Virus(?: fragment)? &#8216;?(.*?)&#8217;? found/m,<br />
  # ],<br />
  # # other options to consider: -idedir=/usr/local/sav</p>
<p># Always succeeds and considers mail clean.<br />
  # Potentially useful when all other scanners fail and it is desirable<br />
  # to let mail continue to flow with no virus checking (when uncommented).<br />
  # ['always-clean', sub {0}],</p>
<p>);
</p>
<p>1;  # insure a defined return value</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://takahisa.info/2010/03/11/setup-dkim-on-postfix-with-amavisd-new/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Install SSL certificate on postfix and dovecot</title>
		<link>http://takahisa.info/2010/03/11/install-ssl-certificate-on-postfix-and-dovecot/</link>
		<comments>http://takahisa.info/2010/03/11/install-ssl-certificate-on-postfix-and-dovecot/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 05:07:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://takahisa.info/?p=238</guid>
		<description><![CDATA[Make key file #openssl genrsa -des3 -out example.com.key 1024 Generating RSA private key, 1024 bit long modulus &#8230;&#8230;&#8230;&#8230;..++++++ ..++++++ e is 65537 (0&#215;10001) Enter pass phrase for example.com.key: Verifying &#8211; Enter pass phrase for example.com.key: # openssl req -new -key example.com.key -out example.com.csr Enter pass phrase for example.com.key: Country Name (2 letter code) [AU]: State [...]]]></description>
			<content:encoded><![CDATA[<p>Make key file</p>
<p class="code">#openssl genrsa -des3 -out example.com.key 1024<br />
  Generating RSA private key, 1024 bit long modulus<br />
  &#8230;&#8230;&#8230;&#8230;..++++++<br />
  ..++++++<br />
  e is 65537 (0&#215;10001)<br />
  Enter pass phrase for example.com.key:<br />
  Verifying &#8211; Enter pass phrase for example.com.key:<br />
  # openssl req -new -key example.com.key -out example.com.csr<br />
  Enter pass phrase for example.com.key:<br />
  Country Name (2 letter code) [AU]:<br />
  State or Province Name (full name) [Some-State]:<br />
  Locality Name (eg, city) []:<br />
  Organization Name (eg, company) [Internet Widgits Pty Ltd]:<br />
  Organizational Unit Name (eg, section) []:<br />
  Common Name (eg, YOUR name) []:<br />
  Email Address []:<br />
  A challenge password []:<br />
  An optional company name []:</p>
<p>Get CRT (GeoTrust, verisign etc)</p>
<p>Remove pass phrase</p>
<p class="code">  #openssl rsa -in example.com.key -out example.com.pem</p>
<p>edit /etc/postfix/main.cf</p>
<p class="code">smtpd_use_tls = yes<br />
  smtpd_tls_session_cache_timeout = 3600s<br />
  smtpd_tls_key_file = /etc/pki/tls/certs/example.com.pem<br />
  smtpd_tls_cert_file = /etc/pki/tls/certs/example.com.crt</p>
<p>edit /etc/dovecot.conf</p>
<p class="code">ssl_disable = no<br />
  ssl_cert_file = /etc/pki/tls/certs/example.com.crt<br />
  ssl_key_file = /etc/pki/tls/certs/example.com.pem</p>
<p>restart postfix and dovecot</p>
]]></content:encoded>
			<wfw:commentRss>http://takahisa.info/2010/03/11/install-ssl-certificate-on-postfix-and-dovecot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Postgrey on CentOS</title>
		<link>http://takahisa.info/2009/01/31/install-postgrey-on-centos/</link>
		<comments>http://takahisa.info/2009/01/31/install-postgrey-on-centos/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 11:53:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://takahisa.info/?p=195</guid>
		<description><![CDATA[Activate dag repository [dag] name=Dag RPM Repository for Red Hat Enterprise Linux baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag gpgcheck=1 install package root@ns99 ~ # yum install postgrey edit startup script /etc/init.d/postgrey #OPTIONS=&#8221;&#8211;unix=$SOCKET&#8221; OPTIONS=&#8221;&#8211;whitelist-clients=/etc/postfix/postgrey_whitelist_clients &#8211;whitelist    recipients=/etc/postfix/postgrey_whitelist_recipients &#8211;inet=10023 -d &#8211;unix=$SOCKET&#8221; startup postgrey when system is bootup  root@ns99 ~ # chkconfig postgrey on install filter to postfix /etc/postfix/main.cf smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, check_policy_service inet:127.0.0.1:10023 edit white-list as you [...]]]></description>
			<content:encoded><![CDATA[<p><em>Activate dag repository</em></p>
<p class="code">[dag]<br />
name=Dag RPM Repository for Red Hat Enterprise Linux<br />
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag<br />
gpgcheck=1</p>
<p><em>install package</em></p>
<p class="code"><span style="color: #ff0000;">root@ns99</span> <span style="color: #3366ff;">~ #</span> yum install postgrey</p>
<p><em>edit startup script /etc/init.d/postgrey</em></p>
<p class="code">#OPTIONS=&#8221;&#8211;unix=$SOCKET&#8221;<br />
OPTIONS=&#8221;&#8211;whitelist-clients=/etc/postfix/postgrey_whitelist_clients &#8211;whitelist<br />
   recipients=/etc/postfix/postgrey_whitelist_recipients &#8211;inet=10023 -d &#8211;unix=$SOCKET&#8221;</p>
<p><em>startup postgrey when system is bootup</em></p>
<p class="code"><span style="color: #ff0000;"> root@ns99 </span><span style="color: #3366ff;">~ #</span> chkconfig postgrey on</p>
<p><em>install filter to postfix /etc/postfix/main.cf</em></p>
<p class="code"><em><span style="font-style: normal;">smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, check_policy_service inet:127.0.0.1:10023</span></em></p>
<p><em>edit white-list as you need /etc/postfix/postgrey_whitelist_clients</em></p>
<p><em>Check delay from maillog</em></p>
<p class="code">cat /var/log/maillog | postgreyreport </p>
]]></content:encoded>
			<wfw:commentRss>http://takahisa.info/2009/01/31/install-postgrey-on-centos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install SPF to CentOS Postfix</title>
		<link>http://takahisa.info/2009/01/31/install-spf-to-centos-postfix/</link>
		<comments>http://takahisa.info/2009/01/31/install-spf-to-centos-postfix/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 10:26:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[nojunkmail]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://takahisa.info/?p=194</guid>
		<description><![CDATA[In computing, Sender Policy Framework (SPF) allows software to identify messages that are or are not authorized to use the domain name in the SMTP HELO and MAIL FROM (Return-Path) commands, based on information published in a sender policy of the domain owner. Forged return paths are common in e-mail spam and result inbackscatter. SPF is defined in RFC 4408. from wikipedia Install [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>In <a title="Computing" href="http://en.wikipedia.org/wiki/Computing">computing</a>, <strong>Sender Policy Framework</strong> (<strong>SPF</strong>) allows software to identify messages that are or are not authorized to use the domain name in the <a class="mw-redirect" title="SMTP" href="http://en.wikipedia.org/wiki/SMTP">SMTP</a> HELO and MAIL FROM (<a class="mw-redirect" title="Return-Path" href="http://en.wikipedia.org/wiki/Return-Path">Return-Path</a>) commands, based on information published in a sender policy of the domain owner. Forged return paths are common in <a title="E-mail spam" href="http://en.wikipedia.org/wiki/E-mail_spam">e-mail spam</a> and result in<a title="Backscatter (e-mail)" href="http://en.wikipedia.org/wiki/Backscatter_(e-mail)">backscatter</a>. SPF is defined in <a class="external" title="http://tools.ietf.org/html/rfc4408" href="http://tools.ietf.org/html/rfc4408">RFC 4408</a>. from wikipedia</p></blockquote>
<p><em>Install require packages</em></p>
<p class="code"><span style="color: #ff0000;">root@ns99</span> <span style="color: #3366ff;">~ #</span> yum install perl-Mail-SPF</p>
<p><em>Get SPF module from </em><a href="http://www.openspf.org/Software"><em>http://www.openspf.org/Software</em></a><em> Newest at this time is 2.007 and Install SPF module</em></p>
<p class="code"><span style="color: #ff0000;">root@ns99</span> <span style="color: #3366ff;">~ #</span> wget http://www.openspf.org/blobs/postfix-policyd-spf-perl-2.007.tar.gz <span style="color: #ff0000;">root@ns99</span> <span style="color: #3366ff;">~ #</span> tar zxvf postfix-policyd-spf-perl-2.007.tar.gz <span style="color: #ff0000;">root@ns99</span> <span style="color: #3366ff;">~ #</span> mv postfix-policyd-spf-perl-2.007/postfix-policyd-spf-perl /usr/local/lib.</p>
<p><em>add following line to /etc/postfix/master.cf</em></p>
<p class="code">policy  unix  -       n       n       &#8211;       0       spawn<br />
    user=nobody argv=/usr/bin/perl /usr/local/lib/policyd-spf-perl</p>
<p><em>add following line to /etc/postfix/main.cf</em></p>
<p class="code">smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, check_policy_service,<br />
  check_policy_service unix:private/policy<br />
  policy_time_limit = 3600</p>
<p><em>Add SPF record to your DNS. SPF record can be wizardly made from </em> <a href="http://old.openspf.org/wizard.html?mydomain=example.com&amp;submit=Go%21" target="_blank">http://old.openspf.org/wizard.html?mydomain=example.com&amp;submit=Go%21</a></p>
<p class="code">spf01   IN TXT &#8220;v=spf1 +ip4:xxx.xxx.xxx.xxx/24 ~all&#8221;<br />
  spf02   IN TXT &#8220;v=spf1 +ip4:yyy.yyy.yyy.yyy/24  ~all&#8221;<br />
  @       IN TXT &#8220;v=spf1 include:spf01.example.com include:spf02.example.com ~all&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://takahisa.info/2009/01/31/install-spf-to-centos-postfix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

