Bug 134588

Summary: Change from using su to runuser in initscripts
Product: [Fedora] Fedora Reporter: Daniel Walsh <dwalsh>
Component: postgresqlAssignee: Tom Lane <tgl>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: hhorak
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-05 19:37:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch for changeing su to runuser none

Description Daniel Walsh 2004-10-04 20:26:57 UTC
We have created a newversion of the su command called runuser, which
will run a program as a different user.  The command can only be run
as root and will not use pam or prompt for passwords.  Otherwize it
works exactly as su.  This change is needed by SELinux in order to
support proper transitioning on process execution.  

Attached is a patch to the postgressql.init file to make the change.

Comment 1 Daniel Walsh 2004-10-04 20:29:23 UTC
Created attachment 104745 [details]
Patch for changeing su to runuser

Comment 2 Tom Lane 2004-10-04 21:01:49 UTC
This seems mighty messy: instead of using the upstream-maintained init
file, every Red Hat package will now have to roll its own, or at least
resign ourselves to patching the upstream forevermore.

Couldn't we fix things so that /etc/rc.d/init.d/functions aliases su
to runuser, and then the init scripts would not need to be hacked
individually?

Comment 3 Daniel Walsh 2004-10-04 21:47:41 UTC
Yes, it already is(will be).  This is only for init scripts that are
not  using the daemon function in /etc/init.d/functions.

Dan

Comment 4 Tom Lane 2004-10-04 23:37:47 UTC
Mph.  daemon() isn't going to go over well either, so I guess I'm
stuck.  Will do.  This is only for FC3 and beyond, right?

Comment 5 Tom Lane 2004-10-05 01:06:14 UTC
In hopes of not breaking the initscript for non-SELinux systems,
I am thinking of

if [ -x /bin/runuser ]
then
    SU=runuser
else
    SU=su
fi

then

$SU -l postgres ...

Do you have any objection to doing it that way?

Comment 6 Daniel Walsh 2004-10-05 13:14:08 UTC
runuser is not specific to SELinux.  It is part of coreutils.  You can
do this if you think your app will be installed on a version of
coreutils that does not include runuser.  Runuser is going to be
installed on /sbin/runuser also.

This is for FC3/RHEL4 and beyond.

Dan

Comment 7 Tom Lane 2004-10-05 19:37:47 UTC
Done in 7.4.5-3.