Administration
  Home arrow Administration arrow Page 13 - Getting Started with Sendmail
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ADMINISTRATION

Getting Started with Sendmail
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 17
    2005-07-07

    Table of Contents:
  • Getting Started with Sendmail
  • The cf directory structure
  • The cf/m4 directory
  • 1.1 Downloading the Latest Release
  • 1.2 Installing sendmail
  • 1.3 Compiling sendmail to Use LDAP
  • 1.4 Adding the regex Map Type to sendmail
  • 1.5 Compiling sendmail with SASL Support
  • 1.6 Compiling sendmail with STARTTLS Support
  • 1.7 Compiling in STARTTLS File Paths
  • 1.8 Building a sendmail Configuration
  • 1.9 Testing a New Configuration
  • 1.10 Logging sendmail

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Dell PowerEdge Servers

    Getting Started with Sendmail - 1.10 Logging sendmail
    (Page 13 of 13 )

    Problem

    Debugging a problem in the sendmail configuration may require more detailed information than sendmail logs by default.

    Solution

    Use the LogLevel option, either on the sendmail command line using the -O flag or in the sendmail configuration using the confLOG_LEVEL define, to increase the LogLevel above the default level of 9.

    If the confLOG_LEVEL define is used, rebuild and reinstall sendmail.cf, and restart sendmail, as described in Recipe 1.8.

    Discussion

    sendmail logs messages through syslog using the mail facility. Where the messages are logged is determined by the syslog.conf file. A grep of syslog.conf shows where the sendmail messages are logged on our sample Linux system:

      $ grep mail /etc/syslog.conf
      # Log anything (except mail) of level info or higher.   
      * .info;mail.none;authpriv.none;cron.none
    /var/log/messages
      # Log all the mail messages in one place.  
      mail.*                               /var/log/maillog

    Disregarding the comments, there are two lines in this particular syslog.conf file that mention the mail facility. The first line has a wildcard character in the facility field, meaning that it applies to every syslog facility. At first glance, you might think this applies to sendmail messages until you notice mail.none, which means that no messages from the mail facility will be logged in /var/log/messages./var/log/maillog is the place to look for sendmail log entries on this sample Linux system. The mail.* entry means that, no matter what the level, all messages from the mail facility are logged in /var/log/maillog. Of course, this syslog.conf file is specific to our sample system. Your file might look different and, even if it looks exactly like this one, you can change it in anyway that you wish. You completely control where sendmail logs messages.

    The syslog.conf file controls where sendmail messages are logged. The sendmail LogLevel option controls what is logged. The default sendmail LogLevel is 9, which is roughly equivalent to the syslog level info. Increasing the value of LogLevel increases the amount of data that sendmail logs. The meaningful LogLevel values are:

    0

    Log a limited number of severe problems, such as failing to find the system's hostname or qualified domain name.

    1

    Log serious system failures using syslog crit and alert levels.

    2

    Log networking failures at crit level

    3

    Log connection timeouts, malformed addresses, and forward and include errors using notice and error syslog levels.

    4

    Log connection rejections, bad qf filenames, and outdated aliases databases using info and notice levels.

    5

    Log envelope cloning, and log an entry for each message received. These log entries are made at the syslog info level.

    6

    Log a record of each message returned to the original sender, and log incoming SMTP VRFY, EXPN, and ETRN commands using the info level

    7

    Log delivery failures at the info level.

    8

    Log successful deliveries and alias database rebuilds at the syslog notice level.

    9

    Log mail deferred because of lack of system resources at the info level.

    10

    Log inbound SMTP connections and MILTER connects and replies. Log each database lookup. Log AUTH and STARTTLS errors. All of these messages are logged at info level. Also log TLS errors at syslog warning level.

    11

    Log end of processing, and log NIS errors. Log both types of messages at info level.

    12

    Log outbound SMTP connections at info level.

    13

    Log questionable file security, such as world-writable files and bad user shells.

    14

    Log connection refusals. Log additional STARTTLS information. Log both types of messages at info level.

    15

    Log all incoming SMTP commands at info level.

    16–98

    Log debugging information at debug level. This data is mostly suitable for code developers.

    Setting LogLevel causes all levels below the specified number to also be logged. Thus the default LogLevel of 9 also logs all of the messages described for levels 1 through 8. Each LogLevel adds more detail while continuing to log the messages of the lower LogLevel settings.

    LogLevel can be set inside the sendmail configuration using the confLOG_LEVEL define. For example:

      define(`confLOG_Level', `14')

    However, it is often only necessary to increase LogLevel for a short time or for a single test run. This can be done by defining LogLevel on the sendmail command line using the -O argument. Here is an example:

      # sendmail –O LogLevel=14 –bs -Am

    This example runs sendmail from the command line. The -Am argument, which does not apply to sendmail versions before 8.12, ensures that sendmail runs as an MTA— this argument is the opposite of the -Ac option discussed earlier in this chapter. The -bs argument allows you to manually input the SMTP commands in a manner similar to the telnet tests used in the previous recipe. The -O argument allows you to set the LogLevel from the command line. A command such as this might be used to log the effect of specific SMTP interactions.

    Both techniques for setting LogLevel work well. The technique you use depends on the circumstances and your preference.

    See Also

    The sendmail book covers logging in section 14.3 and LogLevel in section 24.9.56.


    * Most of the ls command output in this book is generated on a Red  
       Hat Linux system. Other versions of Unix and Linux may sort ls 
       output in a different way. The listing order may be different, but the
       files and directories will be the same.

    * Recipe 10.10 shows a trick that is used to create a configuration  
       without using an OSTYPE macro, but the trick is not recommended 
       for general use.
     

    * The sendmail version number is not the same as the sendmail.cf 
       version level. In our examples, the sendmail version number is .12.9, 
       but the sendmail.cf version level is 10. Furthermore, neither one
       of these has anything to do with the m4 VERSIONID macro, which  
       is used to place version control information in the master 
       configuration file.

    * If you use RPM, the rpmfind.net web site can help you search for 
       RPM compatible packages.

    * In this example, the signature is used to verify the gzipped tar file.  
      Signing the compressed files started with Version 8.12.7. Earlier 
      versions of sendmail signed the uncompressed tar
    file. In those
      cases, the tar
    file is first decompressed and then verified.

    * If you make changes to the siteconfig.m4 file and rerun Build
       use the -c command-line argument to alert Build
    of the changes.

    * Recipe 10.1 shows a trick to get around this requirement.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · quite a good article!
       · Really Nice Article
     

    Buy this book now. This article was excerpted from chapter one of The Sendmail Cookbook, written by Craig Hunt (O'Reilly Media, 2004; ISBN: 0596004710). Check it out at your favorite bookstore. Buy this book now.

       

    ADMINISTRATION ARTICLES

    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization
    - Advanced Concepts on Dealing with Files and ...
    - Dealing with Files and Filesystems
    - More Hacks for the User Environment in BSD
    - Personalizing the User Environment in BSD
    - Customizing the User Environment in BSD




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway