mysqld rules
Hi Russel!
On SuSE mysqld starts with safe_mysqld. This time I write a rule set for it. And in this context I change your mysqld_t rules a little bit. I am interested in your opinion about this. ( I remaind of discussion about the config files.)
I often need the dac_override capability in my suse rules (also in this case) and don't found it on other rules. Do you know why?
Thanks
Carsten
etc/security/selinux/policy/domains/program/mysqld.te renamed from policy/domains/program/mysqld.te +13 -5
@@ -7,12 +7,20 @@ # Rules for the mysqld_t domain. # # mysqld_exec_t is the type of the mysqld executable. -# +# mysql_daemonconf_t is the type of the server specific settings +# (mysql-datadir/my.cnf) -- ONLY using by mysqld +# mysql_conf_t is the type for global settings +# ( /etc/my.cnf ) -- using by ALL mysql programs +# mysql_userconf_t is the type of the user specific settings +# ( ~/.my.cnf ) -- NOT uses by mysqld daemon_domain(mysqld) type etc_mysqld_t, file_type, sysadmfile; type mysqld_db_t, file_type, sysadmfile; type mysqld_log_t, file_type, sysadmfile, logfile; +type mysql_userconf_t, file_type, sysadmfile; +type mysql_conf_t, file_type, sysadmfile; +type mysql_daemonconf_t, file_type, sysadmfile; file_type_auto_trans(mysqld_t, var_log_t, mysqld_log_t)
@@ -36,13 +44,13 @@ allow mysqld_t var_lib_t:dir search; # read config files -allow mysqld_t { etc_t etc_mysqld_t resolv_conf_t etc_runtime_t }:{ file lnk_file } { read getattr }; +#allow mysqld_t { etc_t etc_mysqld_t resolv_conf_t etc_runtime_t }:{ file lnk_file } { read getattr }; +allow mysqld_t { etc_t resolv_conf_t etc_runtime_t }:{ file lnk_file } { read getattr }; +allow mysqld_t { mysql_conf_t mysql_daemonconf_t }:file { getattr read }; allow mysqld_t etc_t:dir search; allow mysqld_t sysctl_kernel_t:dir search; allow mysqld_t sysctl_kernel_t:file read; -# for /root/.my.cnf - should not be needed -allow mysqld_t sysadm_home_dir_t:dir search; -allow mysqld_t sysadm_home_t:file { read getattr }; +
etc/security/selinux/policy/file_contexts/program/mysqld.fc renamed from policy/file_contexts/program/mysqld.fc +3 -0
@@ -3,3 +3,6 @@ /var/run/mysqld(|/.*) system_u:object_r:var_run_mysqld_t /var/log/mysql\.(err|log).* system_u:object_r:mysqld_log_t /var/lib/mysql(|/.*) system_u:object_r:mysqld_db_t +/etc/my.cnf system_u:object_r:mysql_sysconf_t +/root/.my.cnf system_u:object_r:mysql_userconf_t +/home/[^/]*/.my.cnf system_u:object_r:mysql_userconf_t
Quoted 4 lines · Carsten Grohmann
On SuSE mysqld starts with
safe_mysqld. This time I write a rule set for it. And in this context I change yourmysqld_trules a little bit. I am interested in your opinion about this. ( I remaind of discussion about the config files.)
The type etc_mysqld_t is to be used for system configuration files, I have changed my mysqld.fc file appropriately.
I think that adding a mysql_userconf_t is not the way to go, there should be a macros file with a $1_home_mysql_t if necessary. But do we really need that?
Apart from the issue of mysql startup scripts wanting to access sysadm_home_t files is there any need for a different type?
Quoted 2 lines
I often need the
dac_overridecapability in my suse rules (also in this case) and don't found it on other rules. Do you know why?
That is because some of the files that mysqld is accessing are under a different UID/GID than that used by the daemon.
To lock down mysqld most tightly you want to use a program like start-stop-daemon to start mysqld under the correct UID so that you can deny it the setuid and setgid capabilities. Then of course you have to make sure that all the files are also under the correct UID.
Signature · 3 lines
I do not get viruses because I do not use MS software. If you use Outlook then please do not put my email address in your address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line
From field.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.