New: howto/2-quarantine.clean.mails.per-user.md.

This commit is contained in:
Zhang Huangbin 2015-06-09 22:55:45 +08:00
parent b0fecbd699
commit 076c5731f8
5 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,71 @@
# Quarantine clean emails sent from/to certain local user
Update [Amavisd config file](./file.locations.html#amavisd), ask it to listen on one additional network port
`10030` (you're free to use another port), and one additional `policy_bank`:
```
$inet_socket_port = [10024, 9998, 10030];
$interface_policy{'10030'} = 'QUARANTINE';
$policy_bank{'QUARANTINE'} = {
clean_quarantine_method => 'sql:',
final_destiny_maps_by_ccat => {CC_CLEAN, D_DISCARD},
};
$clean_quarantine_to = 'clean-quarantine';
```
Restart Amavisd service.
* Append below content to Postfix config file `/etc/postfix/master.cf`, ask
Postfix to listen on one additional network port `10026` (you're free to use
another port):
```
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
```
* Restart Postfix service.
```
service postfix restart
```
* To quarantine all emails sent from/to `user@domain.com`, set its per-user
transport to `smtp:[127.0.0.1]:10026`.
Now all emails sent from/to `user@domain.com` will be quarantined into SQL
database (specified in Amavisd config file, parameter `@storage_sql_dsn`).
Send an email to `user@domain.com` for testing:
```
# echo "mail body" | mail -s "test subject" user@domain.com
```
## See also
* [Quarantining](./quarantining.html)

View File

@ -104,6 +104,10 @@ Screenshots attached at the bottom.
## Quarantine clean emails
Note: If you just want to quarantine clean emails sent from/to certain local
user, please refer to this document instead:
[Quarantine clean emails sent from/to certain local user](./quarantine.clean.mails.per-user.html)
If you want to quarantine clean emails into SQL database for further approval
or whatever reason, please follow below steps:

View File

@ -62,6 +62,7 @@
<li><a href="enable.smtps.html">Enable SMTPS service (SMTP over SSL, port 465)</a></li>
<li><a href="disable.spam.virus.scanning.for.outgoing.mails.html">Disable spam virus scanning for outgoing mails</a></li>
<li><a href="no.x-spam.headers.html">Amavisd + SpamAssassin not working, no mail header (X-Spam-*) inserted.</a></li>
<li><a href="quarantine.clean.mails.per-user.html">Quarantine clean emails sent from/to certain local user</a></li>
<li><a href="quarantining.html">Quarantining</a></li>
<li><a href="sign.dkim.signature.for.new.domain.html">Sign DKIM signature on outgoing emails for new mail domain</a></li>
<li><a href="allow.insecure.pop3.imap.smtp.connections.html">Allow insecure POP3/IMAP/SMTP connections without STARTTLS</a></li>

View File

@ -0,0 +1,87 @@
<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>

View File

@ -110,6 +110,9 @@ web server) is required.</p>
or delete them.</p>
<p>Screenshots attached at the bottom.</p>
<h2 id="quarantine-clean-emails">Quarantine clean emails</h2>
<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>
<p>If you want to quarantine clean emails into SQL database for further approval
or whatever reason, please follow below steps:</p>
<ul>