2016-05-19 06:51:20 -05:00
<!DOCTYPE html>
2014-09-30 10:13:21 -05:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
< title > Quarantining< / title >
2015-07-31 23:14:52 -05:00
< link rel = "stylesheet" type = "text/css" href = "./css/markdown.css" / >
2014-09-30 10:13:21 -05:00
< / head >
< body >
< div id = "navigation" >
2016-04-19 12:48:51 -05:00
< a href = "/index.html" target = "_blank" >
< img alt = "iRedMail web site"
src="./images/logo-iredmail.png"
style="vertical-align: middle; height: 30px;"
/>
< span > iRedMail< / span >
< / a >
2016-05-18 20:17:26 -05:00
// < a href = "./index.html" > Document Index< / a > < / div > < div class = "admonition note" >
2016-11-11 02:56:08 -06:00
< p class = "admonition-title" > This tutorial is available in other languages. < a href = "https://bitbucket.org/zhb/iredmail-docs/src" > Help translate more< / a > < / p >
2016-05-18 20:17:26 -05:00
< p > < a href = "./quarantining-it_IT.html" > Italiano< / a > /< / p >
< / div >
< h1 id = "quarantining" > Quarantining< / h1 >
2014-09-30 10:13:21 -05:00
< div class = "toc" >
< ul >
< li > < a href = "#quarantining" > Quarantining< / a > < ul >
2015-04-08 04:21:48 -05:00
< li > < a href = "#quarantining-spam-virus-banned-and-bad-header-messages" > Quarantining spam, virus, banned and bad header messages< / a > < / li >
2016-04-03 08:20:59 -05:00
< li > < a href = "#configure-iredadmin-pro-to-manage-quarantined-mails" > Configure iRedAdmin-Pro to manage quarantined mails< / a > < ul >
< li > < a href = "#notify-users-about-quarantined-mails" > Notify users about quarantined mails< / a > < / li >
< / ul >
< / li >
2014-09-30 10:13:21 -05:00
< li > < a href = "#quarantine-clean-emails" > Quarantine clean emails< / a > < / li >
< li > < a href = "#screenshots" > Screenshots< / a > < / li >
< / ul >
< / li >
< / ul >
< / div >
< 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 >
2015-04-08 04:21:48 -05:00
< h2 id = "quarantining-spam-virus-banned-and-bad-header-messages" > Quarantining spam, virus, banned and bad header messages< / h2 >
2014-09-30 10:13:21 -05:00
< 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 >
2014-12-18 06:40:50 -06:00
< pre > < code > # Part of file: /etc/amavisd/amavisd.conf
2014-09-30 10:13:21 -05:00
2015-04-08 04:21:48 -05:00
# Change values of below parameters to D_DISCARD.
2014-12-18 06:40:50 -06:00
# Detected spams/virus/banned messages will not be delivered to user's mailbox.
2014-09-30 10:13:21 -05:00
$final_virus_destiny = D_DISCARD;
$final_spam_destiny = D_DISCARD;
$final_banned_destiny = D_DISCARD;
2015-04-08 04:21:48 -05:00
$final_bad_header_destiny = D_DISCARD;
2014-09-30 10:13:21 -05:00
# 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:';
2014-12-18 06:40:50 -06:00
# Quarantine BANNED message into SQL server.
2014-09-30 10:13:21 -05:00
$banned_quarantine_to = 'banned-quarantine';
$banned_files_quarantine_method = 'sql:';
2015-04-08 04:21:48 -05:00
# Quarantine Bad Header message into SQL server.
$bad_header_quarantine_method = 'sql:';
$bad_header_quarantine_to = 'bad-header-quarantine';
2014-09-30 10:13:21 -05:00
< / code > < / pre >
< p > Also, make sure you have below lines configured in same config file:< / p >
2014-12-18 06:40:50 -06:00
< pre > < code class = "perl" > # For MySQL/MariaDB/OpenLDAP backends
2014-09-30 10:13:21 -05:00
@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 >
2014-12-18 06:40:50 -06:00
< p > Restarting amavisd service is required.< / p >
2014-09-30 10:13:21 -05:00
< 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 >
2015-06-09 09:30:50 -05:00
< li > on Debian, Ubuntu, it's < code > /opt/www/iredadmin/settings.py< / code > or < code > /usr/share/apache2/iredadmin/settings.py< / code > .< / li >
2014-09-30 10:13:21 -05:00
< 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'
2014-10-10 10:51:42 -05:00
# Log basic info of inbound/outbound, no mail body stored.
2014-09-30 10:13:21 -05:00
amavisd_enable_logging = True
2014-10-10 10:51:42 -05:00
# Quarantining management
2014-09-30 10:13:21 -05:00
amavisd_enable_quarantine = True
amavisd_quarantine_port = 9998
2014-10-10 10:51:42 -05:00
# Per-recipient policy lookup
2014-09-30 10:13:21 -05:00
amavisd_enable_policy_lookup = True
< / code > < / pre >
2014-12-18 06:40:50 -06:00
< p > Restarting Apache web server or < code > uwsgi< / code > service (if you're running Nginx as
web server) is required.< / p >
< p > You can now login to iRedAdmin-Pro, and manage quarantined messages via menu
2014-09-30 10:13:21 -05:00
< code > System -> Quarantined Mails< / code > . Choose action in drop-down menu list to release
or delete them.< / p >
< p > Screenshots attached at the bottom.< / p >
2016-04-03 08:20:59 -05:00
< h3 id = "notify-users-about-quarantined-mails" > Notify users about quarantined mails< / h3 >
< div class = "admonition note" >
< p class = "admonition-title" > Note< / p >
< p > This feature requires you to enable self-service for mail domain -- you can
enable it in domain profile page.< / p >
< / div >
< p > iRedAdmin-Pro ships a script you can run to notify users about quarantined
mails: < code > tools/notify_quarantined_recipients.py< / code > .< / p >
< p > The notification email is read from template file
< code > tools/notify_quarantined_recipients.html< / code > , you're free to modify it to match
your needs. (don't forget to backup it before upgrading iRedAdmin-Pro.)< / p >
< p > The notification email will show the link of iRedAdmin-Pro so that users can
click it and login to manage quarantined mails. You must change the URL by
adding below parameter with proper URL in iRedAdmin-Pro config file:< / p >
< pre > < code > NOTIFICATION_IREDADMIN_URL = 'https://[your_server]/iredadmin/'
< / code > < / pre >
< p > To notify user, please add a cron job to run
< code > tools/notify_quarantined_recipients.py< / code > . for example, every 6 hours:< / p >
< pre > < code > 1 */12 * * * python /path/to/tools/notify_quarantined_recipients.py > /dev/null
< / code > < / pre >
< p > Don't forget to use the correct path to < code > notify_quarantined_recipients.py< / code > on your server.< / p >
< p > You can also run this script manually to notify users. for example, on RHEL/CentOS:< / p >
< pre > < code > cd /var/www/iredadmin/tools/
python notify_quarantined_recipients.py
< / code > < / pre >
2014-09-30 10:13:21 -05:00
< h2 id = "quarantine-clean-emails" > Quarantine clean emails< / h2 >
2015-06-09 09:55:45 -05:00
< p > Note: If you just want to quarantine clean emails sent from/to certain local
user, please refer to this document instead:
< a href = "./quarantine.clean.mails.per-user.html" > Quarantine clean emails sent from/to certain local user< / a > < / p >
2014-09-30 10:13:21 -05:00
< p > If you want to quarantine clean emails into SQL database for further approval
2014-10-10 10:51:42 -05:00
or whatever reason, please follow below steps:< / p >
2014-10-10 10:56:19 -05:00
< ul >
2014-10-10 10:51:42 -05:00
< li > Update below parameters in Amavisd config file < code > amavisd.conf< / code > :< / li >
2014-10-10 10:56:19 -05:00
< / ul >
2014-10-10 10:51:42 -05:00
< pre > < code class = "perl" > $clean_quarantine_method = 'sql:';
2014-09-30 10:13:21 -05:00
$clean_quarantine_to = 'clean-quarantine';
< / code > < / pre >
2014-10-10 10:56:19 -05:00
< ul >
2016-01-12 01:48:10 -06:00
< li > Find policy bank < code > ORIGINATING< / code > , append two lines in this policy bank:< / li >
2014-10-10 10:56:19 -05:00
< / ul >
2016-01-12 01:48:10 -06:00
< pre > < code class = "perl" > $policy_bank{'ORIGINATING'} = {
2014-09-30 10:13:21 -05:00
...
clean_quarantine_method => 'sql:',
final_destiny_by_ccat => {CC_CLEAN, D_DISCARD},
}
< / code > < / pre >
2014-10-10 10:56:19 -05:00
< ul >
2014-09-30 10:13:21 -05:00
< li > Restart Amavisd service.< / li >
2014-10-10 10:56:19 -05:00
< / ul >
2014-09-30 10:13:21 -05:00
< 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 >
2014-10-13 05:03:19 -05:00
< p > < img alt = "" src = "../images/iredadmin/system_maillog_quarantined.png" / > < / p >
2014-09-30 10:13:21 -05:00
< ul >
< li > Expand quarantined mail to view mail body and headers.< / li >
< / ul >
2016-05-19 06:51:20 -05:00
< p > < img alt = "" src = "../images/iredadmin/system_maillog_quarantined_expanded.png" / > < / p > < div class = "footer" >
< p style = "text-align: center; color: grey;" > All documents are available in < a href = "https://bitbucket.org/zhb/iredmail-docs/src" > BitBucket repository< / a > , and published under < a href = "http://creativecommons.org/licenses/by-nd/3.0/us/" target = "_blank" > Creative Commons< / a > license. You can < a href = "https://bitbucket.org/zhb/iredmail-docs/get/tip.tar.bz2" > download the latest version< / a > for offline reading. If you found something wrong, please do < a href = "http://www.iredmail.org/contact.html" > contact us< / a > to fix it.< / p >
< / div >
< script type = "text/javascript" >
2015-02-05 07:02:53 -06:00
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-3293801-21', 'auto');
ga('send', 'pageview');
2014-10-13 19:28:43 -05:00
< / script >
< / body > < / html >