iredmail-doc/html/quarantining.html

142 lines
5.4 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Quarantining</title>
<link href="./css/markdown.css" rel="stylesheet"></head>
</head>
<body>
<div id="navigation">
<a href="http://www.iredmail.org" target="_blank">iRedMail web site</a>
// <a href="./index.html">Document Index</a>
</div><h1 id="quarantining">Quarantining</h1>
<div class="toc">
<ul>
<li><a href="#quarantining">Quarantining</a><ul>
<li><a href="#summary">Summary</a></li>
<li><a href="#update-amavisd-config-file-to-enable-normal-quarantining">Update Amavisd config file to enable normal quarantining</a></li>
<li><a href="#configure-iredadmin-pro-to-manage-quarantined-mails">Configure iRedAdmin-Pro to manage quarantined mails</a></li>
<li><a href="#quarantine-clean-emails">Quarantine clean emails</a></li>
<li><a href="#screenshots">Screenshots</a></li>
</ul>
</li>
</ul>
</div>
<h2 id="summary">Summary</h2>
<p>Since iRedMail-<code>0.7.0</code>, quarantining related settings in Amavisd are configured
by iRedMail but disabled by default, you can easily enable quarantining with
this tutorial.</p>
<p>With below steps, Virus/Spam/Banned emails will be quarantined into SQL database.
You can then manage quarantined emails with iRedAdmin-Pro.</p>
<h2 id="update-amavisd-config-file-to-enable-normal-quarantining">Update Amavisd config file to enable normal quarantining</h2>
<p>Edit Amavisd config file, find below settings and update them. If it doesn't
exist, please add them.</p>
<ul>
<li>on Red Hat Enterprise Linux, CentOS, Scientific Linux, it's <code>/etc/amavisd/amavisd.conf</code>
or <code>/etc/amavisd.conf</code>.</li>
<li>on Debian/Ubuntu, it's <code>/etc/amavis/conf.d/50-user</code>.</li>
<li>on FreeBSD, it's <code>/usr/local/etc/amavisd.conf</code>.</li>
<li>on OpenBSD, it's <code>/etc/amavisd.conf</code>.</li>
</ul>
<pre><code># File: amavisd.conf
# Change below 3 parameters to D_DISCARD.
$final_virus_destiny = D_DISCARD;
$final_spam_destiny = D_DISCARD;
$final_banned_destiny = D_DISCARD;
# Quarantine SPAM into SQL server.
$spam_quarantine_to = 'spam-quarantine';
$spam_quarantine_method = 'sql:';
# Quarantine VIRUS into SQL server.
$virus_quarantine_to = 'virus-quarantine';
$virus_quarantine_method = 'sql:';
# Quarantine BANNED emails into SQL server.
$banned_quarantine_to = 'banned-quarantine';
$banned_files_quarantine_method = 'sql:';
</code></pre>
<p>Also, make sure you have below lines configured in same config file:</p>
<pre><code class="perl"># For MySQL
@storage_sql_dsn = (
['DBI:mysql:database=amavisd;host=127.0.0.1;port=3306', 'amavisd', 'password'],
);
# For PostgreSQL
#@storage_sql_dsn = (
# ['DBI:Pg:database=amavisd;host=127.0.0.1;port=5432', 'amavisd', 'password'],
#);
</code></pre>
<p>Restart amavisd service to make it work.</p>
<h2 id="configure-iredadmin-pro-to-manage-quarantined-mails">Configure iRedAdmin-Pro to manage quarantined mails</h2>
<p>Update iRedAdmin-Pro config file, make sure you have correct settings for Amavisd:</p>
<ul>
<li>on Red Hat Enterprise Linux, CentOS, Scientific Linux, it's <code>/var/www/iredadmin/settings.py</code>.</li>
<li>on Debian, Ubuntu, it's <code>/usr/share/apache2/iredadmin/settings.py</code>.</li>
<li>on FreeBSD, it's <code>/usr/local/www/iredadmin/settings.py</code>.</li>
<li>on OpenBSD, it's <code>/var/www/iredadmin/settings.py</code>.</li>
</ul>
<pre><code class="python"># File: settings.py
amavisd_db_host = '127.0.0.1'
amavisd_db_port = 3306
amavisd_db_name = 'amavisd'
amavisd_db_user = 'amavisd'
amavisd_db_password = 'password'
amavisd_enable_logging = True
amavisd_enable_quarantine = True
amavisd_quarantine_port = 9998
# This setting is used for per-recipient spam policy
amavisd_enable_policy_lookup = True
</code></pre>
<p>Restart Apache web server to make it work.</p>
<p>You can now login to iRedAdmin-Pro, and manage quarantined mails via menu
<code>System -&gt; Quarantined Mails</code>. Choose action in drop-down menu list to release
or delete them.</p>
<p>Screenshots attached at the bottom.</p>
<h2 id="quarantine-clean-emails">Quarantine clean emails</h2>
<p>If you want to quarantine clean emails into SQL database for further approval
or whatever reason, please try below steps:</p>
<ul>
<li>Update below parameters in Amavisd config file:</li>
</ul>
<pre><code class="perl"># File: /etc/amavisd/amavisd.conf
$clean_quarantine_method = 'sql:';
$clean_quarantine_to = 'clean-quarantine';
</code></pre>
<ul>
<li>Find policy bank 'MYUSERS', append two lines in this policy bank:</li>
</ul>
<pre><code class="perl">$policy_bank{'MYUSERS'} = {
...
clean_quarantine_method =&gt; 'sql:',
final_destiny_by_ccat =&gt; {CC_CLEAN, D_DISCARD},
}
</code></pre>
<ul>
<li>Restart Amavisd service.</li>
</ul>
<p>Now all clean emails sent by your mail users will be quarantined into SQL
database.</p>
<h2 id="screenshots">Screenshots</h2>
<ul>
<li>View quarantined mails:</li>
</ul>
<p><img alt="" src="http://www.iredmail.org/images/iredadmin/system_maillog_quarantined.png" /></p>
<ul>
<li>Expand quarantined mail to view mail body and headers.</li>
</ul>
<p><img alt="" src="http://www.iredmail.org/images/iredadmin/system_maillog_quarantined_expanded.png" /></p><br /><p style="text-align: center;">If you found something wrong
in this document, please do
<a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.</p><p style="text-align: center; color: grey;">&copy&copy Creative Commons</p></body></html>