iredmail-doc/html/quarantine.clean.mails.per-...

87 lines
3.6 KiB
HTML
Raw Normal View History

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Quarantine clean emails sent from/to certain local user</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="quarantine-clean-emails-sent-fromto-certain-local-user">Quarantine clean emails sent from/to certain local user</h1>
<p>Update <a href="./file.locations.html#amavisd">Amavisd config file</a>, ask it to listen on one additional network port
<code>10030</code> (you're free to use another port), and one additional <code>policy_bank</code>:</p>
<pre><code>$inet_socket_port = [10024, 9998, 10030];
$interface_policy{'10030'} = 'QUARANTINE';
$policy_bank{'QUARANTINE'} = {
clean_quarantine_method =&gt; 'sql:',
final_destiny_maps_by_ccat =&gt; {CC_CLEAN, D_DISCARD},
};
$clean_quarantine_to = 'clean-quarantine';
</code></pre>
<p>Restart Amavisd service.</p>
<ul>
<li>Append below content to Postfix config file <code>/etc/postfix/master.cf</code>, ask
Postfix to listen on one additional network port <code>10026</code> (you're free to use
another port):</li>
</ul>
<pre><code>127.0.0.1:10026 inet n - - - - smtpd
-o content_filter=smtp-amavis:[127.0.0.1]:10030
-o recipient_bcc_maps=
-o sender_bcc_maps=
-o mynetworks_style=host
-o mynetworks=127.0.0.0/8
-o local_recipient_maps=
-o relay_recipient_maps=
-o strict_rfc821_envelopes=yes
-o smtp_tls_security_level=none
-o smtpd_tls_security_level=none
-o smtpd_restriction_classes=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_end_of_data_restrictions=
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings
</code></pre>
<ul>
<li>Restart Postfix service.</li>
</ul>
<pre><code>service postfix restart
</code></pre>
<ul>
<li>To quarantine all emails sent from/to <code>user@domain.com</code>, set its per-user
transport to <code>smtp:[127.0.0.1]:10026</code>.</li>
</ul>
<p>Now all emails sent from/to <code>user@domain.com</code> will be quarantined into SQL
database (specified in Amavisd config file, parameter <code>@storage_sql_dsn</code>).</p>
<p>Send an email to <code>user@domain.com</code> for testing:</p>
<pre><code># echo &quot;mail body&quot; | mail -s &quot;test subject&quot; user@domain.com
</code></pre>
<h2 id="see-also">See also</h2>
<ul>
<li><a href="./quarantining.html">Quarantining</a></li>
</ul><p style="text-align: center; color: grey;">Document published under a <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">CC BY-ND 3.0</a> license. If you found something wrong, please do <a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script>
(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');
</script>
</body></html>