Bug 680512 - Request to add MySQL database administrator policy
Summary: Request to add MySQL database administrator policy
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 14
Hardware: i386
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-25 18:46 UTC by Bruce Ecroyd
Modified: 2011-03-22 18:52 UTC (History)
2 users (show)

Fixed In Version: selinux-policy-3.9.7-37.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-03-22 18:52:29 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Bruce Ecroyd 2011-02-25 18:46:57 UTC
Description of problem:

At present, I can add a apache administrator, webadm_u, that restricts the user (sudo) to access /var/www and restart httpd. If an equivalent MySQL administrator is set up in a similar fashion, the MySQL db administrator user can't connect to the db after sudo. 

Version-Release number of selected component (if applicable):
- Current targeted policy.

How reproducible:

A Linux user 'dbadmin' was created, then:

a) semanage user -a -L s0 -r s0 -R "staff_r dbadm_r system_r" -P user dbadm_u
b) cp /etc/selinux/targeted/contexts/users/staff_u /etc/selinux/targeted/contexts/users/dbadm_u
c) semanage login -a -s dbadm_u -r s0 dbadmin
 echo "dbadmin ALL=(ALL) TYPE=dbadm_t ROLE=dbadm_r ALL" > /etc/sudoers.d/dbadmin
d) chmod 0440 /etc/sudoers.d/dbadmin

e) user dbadmin performs sudo -s to change contexts from dbadm_u/staff_r/staff_t to  dbadm_u/dbadm_r/dbadm_t

attempting to connect to mysql db results in avc denied while transitioning from scontext dbadm_u/dbadm_r/dbadm_t to tcontext dbadm_u/system_r/mysqld_t

Workaround fix:

mkdir ~/mydbadm; cd ~/mydbadm; echo "policy_module(mydbadm, 1.0.0) gen_require(\` type dbadm_t; ') mysql_stream_connect(dbadm_t)" > mydbadm.te; make -f /usr/share/selinux/devel/Makefile mydbadm.pp

sudo semodule -i mydbadm.pp

Comment 1 Daniel Walsh 2011-02-25 20:35:23 UTC
I have added this to F15 policy.

Comment 2 Daniel Walsh 2011-02-25 20:35:48 UTC
mysql_admin should contain

mysql_stream_connect($1)

Comment 3 Miroslav Grepl 2011-03-07 23:58:29 UTC
Fixed in selinux-policy-3.9.7-33.fc14

Comment 4 Fedora Update System 2011-03-18 15:07:28 UTC
selinux-policy-3.9.7-34.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-34.fc14

Comment 5 Fedora Update System 2011-03-21 08:45:26 UTC
selinux-policy-3.9.7-37.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-37.fc14

Comment 6 Fedora Update System 2011-03-22 18:51:02 UTC
selinux-policy-3.9.7-37.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.


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