<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux Mail Server Setup and Howto Guide &#187; SASL</title>
	<atom:link href="http://www.linuxmail.info/category/sasl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.linuxmail.info</link>
	<description>Rapidly deploy Linux based mail solutions today</description>
	<lastBuildDate>Tue, 01 Nov 2011 00:43:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Postfix SMTP Authentication and Dovecot SASL for RHEL/CentOS 6</title>
		<link>http://www.linuxmail.info/postfix-smtp-auth-dovecot-sasl-centos-6/</link>
		<comments>http://www.linuxmail.info/postfix-smtp-auth-dovecot-sasl-centos-6/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 12:28:15 +0000</pubDate>
		<dc:creator>consultant</dc:creator>
				<category><![CDATA[CentOS 6]]></category>
		<category><![CDATA[Dovecot]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[Red Hat Enterprise Linux 6]]></category>
		<category><![CDATA[SASL]]></category>

		<guid isPermaLink="false">http://www.linuxmail.info/?p=406</guid>
		<description><![CDATA[How to enable Postfix SMTP Authentication using Dovecot SASL in Red Hat Enterprise Linux 6 or CentOS 6]]></description>
			<content:encoded><![CDATA[<p><strong>SMTP Authentication (SMTP Auth)</strong> provides an access control mechanism that can be used to allow legitimate users to relay mail while denying relay service to unauthorized users, such as spammers.</p>
<span id="more-406"></span>
<div class="post-info-spacing"><script type="text/javascript">google_ad_client="pub-3384844279561399";google_ad_slot="5340126843";google_ad_width=336;google_ad_height=280;</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>

<h2>Configure Postfix and Dovecot</h2>
<div class="clearfix steps"><a href="/images/centos-6/edit-dovecot-master-conf.png"><img class="preview" alt="Edit dovecot 10-master.conf" src="/images/centos-6/t-edit-dovecot-master-conf.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a><div>1. Edit the file <em>/etc/dovecot/conf.d/10-master.conf</em> and make sure your <em>service auth</em> section has the lines below.</div>
<div class="m">
<pre class="steps">
service auth {	
  unix_listener /var/spool/postfix/private/auth {
	mode = 0666
	user = postfix
	group = postfix
  }	
}
</pre>
</div>
</div>
<div class="clearfix steps"><a href="/images/centos-6/edit-dovecot-auth-conf.png"><img class="preview" alt="Edit dovecot 10-auth.conf" src="/images/centos-6/t-edit-dovecot-auth-conf.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a><div>2. Edit the file <em>/etc/dovecot/conf.d/10-auth.conf</em> and update the line below.</div>
<div class="m">
<pre class="steps">
auth_mechanisms = plain login
</pre>
</div>
</div>
<div class="clearfix steps"><a href="/images/centos-5/edit-main-cf-dovecot-sasl.png"><img class="preview" alt="Edit main.cf" src="/images/centos-5/t-edit-main-cf-dovecot-sasl.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>3. Edit <em>/etc/postfix/main.cf</em>, find the keys below and change its values as follows or add it at the bottom of the file if the key (the word before the = sign) cannot be found.
<pre class="steps">
mynetworks = 127.0.0.0/8
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =  permit_mynetworks, 
    permit_sasl_authenticated, 
    reject_unauth_destination
broken_sasl_auth_clients = yes
</pre>
</div>
<div>The first line says trust only localhost, meaning only localhost can send email outside the network (relay). The last line is there to support old clients like Microsoft Outlook Express 4.0 and Microsoft Exchange 5.0 just in case someone is still using it.</div>
<div>&nbsp;</div>
<div>Lines starting with <tt>#</tt> are comments. Save the file after completing your changes.</div>
<div>&nbsp;</div>
<div class="clearfix steps"><a href="/images/centos-6/terminal-semodule-postfixdovecotsasl.png"><img class="preview" alt="Install postfixdovecotsasl.te" src="/images/centos-6/t-terminal-semodule-postfixdovecotsasl.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>4. Configure SELinux using the commands below. Here&#8217;s the content of <a href="/files/rhel6/postfixdovecotsasl.te">postfixdovecotsasl.te</a></div>
<div class="clearfix steps">
<pre class="steps">
wget linuxmail.info/files/rhel6/postfixdovecotsasl.te
checkmodule -M -m -o postfixdovecotsasl.mod postfixdovecotsasl.te
semodule_package -o postfixdovecotsasl.pp -m postfixdovecotsasl.mod
semodule -i postfixdovecotsasl.pp
</pre>
</div>
<div class="clearfix steps"><a href="/images/centos-6/service-config-2.png"><img class="preview" alt="Service Configuration" src="/images/centos-6/t-service-config-2.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>5. Restart the Dovecot and Postfix service. But if you installed MailScanner, restart MailScanner instead of Postfix. <a href="/how-to-start-stop-services-centos-6/">Learn how to restart services here.</a></div>
<h2 id="test-postfix">Test Postfix</h2>
<div class="clearfix steps"><a href="/images/centos-5/telnet-smtp-sasl.png"><img class="preview" alt="Terminal" src="/images/centos-5/t-telnet-smtp-sasl.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>In a <strong>Terminal</strong> window, type in the highlighted commands below.</div>
<p>Sample postfix session</p>
<pre class="steps">
[root@mail ~]# <span class="h">telnet mail smtp</span>
</pre>
<p><img class="icon32x32 left" alt="Important" src="/images/emblem-important.png" />Replace <strong>mail</strong> with the name of your server. We should not use localhost since localhost is a trusted client ip address. And make sure the domain name you specified does not resolve to 127.0.0.1 which is the IP address of localhost.</p>
<pre class="steps">
Trying 192.168.0.1...
Connected to mail.acme.local (192.168.0.1).
Escape character is '^]'.
220 mail.acme.local ESMTP Postfix
<span class="h">ehlo localhost</span>
250-mail.acme.local
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
</pre>
<p>Note the new <tt>250-AUTH</tt> lines. See the old <a href="/postfix-smtp-server-howto-centos-6/#test-postfix">SMTP Telnet Test</a>.</p>
<pre class="steps">
<span class="h">mail from:&lt;johndoe&gt;</span>
250 2.1.0 Ok
<span class="h">rcpt to:&lt;test@example.com&gt;</span>
554 5.7.1 &lt;test@example.com&gt;: Relay access denied
</pre>
<p>It works, now to check if we can send it after authenticating.</p>
<pre class="steps">
<span class="h">auth plain AGpvaG5kb2UAcGFzc3dvcmQ=</span>
235 2.0.0 Authentication successful
<span class="h">rcpt to:&lt;test@example.com&gt;</span>
250 2.1.5 Ok
<span class="h">quit</span>
221 2.0.0 Bye
Connection closed by foreign host.
[root@mail ~]#
</pre>
<p><img class="icon32x32 left" alt="Note" src="/images/emblem-note.png" />You can send to email addresses belonging to your domain without authentication. This is normal as it enables you to receive mail from the outside.</p>
<p>The gibberish text after <strong>AUTH PLAIN</strong> is the base64 encoded value of the user name <em>johndoe</em> and password <em>password</em>. You can generate your own base64 text using the form below.</p>
<form name="base64Form" action="">
<label for="username" style="display: block; width: 9em; float: left">User Name:</label><input type="text" name="username" id="username" style="width: 25em" /><br />
<label for="password" style="display: block; width: 9em; float: left">Password:</label><input type="password" name="password" id="password" style="width: 25em" /><br />
<br />
<input type="button" value="Encode" style="margin-left: 18em" onclick="document.base64Form.result.value=base64('\0' + document.base64Form.username.value + '\0' + document.base64Form.password.value);" /><br />
<br />
<label for="result" style="display: block; width: 9em; float: left">Result:</label><input type="text" name="result" id="result" readonly="readonly" style="width: 25em" />
<br /><br />
</form>
<p><img class="icon32x32 left" alt="Note" src="/images/emblem-note.png" />If you encounter any problems, check the log file at <em>/var/log/maillog.</em></p>
<div>&nbsp;</div>
<div class="left">&laquo;&laquo; Previous: <a href="/install-setup-dovecot-centos-6/">How to Setup Dovecot</a></div><div class="right">Next: <a href="/squirrelmail-webmail-setup-howto-centos-6/">How to Install SquirrelMail</a> &raquo;&raquo;</div>
<div class="clear">&nbsp;</div>
<script type="text/javascript">function base64(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i< input.length);return output;}</script>]]></content:encoded>
			<wfw:commentRss>http://www.linuxmail.info/postfix-smtp-auth-dovecot-sasl-centos-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix SMTP Authentication and Dovecot SASL</title>
		<link>http://www.linuxmail.info/postfix-smtp-auth-dovecot-sasl/</link>
		<comments>http://www.linuxmail.info/postfix-smtp-auth-dovecot-sasl/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 08:42:02 +0000</pubDate>
		<dc:creator>consultant</dc:creator>
				<category><![CDATA[CentOS 5]]></category>
		<category><![CDATA[Dovecot]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[Red Hat Enterprise Linux 5]]></category>
		<category><![CDATA[SASL]]></category>
		<category><![CDATA[Ubuntu 10.04]]></category>

		<guid isPermaLink="false">http://www.linux-mail.info/postfix-smtp-auth-dovecot-sasl/</guid>
		<description><![CDATA[How to enable Postfix SMTP Authentication using Dovecot SASL]]></description>
			<content:encoded><![CDATA[<p><strong>SMTP Authentication (SMTP Auth)</strong> provides an access control mechanism that can be used to allow legitimate users to relay mail while denying relay service to unauthorized users, such as spammers.</p>
<span id="more-64"></span>
<div class="post-info-spacing"><script type="text/javascript">google_ad_client="pub-3384844279561399";google_ad_slot="5340126843";google_ad_width=336;google_ad_height=280;</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>

<p>Thanks to the new SASL support in Dovecot 1.0 and the new Dovecot SASL support in Postfix 2.3, setting up SMTP authentication is now easier. Instead of setting up two separate authentication for Postfix and Dovecot, we can now just setup the authentication in Dovecot and just let Postfix talk to Dovecot.</p>
<h2>Configure Postfix and Dovecot</h2>
<div class="clearfix steps"><a href="/images/centos-5/edit-dovecot-conf-sasl.png"><img class="preview" alt="Edit dovecot.conf" src="/images/centos-5/t-edit-dovecot-conf-sasl.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a><div>1. Edit the file <em>/etc/dovecot.conf</em> and make sure your <em>auth default</em> section has the lines below.</div>
<div class="m">
<pre class="steps">
auth default {	
  socket listen {
    client {
	  path = /var/spool/postfix/private/auth
	  mode = 0660
	  user = postfix
	  group = postfix
    }
  }	
  mechanisms = plain login
}
</pre>
<p><img class="icon32x32 left" alt="Note" src="/images/emblem-note.png" />If you are using Ubuntu, edit <em>/etc/dovecot/dovecot.conf</em>.</p>
</div>
</div>
<div class="clearfix steps"><a href="/images/centos-5/edit-main-cf-dovecot-sasl.png"><img class="preview" alt="Edit main.cf" src="/images/centos-5/t-edit-main-cf-dovecot-sasl.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>2. Edit <em>/etc/postfix/main.cf</em>, find the keys below and change its values as follows or add it at the bottom of the file if the key (the word before the = sign) cannot be found.</div>
<pre class="steps">
mynetworks = 127.0.0.0/8
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =  permit_mynetworks, 
    permit_sasl_authenticated, reject_unauth_destination
broken_sasl_auth_clients = yes
</pre>
<div>The first line says trust only localhost, meaning only localhost can send email outside the network (relay). The last line is there to support old clients like Microsoft Outlook Express 4.0 and Microsoft Exchange 5.0 just in case someone is still using it.</div>
<div>&nbsp;</div>
<div>Lines starting with <tt>#</tt> are comments. Save the file after completing your changes.</div>
<div>&nbsp;</div>
<div class="clearfix steps"><a href="/images/centos-5/service-config-2.png"><img class="preview" alt="Service Configuration" src="/images/centos-5/t-service-config-2.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>3. Restart the Dovecot and Postfix service. But if you installed MailScanner, restart MailScanner instead of Postfix.</div>
<h2 id="test-postfix">Test Postfix</h2>
<div class="clearfix steps"><a href="/images/centos-5/telnet-smtp-sasl.png"><img class="preview" alt="Terminal" src="/images/centos-5/t-telnet-smtp-sasl.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>In a <strong>Terminal</strong> window, type in the highlighted commands below.</div>
<p>Sample postfix session</p>
<pre class="steps">
[root@mail ~]# <span class="h">telnet mail smtp</span>
</pre>
<p><img class="icon32x32 left" alt="Important" src="/images/emblem-important.png" />Replace <strong>mail</strong> with the name of your server. We should not use localhost since localhost is a trusted client ip address. And make sure the domain name you specified does not resolve to 127.0.0.1 which is the IP address of localhost.</p>
<pre class="steps">
Trying 192.168.0.1...
Connected to mail.acme.local (192.168.0.1).
Escape character is '^]'.
220 mail.acme.local ESMTP Postfix
<span class="h">ehlo localhost</span>
250-mail.acme.local
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
</pre>
<p>Note the new <tt>250-AUTH</tt> lines. See the old <a href="/postfix-smtp-server-howto-centos-5/#test-postfix">SMTP Telnet Test</a>.</p>
<pre class="steps">
<span class="h">mail from:&lt;johndoe&gt;</span>
250 2.1.0 Ok
<span class="h">rcpt to:&lt;test@example.com&gt;</span>
554 5.7.1 &lt;test@example.com&gt;: Relay access denied
</pre>
<p>It works, now to check if we can send it after authenticating.</p>
<pre class="steps">
<span class="h">auth plain AGpvaG5kb2UAcGFzc3dvcmQ=</span>
235 2.0.0 Authentication successful
<span class="h">rcpt to:&lt;test@example.com&gt;</span>
250 2.1.5 Ok
<span class="h">quit</span>
221 2.0.0 Bye
Connection closed by foreign host.
[root@mail ~]#
</pre>
<p><img class="icon32x32 left" alt="Note" src="/images/emblem-note.png" />You can send to email addresses belonging to your domain without authentication. This is normal as it enables you to receive mail from the outside.</p>
<p>The gibberish text after <strong>AUTH PLAIN</strong> is the base64 encoded value of the user name <em>johndoe</em> and password <em>password</em>. You can generate your own base64 text using the form below.</p>
<form name="base64Form" action="">
<label for="username" style="display: block; width: 9em; float: left">User Name:</label><input type="text" name="username" id="username" style="width: 25em" /><br />
<label for="password" style="display: block; width: 9em; float: left">Password:</label><input type="password" name="password" id="password" style="width: 25em" /><br />
<br />
<input type="button" value="Encode" style="margin-left: 18em" onclick="document.base64Form.result.value=base64('\0' + document.base64Form.username.value + '\0' + document.base64Form.password.value);" /><br />
<br />
<label for="result" style="display: block; width: 9em; float: left">Result:</label><input type="text" name="result" id="result" readonly="readonly" style="width: 25em" />
<br /><br />
</form>
<p><img class="icon32x32 left" alt="Note" src="/images/emblem-note.png" />If you encounter any problems, check the log file at <em>/var/log/maillog</em> (<em>mail.log</em> in Ubuntu).</p>
<div>&nbsp;</div>
<div class="left">&laquo;&laquo; Previous: <a href="/install-setup-dovecot-centos-5/">How to Setup Dovecot</a></div><div class="right">Next: <a href="/squirrelmail-webmail-setup-howto-in-centos-5/">How to Install SquirrelMail</a> &raquo;&raquo;</div>
<div class="clear">&nbsp;</div>
<script type="text/javascript">function base64(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i< input.length);return output;}</script>]]></content:encoded>
			<wfw:commentRss>http://www.linuxmail.info/postfix-smtp-auth-dovecot-sasl/feed/</wfw:commentRss>
		<slash:comments>123</slash:comments>
		</item>
		<item>
		<title>Active Directory and Cyrus SASL Authentication</title>
		<link>http://www.linuxmail.info/active-directory-cyrus-sasl-authentication/</link>
		<comments>http://www.linuxmail.info/active-directory-cyrus-sasl-authentication/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 23:17:00 +0000</pubDate>
		<dc:creator>consultant</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[CentOS 5]]></category>
		<category><![CDATA[Kerberos]]></category>
		<category><![CDATA[Red Hat Enterprise Linux 5]]></category>
		<category><![CDATA[SASL]]></category>

		<guid isPermaLink="false">http://www.linux-mail.info/active-directory-cyrus-sasl-authentication/</guid>
		<description><![CDATA[How to configure Cyrus SASL to authenticate to an Active Directory server using the Kerberos network authentication protocol and Linux PAM.]]></description>
			<content:encoded><![CDATA[<p>The Postfix Cyrus SASL support is used to authenticate remote SMTP clients to the Postfix SMTP server. Thanks to the Pluggable Authentication Modules (PAM) in Linux, we can configure Cyrus SASL to delegate the authentication process to an Active Directory server.</p>
<span id="more-63"></span>
<div class="post-info-spacing"><script type="text/javascript">google_ad_client="pub-3384844279561399";google_ad_slot="5340126843";google_ad_width=336;google_ad_height=280;</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>

<h2>Setup and Configure Kerberos</h2>
<p>The steps below describes how to configure Kerberos using the GUI tool. You can apply the changes manually by editing the file <em>/etc/krb5.conf</em>.</p>
<p><img class="icon32x32 left" alt="Important" src="/images/emblem-important.png" />The Kerberos network authentication protocol requires the clocks of the involved machines to be synchronized or at least the difference is less than 5 minutes.</p>
<div class="clearfix steps"><a href="/images/centos-5/authentication.png"><img class="preview" alt="Authentication" src="/images/centos-5/t-authentication.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>1. Click <em>System</em>, select <em>Administration</em> and click <em>Authentication</em>. This will launch the <strong>Authentication Configuration</strong> window.</div>
<div class="clearfix steps"><a href="/images/centos-5/auth-config-a.png"><img class="preview" alt="Authentication" src="/images/centos-5/t-auth-config-a.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>2. Click the <em>Authentication</em> tab and check the <em>Enable Kerberos Support</em>. Next, click the <em>Configure Kerberos</em> button.</div>
<div class="clearfix steps"><a href="/images/centos-5/kerberos-settings.png"><img class="preview" alt="Kerberos Settings" src="/images/centos-5/t-kerberos-settings.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>3. In the <strong>Kerberos Settings</strong> window, fill in the <em>Realm</em>, clear out <em>KDC</em> and <em>Admin Servers</em> and check the <em>Use DNS to locate KDCs for realms</em>. Realm is usually your domain name capitalized, <em>capitalization is important.</em> KDC is your Active Directory server. Click <em>Ok</em> when you&#8217;re done.</div>
<p><img class="icon32x32 left" alt="Note" src="/images/emblem-note.png" />To make sure that your KDC can be automatically located, type in the command <tt>host -t any _kerberos._tcp.acme.local</tt> in a terminal window. Replace <em>acme.local</em> with your own realm. If it replies &#8220;_kerberos._tcp.acme.local has SRV record &#8230;&#8221; then it works, otherwise you&#8217;ll have to fill in the KDC field above. This is how the Windows workstation is able to find the domain controller during domain logon.</p>
<div class="clearfix steps"><a href="/images/centos-5/auth-config-b.png"><img class="preview" alt="Authentication" src="/images/centos-5/t-auth-config-b.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>4. Uncheck the <em>Enable Kerberos Support</em> and click <em>Ok</em>. We don&#8217;t actually want to use Kerberos authentication in Linux, we just want the tool to setup Kerberos for us.</div>
<div class="clearfix steps"><a href="/images/centos-5/terminal-kinit.png"><img class="preview" alt="Terminal" src="/images/centos-5/t-terminal-kinit.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>5. Test Kerberos by typing in <tt>kinit username</tt> in a terminal window. If you need help in making sense of the kinit error messages, check out <a href="/troubleshooting-active-directory-centos-5/#test-kerberos">Test the Kerberos Authentication</a>.</div>
<h2>Configuring Cyrus SASL</h2>
<div class="clearfix steps"><a href="/images/centos-5/edit-pam-smtp-postfix.png"><img class="preview" alt="Edit pam dovecot" src="/images/centos-5/t-edit-pam-smtp-postfix.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>1. Edit the file <em>/etc/pam.d/smtp</em> and replace the content with the lines below.
<pre class="steps">
auth     sufficient pam_krb5.so no_user_check validate
account  sufficient pam_permit.so
</pre>
</div>
<div class="clearfix steps"><a href="/images/centos-5/service-config-saslauthd.png"><img class="preview" alt="Service Configuration" src="/images/centos-5/t-service-config-saslauthd.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>2. Restart the saslauthd service.</div>
<div class="clearfix steps"><a href="/images/centos-5/terminal-testsaslauthd.png"><img class="preview" alt="Terminal" src="/images/centos-5/t-terminal-testsaslauthd.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>3. Test saslauthd by typing in the command below in a terminal window.
<pre class="steps">
testsaslauthd -u <em>username</em> -p <em>password</em> -s smtp
</pre>
</div>
<p>Cyrus SASL is now configured to authenticate against an Active Directory server. Proceed to <a href="/smtp-authentication-postfix-centos-5/">Postfix SMTP Authentication</a> for instructions on configuring Postfix. Or restart Postfix or MailScanner and jump directly to the <a href="/smtp-authentication-postfix-centos-5/#test-postfix">Test Postfix using Telnet</a> part if you have already done so.</p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxmail.info/active-directory-cyrus-sasl-authentication/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SMTP Authentication (SMTP Auth) in Postfix</title>
		<link>http://www.linuxmail.info/smtp-authentication-postfix-centos-5/</link>
		<comments>http://www.linuxmail.info/smtp-authentication-postfix-centos-5/#comments</comments>
		<pubDate>Mon, 23 Apr 2007 06:25:52 +0000</pubDate>
		<dc:creator>consultant</dc:creator>
				<category><![CDATA[Postfix]]></category>
		<category><![CDATA[SASL]]></category>

		<guid isPermaLink="false">http://www.linux-mail.info/smtp-authentication-postfix-centos-5/</guid>
		<description><![CDATA[How to enable Postfix SMTP Authentication in Red Hat Enterprise Linux 5 or CentOS 5]]></description>
			<content:encoded><![CDATA[<p>Enabling SMTP authentication in Postfix ensures that only users with valid accounts can send email outside your network (relaying). This prevents spammers from using your SMTP server as a spam broadcast station. Here&#8217;s how to do it in Postfix.</p>
<span id="more-35"></span>
<div class="post-info-spacing"><script type="text/javascript">google_ad_client="pub-3384844279561399";google_ad_slot="5340126843";google_ad_width=336;google_ad_height=280;</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>

<p><img class="icon32x32 left" alt="Note" src="/images/emblem-note.png" />If you are using Red Hat Enterprise Linux 5 or CentOS 5, please read <a href="/postfix-smtp-auth-dovecot-sasl/">Postfix SMTP Authentication and Dovecot SASL</a> instead. It&#8217;s a lot easier to setup and you won&#8217;t have to duplicate your Dovecot authentication setup into SASL.</p>
<h2>Configure SASL</h2>
<div class="clearfix steps"><a href="/images/centos-5/edit-sasl2-conf.png"><img class="preview" alt="SASL2 Configuration" src="/images/centos-5/t-edit-sasl2-conf.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a><div class="m">1. Edit the file <em>/usr/lib/sasl2/smtpd.conf</em> (<em>/usr/lib64/sasl2/smtpd.conf</em> for 64-bit users) and add the line below to the bottom of the file 
<pre class="steps">
mech_list: PLAIN LOGIN
</pre>
</div>
</div>
<div class="clearfix steps"><a href="/images/centos-5/service-config-saslauthd.png"><img class="preview" alt="Service Configuration" src="/images/centos-5/t-service-config-saslauthd.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>2. Start the saslauthd service.</div>
<h2>Configure Postfix</h2>
<div class="clearfix steps"><a href="/images/centos-5/file-browser.png"><img class="preview" alt="File Browser" src="/images/centos-5/t-file-browser.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>1. Click <em>Applications</em> then click <em>File Browser</em>. This will launch the <strong>File Browser</strong> window.</div>
<div class="clearfix steps"><a href="/images/centos-5/file-browser-2.png"><img class="preview" alt="File Browser" src="/images/centos-5/t-file-browser-2.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>2. In the <em>Location</em> field, type in <em>/etc/postfix</em> and press Enter.</div>
<div class="clearfix steps"><a href="/images/centos-5/edit-main-cf-sasl.png"><img class="preview" alt="Edit main.cf" src="/images/centos-5/t-edit-main-cf-sasl.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>3. Double click on the file <em>main.cf</em> to open it for editing.</div><div class="clearfix"><div>Find the following keys and change its values as follows or add it at the bottom of the file if the key (the word before the = sign) cannot be found.</div>
<pre class="steps">
mynetworks = 127.0.0.0/8
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =  permit_mynetworks, 
    permit_sasl_authenticated, reject_unauth_destination
broken_sasl_auth_clients = yes
</pre>
<div>The first line says trust only localhost, meaning only localhost can send email outside the network (relay). The last line is there to support old clients like Microsoft Outlook Express 4.0 and Microsoft Exchange 5.0 just in case someone is still using it.</div><div>&nbsp;</div>
<div>Lines starting with <tt>#</tt> are comments. Save the file after completing your changes.</div></div>
<div>&nbsp;</div>
<div class="clearfix steps"><a href="/images/centos-5/service-config-2.png"><img class="preview" alt="Service Configuration" src="/images/centos-5/t-service-config-2.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>4. Restart the Postfix service or the MailScanner service if you have integrated MailScanner into Postfix.</div>
<h2 id="test-postfix">Test Postfix</h2>
<div class="clearfix steps"><a href="/images/centos-5/telnet-smtp-sasl.png"><img class="preview" alt="Terminal" src="/images/centos-5/t-telnet-smtp-sasl.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a>In a <strong>Terminal</strong> window, type in the highlighted commands below.</div>
<p>Sample postfix session</p>
<pre class="steps">
[root@mail ~]# <span class="h">telnet mail smtp</span>
</pre>
<p><img class="icon32x32 left" alt="Important" src="/images/emblem-important.png" />Replace <strong>mail</strong> with the name of your server. We should not use localhost since localhost is a trusted client ip address.</p>
<pre class="steps">
Trying 192.168.0.4...
Connected to mail.acme.local (192.168.0.4).
Escape character is '^]'.
220 mail.acme.local ESMTP Postfix
<span class="h">ehlo host</span>
250-mail.acme.local
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
<span class="hg">250-ENHANCEDSTATUSCODES</span>
250-8BITMIME
<span class="hg">250 DSN</span>
</pre>
<p>Note the new <tt>250-AUTH</tt> lines.</p>
<pre class="steps">
<span class="h">mail from: johndoe</span>
250 <span class="hg">2.1.0</span> Ok
<span class="h">rcpt to: test@domain.local</span>
554 <span class="hg">5.7.1</span> &lt;test@domain.local&gt;: Relay access denied
</pre>
<p>It works, now to check if we can send it after authenticating.</p>
<pre class="steps">
<span class="h">auth plain AGpvaG5kb2UAcGFzc3dvcmQ=</span>
235 <span class="hg">2.0.0</span> Authentication successful
<span class="h">rcpt to: test@domain.local</span>
250 <span class="hg">2.1.5</span> Ok
<span class="h">quit</span>
221 <span class="hg">2.0.0</span> Bye
Connection closed by foreign host.
[root@mail ~]#
</pre>
<p><img class="icon32x32 left" alt="Note" src="/images/emblem-note.png" />Text highlighted in green only appears in Postfix version 2.3 or higher. Postfix version 2.3 is included in Red Hat Enterprise Linux 5 or CentOS 5.</p>
<p><img class="icon32x32 left" alt="Note" src="/images/emblem-note.png" />You can send to email addresses belonging to your domain without authentication. This is normal as it enables you to receive mail from the outside.</p>
<p>The gibberish text after <strong>AUTH PLAIN</strong> is the base64 encoded value of the user name <em>johndoe</em> and password <em>password</em>. You can generate your own base64 text using the form below.</p>
<form name="base64Form" action="">
<label for="username" style="display: block; width: 9em; float: left">User Name:</label><input type="text" name="username" id="username" style="width: 25em" /><br />
<label for="password" style="display: block; width: 9em; float: left">Password:</label><input type="password" name="password" id="password" style="width: 25em" /><br />
<br />
<input type="button" value="Encode" style="margin-left: 18em" onclick="document.base64Form.result.value=base64('\0' + document.base64Form.username.value + '\0' + document.base64Form.password.value);" /><br />
<br />
<label for="result" style="display: block; width: 9em; float: left">Result:</label><input type="text" name="result" id="result" readonly="readonly" style="width: 25em" />
<br /><br />
</form>
<p><img class="icon32x32 left" alt="Note" src="/images/emblem-note.png" />If you encounter any problems, check the log file at <em>/var/log/maillog.</em></p>
<p>&nbsp;</p>
<h2>Related Pages</h2>
<div class="clearfix steps"><a href="/images/centos-5/kerberos-settings.png"><img class="preview" alt="Kerberos Settings" src="/images/centos-5/t-kerberos-settings.png" onmouseover="changeSrc(this)" /><img class="full" alt="" src="/images/busy.gif" /></a><a href="/active-directory-cyrus-sasl-authentication/">Using Active Directory Authentication in Cyrus SASL</a></div>
<script type="text/javascript">function base64(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i< input.length);return output;}</script>]]></content:encoded>
			<wfw:commentRss>http://www.linuxmail.info/smtp-authentication-postfix-centos-5/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>

