Bug 645348 - Postfix init script 'status' not very robust
Summary: Postfix init script 'status' not very robust
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: postfix
Version: 5.5
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Jaroslav Škarvada
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-10-21 11:20 UTC by Luke Bigum
Modified: 2013-01-08 07:27 UTC (History)
1 user (show)

Fixed In Version: postfix-2.3.3-5.el5
Doc Type: Bug Fix
Doc Text:
Prior to this update the postfix init script looked for process named "master" to find out whether the postfix daemon is running. This was not robust soultion, because the script could be tricked by any other process named master which could lead to problems. Now the init script checks for PID which is more robust.
Clone Of:
Environment:
Last Closed: 2013-01-08 07:27:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0054 0 normal SHIPPED_LIVE postfix bug fix and enhancement update 2013-01-07 15:27:57 UTC

Description Luke Bigum 2010-10-21 11:20:53 UTC
Description of problem:

The Postfix LSB/init script uses the standard /etc/rc.d/init.d/functions "status" function to check for the existence of a process called "master". It should really check for a PID as well, as 'master' is not really that generic a process name. I can write a sleeping shell script called master and that will fool "/sbin/service postifx status".

A real world case of this is running Puppet Master through Passenger, where the spawned Ruby Rails process is also called 'master'.

Haven't looked into if Postfix provides an internal health check, but for a quick fix you could change the status call to be "status -p <pid file> master" and make use of a /var/run to record a PID file.

Version-Release number of selected component (if applicable):

How reproducible:

Pretty simple.

Steps to Reproduce:

[root@puppet-master-01 tmp]# cat master
#!/bin/bash
sleep 1000000
[root@puppet-master-01 tmp]# service postfix stop
Shutting down postfix:                                     [  OK  ]
[root@puppet-master-01 tmp]# ./master &
[1] 18972
[root@puppet-master-01 tmp]# ps -fe | grep master
root     18972 14875  0 12:07 pts/0    00:00:00 /bin/bash ./master
[root@puppet-master-01 tmp]# status master
master (pid 18972) is running...

Actual results:

Postfix LSB script can be tricked into thinking Postfix is running, which may also fool other simple utilities.

Expected results:

LSB script should identify if Postfix is running or not.

Additional info:

Comment 1 Miroslav Lichvar 2010-11-26 12:21:41 UTC
Fedora and RHEL6 scripts have the following, easy to backport.

lockfile=/var/lock/subsys/$prog
pidfile=/var/spool/postfix/pid/master.pid

status -p $pidfile -l $(basename $lockfile) master

Comment 2 RHEL Program Management 2011-01-11 20:19:04 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 3 RHEL Program Management 2011-01-11 23:23:13 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 4 RHEL Program Management 2011-05-31 13:24:04 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 5 RHEL Program Management 2011-09-23 00:13:45 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 6 RHEL Program Management 2012-04-02 10:21:59 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 10 Jaroslav Škarvada 2012-06-28 08:36:46 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Prior to this update the postfix init script looked for process named "master" to find out whether the postfix daemon is running. This was not robust soultion, because the script could be tricked by any other process named master which could lead to problems. Now the init script checks for PID which is more robust.

Comment 13 errata-xmlrpc 2013-01-08 07:27:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0054.html


Note You need to log in before you can comment on or make changes to this bug.