SunQuest
 
       Server Administration
  Home arrow Server Administration arrow Page 2 - Handling sendmail Permissions
IBM developerWorks
Try It Free
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Forums Sitemap 
Dedicated Servers  
Download TestComplete 
IBM® developerWorks
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? 
SERVER ADMINISTRATION

Handling sendmail Permissions
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-05-01

    Table of Contents:
  • Handling sendmail Permissions
  • 4.5.2 Permissions for :include:
  • 4.5.3 Permissions for ~/.forward Files
  • 4.5.4 Recommended Permissions

  • 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
     
    Try It Free
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Handling sendmail Permissions - 4.5.2 Permissions for :include:


    (Page 2 of 4 )

     

    The sendmail program doesn’t always run as root. When delivering mail, it often changes its identity into that of a nonprivileged user. When delivering to an :include: mailing list, for example, it can change its identity to that of the owner of the list. This, too, can pose security risks if permissions are not appropriate.† Consider the following aliases file entry:

      newprogs: :include:/usr/local/lists/proglist

    Here, notification of new programs is mailed to the aliasnewprogs. The list of recipients is taken from the following file:

      -rw-rw-r--  2 bin  prog   704 Sep 21 14:46 /usr/local/lists/proglist

    Because this file is owned by bin, sendmail changes its identity to bin when delivering to the list of recipients. Unfortunately, the file is also writable by the group prog. Anyone in the group prog can add a recipient to that list, including one of the form:

      |/tmp/x.sh

    This tells sendmail to deliver a copy of the message by running the program (a shell script) /tmp/x.sh.The sendmail program (which is still running as bin) executes that program as bin. Further, suppose the program /tmp/x.sh contains the following:

      #!/bin/sh
      cp /bin/sh /tmp/sh
      chmod u+s /tmp/sh
      cat - > /dev/null
      exit 0

    This causes bin first to make a copy of the Bourne shell in /tmp (a copy that will be owned by bin), and then to set the set-user-id bit on that copy (the u+s):

      -rwsr-xr-x  1 bin   64668 Sep 22 07:38 /tmp/sh

    The script then throws away the incoming mail message and exits with a zero value to keep sendmail unsuspecting. Through this process, an ordinary user in the group prog has created a set-user-id shell that allows anyone to become the semiprivileged user bin. From the earlier discussion (§4.5 on page 164), you can see the trouble that can cause!

    Mailing lists (:include:) must live in a directory, all the components of which are writable only by root. The lists themselves should be writable only by the owner.

    Mailing list (:include:) files can safely be owned by root. When sendmail processes a root-owned mailing list, it changes itself to run as the user and group specified by theDefaultUseroption (§24.9.32 on page 1000). That option defaults to daemon* but should be set to the mailnull user and mailnull group. TheDefaultUseroption should never be set to root.

    More Server Administration Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "sendmail, fourth edition," published by...
     

    Buy this book now. This article is excerpted from chapter four of sendmail, fourth edition, written by Bryan Costales, Claus Assmann, George Jansen and Gregory Shapiro (O'Reilly, 2007; ISBN: 0596510292). Check it out today at your favorite bookstore. Buy this book now.

    SERVER ADMINISTRATION ARTICLES

    - An Overview of Free Network Scanning Tools
    - Information Security: A Coherent Approach
    - Advanced IP Network Scanning Methods
    - Using Emulation and More to Analyze Network ...
    - Third Party IP Network Scanning Methods
    - Methods of IP Network Scanning
    - IP Network Scanning
    - sendmail Security Options
    - Security Features of sendmail
    - Handling sendmail Permissions
    - Maintain Security with sendmail
    - Generating Your Own Security Certificates Fo...
    - Introduction to crontab





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