Bug 483278 - wrong context on /usr/bin/mysqld_safe
wrong context on /usr/bin/mysqld_safe
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Miroslav Grepl
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2009-01-30 12:12 EST by Vadym Chepkov
Modified: 2009-11-18 06:20 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-11-18 06:20:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Vadym Chepkov 2009-01-30 12:12:51 EST

mysql init script calls another script /usr/bin/mysqld_safe which in turn starts  /usr/libexec/mysqld. 

mysqld is running in proper domain, but mysqld_safe is not.

either /usr/bin/mysqld_safe has to be labeled as mysqld_exec_t or, which I think is a proper way, as mysqld_initrc_exec_t, but a transition from mysqld_initrc_exec_t to mysqld_initrc_exec_t is allowed.

# ps -efZ|grep mysql
unconfined_u:system_r:initrc_t  root      1079     1  0 12:03 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/mysql/data --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --user=mysql
unconfined_u:system_r:mysqld_t  mysql     1126  1079  0 12:03 pts/0    00:00:01 /usr/libexec/mysqld --basedir=/usr --datadir=/var/mysql/data --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock
Comment 1 Daniel Walsh 2009-02-02 08:26:02 EST

I think it should be labeled mysqld_exec_t, and you will need to add

can_exec(mysqld_t, mysqld_exec_t)
Comment 2 Vadym Chepkov 2009-02-02 08:46:16 EST
I thought the idea is "the least privileges". In this case we would grant permissions to a simple shell script to modify database files, which it shouldn't have. Isn't it?
Comment 3 Miroslav Grepl 2009-02-02 12:02:41 EST
I tried it and in this case also need to add:


and also capabilities are appeared:

allow mysqld_t self:capability { fowner chown };

Question is if we want the same domain for mysqld_safe and mysqld ?
Comment 4 Daniel Walsh 2009-02-02 13:26:52 EST
Ok I guess we should have a new domain.

Vadym, you can take least privileges too far, generating additional domains does not always generate a great deal more security, and greatly increases complexity.  If two apps have basically the same defition they should have run in the same domain, and in the past we have grown too many domains.  The best example of this is the handling of spam.  We grew the number of different domains to handle spam mail with every new mail handler that showed up.  Problem was each needed to interact with every other and policy was always broken.

fowner and chown are two capabilities I would rather not give to mysqld, so I guess the best case is to generate a new domain.    We have a goal of not having any initrc_t domains running.
Comment 5 Miroslav Grepl 2009-02-12 10:07:37 EST
Fixed in selinux-policy-3.5.13-45.fc10
Comment 6 Bug Zapper 2009-11-18 05:55:31 EST
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 

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