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

86 lines
4.0 KiB
HTML

<!DOCTYPE html>
<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 rel="stylesheet" type="text/css" href="./css/markdown.css" />
</head>
<body>
<div id="navigation">
<a href="https://www.iredmail.org" target="_blank">
<img alt="iRedMail web site"
src="./images/logo-iredmail.png"
style="vertical-align: middle; height: 30px;"
/>&nbsp;
<span>iRedMail</span>
</a>
&nbsp;&nbsp;//&nbsp;&nbsp;<a href="./index.html">Document Index</a></div><div class="admonition note">
<p class="admonition-title">This tutorial is available in other languages. <a href="https://github.com/iredmail/docs">Help translate more</a></p>
<p><a href="./quarantine.clean.mails.per-user-it_IT.html">Italiano</a> /</p>
</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>10031</code> (you're free to use
another port):</li>
</ul>
<pre><code>127.0.0.1:10031 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]:10031</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>
<li><a href="./per-account.transport.html">Per-domain or per-user transport (relay)</a></li>
</ul><div class="footer">
<p style="text-align: center; color: grey;">All documents are available in <a href="https://github.com/iredmail/docs/">GitHub 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://github.com/iredmail/docs/archive/master.zip">download the latest version</a> for offline reading. If you found something wrong, please do <a href="https://www.iredmail.org/contact.html">contact us</a> to fix it.</p>
</div></body></html>