init script incorrectly 'su's

Bug #435484 reported by Herb McNew
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
couchdb (Ubuntu)
Triaged
Medium
Chad Miller

Bug Description

Binary package hint: couchdb

If the init script is run as the COUCHDB_USER it still attempts to su to the COUCHDB_USER. This doesn't work. The script should check to see if it's already COUCHDB_USER before trying to su.

Revision history for this message
Alex Lourie (alourie) wrote :

Herb,

Thank you for taking the time to report this bug and helping to make Ubuntu better.

Can you please be more specific? What do you mean by "doesn't work"? Do you get an error while starting it?
I've checked the init script, and it is perfectly normal to run su $USER being already a $USER.

Changed in couchdb (Ubuntu):
status: New → Incomplete
Revision history for this message
Herb McNew (herb) wrote :

If you run su as $USER the su process will either a) prompt you for a password (if one is set) or b) return "su: Permission denied" if the password field is a *. Either way this blocks the startup of the process or the machine.

Example a:
herb@ramble:~$ id
uid=1000(herb) gid=1000(herb) groups=1000(herb)
herb@ramble:~$ su herb
Password:

Example b:
couchdb@ramble:~$ id
uid=111(couchdb) gid=120(couchdb) groups=120(couchdb)
couchdb@ramble:~$ su couchdb
su: Permission denied

Changed in couchdb (Ubuntu):
status: Incomplete → New
Revision history for this message
Alex Lourie (alourie) wrote : Re: [Bug 435484] Re: init script incorrectly 'su's

Herb,

You are correct; this would be a problem if the script would run by anyone
but root.

But is it executed as non-root user? Ever?

  status confirmed

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.7.8)

iEYEARECAAYFAkq7yxMACgkQCQNxSZx9L7svNACghf7mqfG8zYGUGVIFTsJRTbjr
rrQAmwcB81rcycp4HxKQgXKLR2wPiffl
=84nh
-----END PGP SIGNATURE-----

Changed in couchdb (Ubuntu):
status: New → Confirmed
Revision history for this message
Herb McNew (herb) wrote :

It is run as a non-root user. That's how we found this bug. On our production systems we on occasion give people access to certain role accounts, but don't want them to have root access. This includes the ability to start and stop services associated with said role accounts. In particular some members of our team have access to the COUCHDB_USER account and couldn't restart the service despite the fact they were operating as the process owner.

Chad Miller (cmiller)
Changed in couchdb (Ubuntu):
assignee: nobody → Chad Miller (cmiller)
Chad Miller (cmiller)
Changed in couchdb (Ubuntu):
status: Confirmed → In Progress
Chad Miller (cmiller)
Changed in couchdb (Ubuntu):
status: In Progress → Confirmed
Jonathan Davies (jpds)
Changed in couchdb (Ubuntu):
status: Confirmed → In Progress
importance: Undecided → Medium
status: In Progress → Confirmed
Revision history for this message
Chad Miller (cmiller) wrote :

Reported upstream at https://issues.apache.org/jira/browse/COUCHDB-603.

(LP does not track JIRA tickets yet.)

Tom Haddon (mthaddon)
tags: added: canonical-losa-u1
Revision history for this message
Steve Langasek (vorlon) wrote :

init scripts should never call su. They should call start-stop-daemon instead.

Changed in couchdb (Ubuntu):
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.