<?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>snydersoft.com &#187; linux</title>
	<atom:link href="http://snydersoft.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://snydersoft.com</link>
	<description>Sharing Web Development Information</description>
	<lastBuildDate>Tue, 15 Feb 2011 12:51:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Setting up SMTP AUTH under RedHat 7.3 (Linux)</title>
		<link>http://snydersoft.com/2008/10/14/setting-up-smtp-auth-under-redhat-73-linux/</link>
		<comments>http://snydersoft.com/2008/10/14/setting-up-smtp-auth-under-redhat-73-linux/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 17:17:38 +0000</pubDate>
		<dc:creator>Jeremy Snyder</dc:creator>
				<category><![CDATA[Linux Tips]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[auth]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sendmail]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://snydersoft.com/?p=156</guid>
		<description><![CDATA[I recently had to configure a Linux machine to require SMTP AUTH so that we could test a new product at Codonics. So I wanted to provide a little guidance and some insight that I gained while working on this task. The requirement was &#8220;basic&#8221; SMTP AUTH&#8230; so PLAIN/LOGIN functionality, no need for TLS, and [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to configure a Linux machine to require SMTP AUTH so that we could test a new product at <a href="http://www.codonics.com">Codonics</a>.  So I wanted to provide a little guidance and some insight that I gained while working on this task.</p>
<p>The requirement was &#8220;basic&#8221; SMTP AUTH&#8230; so PLAIN/LOGIN functionality, no need for TLS, and use the existing user accounts on the linux machine.  Local email needs to still function (mail from cmd line) but anything from a &#8220;remote&#8221; user would require a username/password to be verified before allowing the machine to send the email.</p>
<p><strong>Notes:</strong><br />
======<br />
1) need to allow sendmail to talk to more than just localhost (allow network connections)<br />
    &#8211; firewall (open ports, or disable for testing)<br />
    &#8211; &#8220;dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA&#8217;)&#8221; line in the sendmail.mc instead of &#8220;DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA&#8217;)&#8221; &#8230;. adding the dnl in front of the command basically comments it out.</p>
<p>2) need to install from source (for our RedHat 7.3 machine, I used these versions):<br />
    &#8211; cyrus-sasl (v1.5.24)<br />
    &#8211; sendmail (8.11.6)<br />
    * these versions were selected because they matched the rpms/version that were already installed on machine.  I needed to be rebuild to provide support for PLAIN and LOGIN AUTH methods&#8230; which I understand are not typically available via RPMs.</p>
<p>3) Important lines in the sendmail.mc:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
    define(`confAUTH_OPTIONS&#8217;, `A&#8217;)dnl<br />
    TRUST_AUTH_MECH(`LOGIN PLAIN&#8217;)dnl<br />
    define(`confAUTH_MECHANISMS&#8217;, `LOGIN PLAIN&#8217;)dnl<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
make sure that none of these have a dnl in front of them&#8230; that would cause them to be ignored (considered comments).</p>
<p>4) There needs to be a file: /usr/lib/sasl/Sendmail.conf (note the upper-case S in filename) with the following line (only line):<br />
    &#8211; &#8220;pwcheck_method: PAM&#8221;</p>
<p>5) Not sure if this is actually required, but during my travels, I found that I need the file /etc/sasldb to exist and it can only be read/writeable by root so:<br />
    &#8211; touch /etc/sasldb (to create it if necessary)<br />
    &#8211; chown root:root /etc/sasldb (to change it to owner/group root)<br />
    &#8211; chmod 600 /etc/sasldb (to ensure that only root user can read/write file)</p>
