iredmail-doc/html_bk/allow.user.to.send.email.wi...

87 lines
4.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Allow user to send email without smtp authentication</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><h1 id="allow-user-to-send-email-without-smtp-authentication">Allow user to send email without smtp authentication</h1>
<div class="toc">
<ul>
<li><a href="#allow-user-to-send-email-without-smtp-authentication">Allow user to send email without smtp authentication</a><ul>
<li><a href="#postfix">Postfix</a></li>
<li><a href="#iredapd">iRedAPD</a></li>
<li><a href="#references">References</a></li>
</ul>
</li>
</ul>
</div>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>This tutorial is applicable to iRedMail-0.9.9 and earlier releases. If
you're running a later release, please follow
<a href="./allow.send.without.smtp.auth.html">this tutorial</a> instead.</p>
</div>
<h2 id="postfix">Postfix</h2>
<p>Create a plain text file: <code>/etc/postfix/sender_access.pcre</code>, list all
users' email addresses which are allowed to send email without smtp
authentication. We use user email address <code>user@example.com</code> for example:</p>
<pre><code>/^user@example\.com$/ OK
</code></pre>
<p>It's ok to use IP address instead like below:</p>
<blockquote>
<p>For more allowed sender format, please check Postfix manual page: <a href="http://www.postfix.org/access.5.html">access(5)</a>.</p>
</blockquote>
<pre><code>/^192\.168\.1\.1$/ OK
/^192\.168\.2\./ OK
/^172\.16\./ OK
</code></pre>
<p>Update Postfix config file <code>/etc/postfix/main.cf</code> to use this pcre file:</p>
<pre><code>smtpd_sender_restrictions =
check_sender_access pcre:/etc/postfix/sender_access.pcre,
[...OTHER RESTRICTIONS HERE...]
</code></pre>
<p>Restart/reload postfix to make it work:</p>
<pre><code># /etc/init.d/postfix restart
</code></pre>
<h2 id="iredapd">iRedAPD</h2>
<p>iRedAPD plugin <code>reject_sender_login_mismatch</code> will check forged sender address.
If sender domain is hosted on your server, but no smtp auth, it will be
considered as a forged email. In this case, iRedAPD will reject this email
(with rejection message: <code>Policy rejection not logged in</code>), so we need to
bypass the sender email address. If email is sent from an internal network
device like printer, fax, we can also its IP address directly.</p>
<ul>
<li>To bypass sender email address <code>user@example.com</code>, please add setting in
<code>/opt/iredapd/settings.py</code> like below:</li>
</ul>
<pre><code>ALLOWED_FORGED_SENDERS = ['user@example.com']
</code></pre>
<ul>
<li>To bypass sender IP address or network, for example, <code>192.168.0.1</code> and
<code>192.168.1.0/24</code>, please add setting in <code>/opt/iredapd/settings.py</code> like below:</li>
</ul>
<pre><code>MYNETWORKS = ['192.168.0.1', '192.168.1.0/24']
</code></pre>
<p>Restarting iRedAPD service is required if you updated <code>/opt/iredapd/settings.py</code>.</p>
<h2 id="references">References</h2>
<ul>
<li>Postfix documents:<ul>
<li><a href="http://www.postfix.org/postconf.5.html#check_sender_access">check_sender_access</a></li>
<li>Manual page: <a href="http://www.postfix.org/access.5.html">access(5)</a></li>
<li>Manual page: <a href="http://www.postfix.org/pcre_table.5.html">pcre_table(5)</a></li>
</ul>
</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>