Bug 483278 - wrong context on /usr/bin/mysqld_safe
Summary: wrong context on /usr/bin/mysqld_safe
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 10
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-01-30 17:12 UTC by Vadym Chepkov
Modified: 2009-11-18 11:20 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-11-18 11:20:57 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Vadym Chepkov 2009-01-30 17:12:51 UTC
selinux-policy-targeted-3.5.13-40.fc10.noarch

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 13:26:02 UTC
Miroslav, 

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 13:46:16 UTC
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 17:02:41 UTC
I tried it and in this case also need to add:

corecmd_exec_bin(mysqld_t)

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 18:26:52 UTC
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 15:07:37 UTC
Fixed in selinux-policy-3.5.13-45.fc10

Comment 6 Bug Zapper 2009-11-18 10:55:31 UTC
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: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping


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