<p>6) I did confirm that these changes will only require AUTH on connections from external mail clients (doesn&#8217;t affect mail cmd-line on the host).</p>
<p>7) If you want to test via &#8220;telnet host 25&#8243; the sequence of events would be:<br />
    -> EHLO hostname (doesn&#8217;t matter what you use as hostname)<br />
    -> AUTH LOGIN<br />
    <- 334 VXNlcm5hbWU6<br />
    -> anNueWRlcg== (Base64 encoded username, ie: jsnyder thru the base64 encoder)<br />
    <- 334 UGFzc3dvcmQ6<br />
    -> dGVzdGluZw== (Base64 encoded password for username above)<br />
    <- 235 2.0.0 OK Authenticated (this is a good sign... no need to continue)<br />
    -> QUIT</p>
<p>Useful commands:<br />
==============<br />
    &#8211; m4 /etc/mail/sendmail.mc > /etc/sendmail.cf (converts the sendmail.mc file into the necessary sendmail.cf for sendmail to use)</p>
<p>    &#8211; sendmail -d0.1 -bv root (shows if SASL support is available in sendmail in the list of &#8220;Compiled with:&#8221; items)</p>
<p>    &#8211; sendmail -d0.20 -bv (shows location it is expecting sendmail.cf &#8230; &#8220;Def Conf file:&#8221; line).</p>
<p>    &#8211; sendmail -O LogLevel=33 -bs (runs a quick instance of sendmail with logging turned up to level 33, and then you can enter &#8220;ehlo localhost&#8221; and it should give you back the options for the server&#8230; should include the line:  &#8220;250-AUTH LOGIN PLAIN&#8221; when everything is configured correctly).</p>
<p>Helpful Links:<br />
==========<br />
<a href="http://www.jonfullmer.com/smtpauth/saslv1.html">http://www.jonfullmer.com/smtpauth/saslv1.html</a><br />
<a href="http://www.linuxforums.org/forum/servers/5206-smtp-auth-sasl-sendmail-not-getting-along.html">http://www.linuxforums.org/forum/servers/5206-smtp-auth-sasl-sendmail-not-getting-along.html</a><br />
<a href="http://linuxgazette.net/153/misc/lg/smtp_auth_problem.html">http://linuxgazette.net/153/misc/lg/smtp_auth_problem.html</a><br />
<a href="http://www.sendmail.org/~ca/email/cyrus/sysadmin.html">http://www.sendmail.org/~ca/email/cyrus/sysadmin.html</a><br />
<a href="http://lists.freebsd.org/pipermail/freebsd-questions/2003-June/008118.html">http://lists.freebsd.org/pipermail/freebsd-questions/2003-June/008118.html</a><br />
<a href="http://www.sendmail.org/~ca/email/auth.html">http://www.sendmail.org/~ca/email/auth.html</a><br />
<a href="http://www.joreybump.com/code/howto/smtpauth.html">http://www.joreybump.com/code/howto/smtpauth.html</a><br />
<a href="http://linux.derkeiler.com/Mailing-Lists/Fedora/2006-06/msg03793.html">http://linux.derkeiler.com/Mailing-Lists/Fedora/2006-06/msg03793.html</a></p>
<p>Sendmail downloads: <a href="ftp://ftp.sendmail.org/pub/sendmail/past-releases/">ftp://ftp.sendmail.org/pub/sendmail/past-releases/</a></p>
<p>Base64 Encode/Decoder: <a href="http://www.motobit.com/util/base64-decoder-encoder.asp">http://www.motobit.com/util/base64-decoder-encoder.asp</a></p>
<p>Content of my &#8220;sendmail.mc&#8221; file for comparison:<br />
<code><br />
divert(-1)<br />
dnl This is the sendmail macro config file. If you make changes to this file,<br />
dnl you need the sendmail-cf rpm installed and then have to generate a<br />
dnl new /etc/sendmail.cf by running the following command:<br />
dnl<br />
dnl        m4 /etc/mail/sendmail.mc > /etc/sendmail.cf<br />
dnl<br />
include(`/usr/share/sendmail-cf/m4/cf.m4')<br />
VERSIONID(`linux setup for Red Hat Linux')dnl<br />
OSTYPE(`linux')<br />
dnl Uncomment and edit the following line if your mail needs to be sent out<br />
dnl through an external mail server:<br />
dnl define(`SMART_HOST',`smtp.your.provider')<br />
define(`confDEF_USER_ID',``8:12'')dnl<br />
undefine(`UUCP_RELAY')dnl<br />
undefine(`BITNET_RELAY')dnl<br />
define(`LOCAL_RELAY', `mail2.n1.codonics.com')<br />
define(`MAIL_HUB', `mail2.n1.codonics.com.')<br />
define(`SMART_HOST', `mail2.n1.codonics.com')<br />
define(`confAUTO_REBUILD')dnl<br />
define(`confTO_CONNECT', `1m')dnl<br />
define(`confTRY_NULL_MX_LIST',true)dnl<br />
define(`confDONT_PROBE_INTERFACES',true)dnl<br />
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl<br />
define(`ALIAS_FILE', `/etc/aliases')dnl<br />
dnl define(`STATUS_FILE', `/etc/mail/statistics')dnl<br />
define(`UUCP_MAILER_MAX', `2000000')dnl<br />
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl<br />
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl<br />
define(`confAUTH_OPTIONS', `A')dnl<br />
TRUST_AUTH_MECH(`LOGIN PLAIN')dnl<br />
define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl<br />
dnl define(`confTO_QUEUEWARN', `4h')dnl<br />
dnl define(`confTO_QUEUERETURN', `5d')dnl<br />
dnl define(`confQUEUE_LA', `12')dnl<br />
dnl define(`confREFUSE_LA', `18')dnl<br />
dnl FEATURE(delay_checks)dnl<br />
FEATURE(`no_default_msa',`dnl')dnl<br />
FEATURE(`smrsh',`/usr/sbin/smrsh')dnl<br />
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl<br />
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl<br />
FEATURE(redirect)dnl<br />
FEATURE(always_add_domain)dnl<br />
FEATURE(use_cw_file)dnl<br />
FEATURE(use_ct_file)dnl<br />
dnl The '-t' option will retry delivery if e.g. the user runs over his quota.<br />
FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl<br />
FEATURE(`access_db',`hash -o /etc/mail/access.db')dnl<br />
FEATURE(`blacklist_recipients')dnl<br />
EXPOSED_USER(`root')dnl<br />
dnl This changes sendmail to only listen on the loopback device 127.0.0.1<br />
dnl and not on any other network devices. Comment this out if you want<br />
dnl to accept email over the network.<br />
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')<br />
dnl NOTE: binding both IPv4 and IPv6 daemon to the same port requires<br />
dnl       a kernel patch<br />
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')<br />
dnl We strongly recommend to comment this one out if you want to protect<br />
dnl yourself from spam. However, the laptop and users on computers that do<br />
dnl not have 24x7 DNS do need this.<br />
FEATURE(`accept_unresolvable_domains')dnl<br />
dnl FEATURE(`relay_based_on_MX')dnl<br />
MAILER(smtp)dnl<br />
MAILER(procmail)dnl<br />
Cwlocalhost.localdomain<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://snydersoft.com/2008/10/14/setting-up-smtp-auth-under-redhat-73-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.353 seconds -->

