You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by da...@apache.org on 2002/08/30 17:10:42 UTC

cvs commit: jakarta-james/www james_and_sendmail.html

danny       2002/08/30 08:10:41

  Added:       www      james_and_sendmail.html
  Log:
  Added a new page outlining sendmail configuration changes needed to use James as a universal relay for sendmail,
  and links to the page.
  
  Revision  Changes    Path
  1.1                  jakarta-james/www/james_and_sendmail.html
  
  Index: james_and_sendmail.html
  ===================================================================
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <title>Jakarta James - Routing mail from sendmail through James</title>
  <meta value="Danny Angus" name="author">
  <meta value="danny@apache.org" name="email">
  <LINK TITLE="Style" HREF="stylesheet.css" TYPE="text/css" REL="stylesheet">
  </head>
  <body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff">
  <table cellspacing="4" width="100%" border="0">
  <!--PAGE HEADER-->
  <tr>
  <td colspan="2">
  <!--JAKARTA LOGO--><a href="http://jakarta.apache.org/"><img border="0" alt="The Jakarta Project" align="left" src="http://jakarta.apache.org/images/jakarta-logo.gif"></a>
  <!--PROJECT LOGO--><a href="http://jakarta.apache.org/james/"><img border="0" alt="JAMES - Java Apache Mail Enterprise Server" align="right" src="http://jakarta.apache.org/james///images/james-logo.jpg"></a></td>
  </tr>
  <!--HEADER SEPARATOR-->
  <tr>
  <td colspan="2">
  <hr size="1" noshade="">
  </td>
  </tr>
  <tr>
  <!--LEFT SIDE NAVIGATION-->
  <td nowrap="true" valign="top" width="20%">
  <p>
  <strong>James</strong>
  </p>
  <ul>
  <li>
  <a href="./index.html">Overview</a>
  </li>
  <li>
  <a href="./architecture_v2_0.html">Architecture</a>
  </li>
  <li>
  <a href="./FAQ.html">James FAQ</a>
  </li>
  </ul>
  <p>
  <strong>Translated</strong>
  </p>
  <ul>
  <li>
  <a href="http://www.terra-intl.com/jakarta/james/">Japanese (web)</a>
  </li>
  </ul>
  <p>
  <strong>Downloads</strong>
  </p>
  <ul>
  <li>
  <a href="http://jakarta.apache.org/site/binindex.html">Binaries</a>
  </li>
  <li>
  <a href="http://jakarta.apache.org/site/sourceindex.html">Source Code</a>
  </li>
  </ul>
  <p>
  <strong>Documentation</strong>
  </p>
  <ul>
  <li>
  <a href="./install.html">Install</a>
  </li>
  <li>
  <a href="./configuration_v2_0.html">Configuration</a>
  </li>
  <li>
  <a href="./javadocs/index.html">James API</a>
  </li>
  <li>
  <a href="./mailet/index.html">Mailet API</a>
  </li>
  <li>
  <a href="./usingJDBC_v2.0.html">Using JDBC</a>
  </li>
  <li>
  <a href="./usingLDAP_v1_2.html">Using LDAP</a>
  </li>
  <li>
  <a href="./usingTLS_v1_2.html">Using TLS</a>
  </li>
  <li>
  <a href="./james_and_sendmail.html">James and sendmail</a>
  </li>
  <li>
  <a href="http://jakarta.apache.org/james/rfclist">Useful RFCs (web)</a>
  </li>
  </ul>
  <p>
  <strong>Project</strong>
  </p>
  <ul>
  <li>
  <a href="http://jakarta.apache.org/site/bugs.html">Bug Database </a>
  </li>
  <li>
  <a href="./contribute.html">How Can I Contribute?</a>
  </li>
  <li>
  <a href="./code-standards.html">Coding Standards</a>
  </li>
  <li>
  <a href="./license.html">License</a>
  </li>
  <li>
  <a href="./todo.html">TODO</a>
  </li>
  <li>
  <a href="./changelog.html">Changelog</a>
  </li>
  <li>
  <a href="./weare.html">Who We Are</a>
  </li>
  </ul>
  <p>
  <strong>Jakarta Information (web)</strong>
  </p>
  <ul>
  <li>
  <a href="http://jakarta.apache.org/index.html">Front Page</a>
  </li>
  <li>
  <a href="http://jakarta.apache.org/site/news.html">News &amp; Status</a>
  </li>
  <li>
  <a href="http://jakarta.apache.org/site/mail.html">Mailing Lists</a>
  </li>
  <li>
  <a href="http://jakarta.apache.org/site/getinvolved.html">Get Involved</a>
  </li>
  <li>
  <a href="http://jakarta.apache.org/site/cvsindex.html">CVS Repositories</a>
  </li>
  <li>
  <a href="http://jakarta.apache.org/site/library.html">Reference Library</a>
  </li>
  <li>
  <a href="http://jakarta.apache.org/site/faqs.html">FAQs</a>
  </li>
  </ul>
  <p>
  <strong>Related Projects (web)</strong>
  </p>
  <ul>
  <li>
  <a href="http://jakarta.apache.org/ant/index.html">Ant</a>
  </li>
  <li>
  <a href="http://jakarta.apache.org/avalon/index.html">Avalon</a>
  </li>
  </ul>
  </td>
  <!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%">
  <table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
  <td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="The%20problem"><strong>The problem</strong></a></font></td>
  </tr>
  <tr>
  <td>
  <blockquote>
  
    
  <p>
      This document explains how to configure sendmail to route all mail generated by /usr/sbin/sendmail or local mail on a host through James on the same host, including mail to local addresses without @host.<br>
      All sendmail configuration file locations are for Redhat Linux 7.2, other installations may have different locations.<br>
      
  <b>We take no responsibility for the quality of the information in this document. </b>
  <br>
  <b>You should back-up any configuration files *before* you alter them.</b>
    
  </p>
  
  </blockquote>
  </td>
  </tr>
  </table>
  <table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
  <td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Solution"><strong>Solution</strong></a></font></td>
  </tr>
  <tr>
  <td>
  <blockquote>
  
  <table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
  <td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Step%201:%20Stop%20sendmail%20from%20running%20as%20an%20SMTP%20daemon"><strong>Step 1: Stop sendmail from running as an SMTP daemon</strong></a></font></td>
  </tr>
  <tr>
  <td>
  <blockquote>
  
  <p>
  Ok so you want to use James for everything, including delivering mail from localhost to local users.<br>
  Well the first step is to stop sendmail from starting up as the SMTP Daemon on port 25, otherwise it will route mail to itself and who knows what will happen then.<br>
  Open the sendmail configuration file <b>/etc/sysconfig/sendmail</b>
  Change the line:<div align="left">
  <table border="0" cellpadding="0" cellspacing="4">
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#ffffff">
  <pre>DAEMON=yes</pre>
  </td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  </table>
  </div>into<div align="left">
  <table border="0" cellpadding="0" cellspacing="4">
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#ffffff">
  <pre>DAEMON=no</pre>
  </td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  </table>
  </div>
  Restart sendmail with:<div align="left">
  <table border="0" cellpadding="0" cellspacing="4">
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#ffffff">
  <pre>[root@apache root]# /etc/rc.d/init.d/sendmail restart</pre>
  </td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  </table>
  </div>This will make sendmail process its outgoing queue, but not listen on port 25 for incoming mail.
  </p>
  
  </blockquote>
  </td>
  </tr>
  </table>
  
  <table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
  <td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Step%202:%20Set%20up%20sendmail%20to%20use%20relay"><strong>Step 2: Set up sendmail to use relay</strong></a></font></td>
  </tr>
  <tr>
  <td>
  <blockquote>
  
  <p>
  Ok, so far so good, now you need to tell sendmail to relay everything, regardless of its rules, through James. James will take the roles of "local relay" (destination for all unqualified local addresses), "mail hub" (destination for all qualified local addresses) and "smart relay" (destination for all other mail) for this instance of sendmail, thereby catching everything.<br>
  So open <b>/etc/sendmail.cf</b> and..
  <ul>
  
  <li>Look for the line beginning <b>DS</b> make this line <b>DSesmtp:localhost</b>
  </li>
  
  <li>Look for the line beginning <b>DR</b> make this line <b>DResmtp:localhost</b>
  </li>
  
  <li>Look for the line beginning <b>DH</b> make this line <b>DHesmtp:localhost</b>
  </li>
  
  </ul>
  Now that wasn't too hard was it?<br>
  What we have done is to tell sendmail to use its "mailer" called <b>esmtp</b> to relay mail using ESMTP to localhost for each role.<br>
  Of course no-one in their right mind would relay mail to localhost, because it would loop forever right?
  </p>
  
  </blockquote>
  </td>
  </tr>
  </table>
  
  
  <table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
  <td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Step%203:%20Stop%20sendmail%20complaining%20about%20mail%20apparently%20looping%20back"><strong>Step 3: Stop sendmail complaining about mail apparently looping back</strong></a></font></td>
  </tr>
  <tr>
  <td>
  <blockquote>
  
  <p>
  The developers of sendmail have, wisely, built sendmail in such a way as to prevent, by default, mail being sent by sendmail back to itself, this is done by making a quick check on outgoing mail to see if its destination is our machine. If it is you'll see this message <b><i>config error: mail loops back to me</i></b> when you try to send mail.<br>
  But we *want* to relay mail to localhost, and because sendmail isn't receiving our mail, James is, we won't be creating a loop. (make sure you've followed step one though).<br>
  So open <b>/etc/sendmail.cf</b> again and go to the bottom of the file, start scrolling upwards until you see the declaration of the esmtp mailer it'll look something like this
  <div align="left">
  <table border="0" cellpadding="0" cellspacing="4">
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#ffffff">
  <pre>
  Mesmtp,		P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
  		T=DNS/RFC822/SMTP,
  		A=TCP $h
  </pre>
  </td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  </table>
  </div>
  You need to change it so its more like this:  :-D
  <div align="left">
  <table border="0" cellpadding="0" cellspacing="4">
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#ffffff">
  <pre>
  Mesmtp,		P=[IPC], F=kmDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
  		T=DNS/RFC822/SMTP,
  		A=TCP $h
  </pre>
  </td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  </table>
  </div>
  But seriously, we've added a <b>k</b> to the "F=" list <b>F=mDFMuXa</b> becomes <b>F=kmDFMuXa</b>
  <br>
  And again, thats it, sendmail will now skip the loopback test on mail leaving through the esmtp mailer.
  </p>
  
  <p>Now you have to make some tests.<br>Try each of the following, replace names in [] with names of the kind described.
  <div align="left">
  <table border="0" cellpadding="0" cellspacing="4">
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#ffffff">
  <pre>/[root@apache root]# mail -v [real-localusername]
  
  [root@apache root]# mail -v [nonexistant-localusername]
  
  [root@apache root]# mail -v [real-localusername]@localhost
  
  [root@apache root]# mail -v [real-localusername]@[myhostname.mydomainname]
  
  [root@apache root]# mail -v [real-username]@[real-remote-account]
  </pre>
  </td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  </table>
  </div>
  Sendmail echoes each conversation to STDOUT so you can see what its trying to do with each mail.<br>
  
  </p>
  
  </blockquote>
  </td>
  </tr>
  </table>
  
  
  <table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
  <td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Step%204:%20If%20that%20wasn't%20enough%20James%20requires%20SMTP%20AUTH"><strong>Step 4: If that wasn't enough James requires SMTP AUTH</strong></a></font></td>
  </tr>
  <tr>
  <td>
  <blockquote>
  
  <p>
  SMTP AUTH is a different Kettle of Fish.<br>
  The scenario is that you're using SMTP AUTH on James to restrict SMTP relaying to authenticated users, allowing them to connect from any IP address but still not letting James become an open relay for spam, cool.<br>
  However you now want to let sendmail relay through James, so you need to tell it how to authenticate.<br>
  So open <b>/etc/sendmail.cf</b> <i>again</i> and this time..
  <ul>
  
  <li>Look for the line beginning <b>O AuthMechanisms=</b> If this line is commented out with a leading <b>#</b>, remove the <b>#</b> then make sure LOGIN and PLAIN are at the beginning of this line like this <b>O AuthMechanisms=LOGIN PLAIN GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5</b>
  </li>
  
  <li>Look for the line beginning <b>O DefaultAuthInfo=</b> If this line is commented out with a leading <b>#</b>, remove the <b>#</b> then make this line <b>O DefaultAuthInfo=/etc/mail/default-auth-info</b>
  </li>
  
  <li>Create a user account on James for sendmail to login as.</li>
  
  <li>Create the file <b>/etc/mail/default-auth-info</b>
  </li>
  
  <li>It should contain this<div align="left">
  <table border="0" cellpadding="0" cellspacing="4">
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#ffffff">
  <pre>username
  username
  password
  localhost</pre>
  </td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  <tr>
  <td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="/images/void.gif"></td>
  </tr>
  </table>
  </div>Yes the username appears twice.</li>
  
  <li>Replace username and password with the details of the account you just created.</li>
  
  <li>This file has to be chmod'ed 600 (-rw------) or sendmail won't read it.</li>
  
  <li>Look for the line beginning <b>O AuthOptions=</b> If this line is commented out with a leading <b>#</b>, remove the <b>#</b> and it should be <b>O AuthOptions=A</b>
  </li>
  
  </ul>
  
  
  <h1>
  <i><b>Ta-da!</b></i>
  </h1> Now you're ready to run the tests in Step3, all of the mail should be accepted, the most likely rejection will be the final one.
  </p>
  
  </blockquote>
  </td>
  </tr>
  </table>
  
  <p>Thats it, good luck and happy mailing :)<br>Danny Angus</p>
  
  </blockquote>
  </td>
  </tr>
  </table>
  </td>
  </tr>
  <!--FOOTER SEPARATOR-->
  <tr>
  <td colspan="2">
  <hr size="1" noshade="">
  </td>
  </tr>
  <!--PAGE FOOTER-->
  <tr>
  <td colspan="2">
  <div align="center">
  <font size="-1" color="#525D76"><em>
          Copyright &copy; 1999-2002, Apache Software Foundation
          </em></font>
  </div>
  </td>
  </tr>
  </table>
  </body>
  </html>
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>