- installation of mysqld requires chfn
hi,
i just installed (or tried to install) mysql-server with enforcing=1 switched on.
it failed because of adding the mysql user and the use of "chfn" to change the name to "MySql Server" in /etc/passwd.
i added the can_exec chfn_exec_t into domains/programs/dpkg.te:
# mysqld is broken too
ifdef(`mysqld.te', `
can_exec(dpkg_t, chfn_exec_t)
domain_auto_trans(dpkg_t, mysqld_exec_t, mysqld_t)
can_unix_connect(dpkg_t, mysqld_t)
allow mysqld_t dpkg_tmp_t:file { getattr read };
')... but as it turns out, i can't use chfn at all (it doesn't have permission to write to /etc/shadow - this is version passwd-4.0.3-8.selinux1 from dan walters) so again i had to reboot with "enforcing=0".
so, summary:
1) patch to dpkg.te needed to get mysqld to install.
2) there's something i don't understand about why chfn is failing.
l.
Signature · 15 lines
-- expecting email to be received and understood is a bit like picking up the telephone and immediately dialing without checking for a dial-tone; speaking immediately without listening for either an answer or ring-tone; hanging up immediately and believing that you have actually started a conversation. -- <a href="http://lkcl.net"> lkcl.net </a> <br /> <a href="mailto:[email protected]"> [email protected] </a> <br /> -- 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.
Quoted 1 line · Luke Kenneth Casson Leighton
i added the
can_execchfn_exec_tinto domains/programs/dpkg.te:
ifdef(passwd.te', domain_auto_trans(dpkg_t, chfn_exec_t, chfn_t)
')
The above is what you want. You don't want to allow dpkg_t direct access to /etc/shadow because it will probably mess it up (replace it with a copy labelled as etc_t).
Signature · 9 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- 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.
Quoted 8 lines · Russell Coker
Quoted 1 line · Luke Kenneth Casson Leighton
i added the
can_execchfn_exec_tinto domains/programs/dpkg.te:ifdef(
passwd.te',domain_auto_trans(dpkg_t, chfn_exec_t, chfn_t)
')The above is what you want.
oooo, thank you v. much. that wouldn't have occurred to me.
lots still to learn...
Quoted 3 lines
You don't want to allow
dpkg_tdirect access
to/etc/shadowbecause it will probably mess it up (replace it with a copy labelled asetc_t).
yerss, i noticed that if i run with "enforcing=0" and run chfn as sysadm_r, i end up with /etc/shadow labelled as root:object_r:system_t and i have to do a setfiles /etc/selinux/file_contexts/file_contexts /etc/shadow pdq.
been bitten by not being able to log in once or twice by that :)
l.
Signature · 13 lines
Information I post is with honesty, integrity, and the expectation that you will take full responsibility for acting on the information contained, and that, should you find it to be flawed or even mildly useful, you will act with both honesty and integrity in return - and tell me. -- <a href="http://lkcl.net"> lkcl.net </a> <br /> <a href="mailto:[email protected]"> [email protected] </a> <br /> -- 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.
Quoted 2 lines · Luke Kenneth Casson Leighton
yerss, i noticed that if i run with "enforcing=0" and run chfn as
sysadm_r, i end up with/etc/shadowlabelled as root:object_r:system_t
How does that happen? There is no system_t type in the default policy!
The usual problem with chfn etc on Debian is of getting /etc/passwd labeled as root:object_r:shadow_t...
Signature · 9 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- 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.
Quoted 5 lines · Russell Coker
Quoted 2 lines · Luke Kenneth Casson Leighton
yerss, i noticed that if i run with "enforcing=0" and run chfn as
sysadm_r, i end up with/etc/shadowlabelled as root:object_r:system_tHow does that happen? There is no
system_ttype in the default policy!
ohohoh, yes.
Quoted 2 lines
The usual problem with chfn etc on Debian is of getting
/etc/passwdlabeled as root:object_r:shadow_t...
yesyou'reright i was rushing when i wrote that.
--
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.
russell, steven - just a thought.
if you look at dpkg.te, and presumably rpm.te too, are you at all concerned about the ever-increasing permission set that's added to these two packages' policies?
it doesn't seem right to me that dpkg's policy file has to grant permission to run passwd.te in order to install oh, say, foomatic-db.
it just goes against the grain of granting least privilege.
i'm just concerned that dpkg.te and rpm.te turn into these pretty-much-everything "monsters".
so, let's see... is it possible to add something into dpkg (se_dpkg?) to make it call run_init or do a domain_auto_trans just before calling the postinstall / prerm etc. scripts, to move it from dpkg.te into dpkg_<PACKAGENAME>.te?
l.
Quoted 18 lines · Russell Coker
Quoted 3 lines · Luke Kenneth Casson Leighton
i added the
can_execchfn_exec_tinto domains/programs/dpkg.te:[ to make it possible to install mysqld ]
ifdef(
passwd.te',domain_auto_trans(dpkg_t, chfn_exec_t, chfn_t)
')The above is what you want. You don't want to allow
dpkg_tdirect access to/etc/shadowbecause it will probably mess it up (replace it with a copy labelled asetc_t).Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
Signature · 14 lines
-- Information I post is with honesty, integrity, and the expectation that you will take full responsibility for acting on the information contained, and that, should you find it to be flawed or even mildly useful, you will act with both honesty and integrity in return - and tell me. -- <a href="http://lkcl.net"> lkcl.net </a> <br /> <a href="mailto:[email protected]"> [email protected] </a> <br /> -- 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.
Quoted 3 lines · Luke Kenneth Casson Leighton
if you look at dpkg.te, and presumably rpm.te too, are you at all concerned about the ever-increasing permission set that's added to these two packages' policies?
No.
Quoted 4 lines
it doesn't seem right to me that dpkg's policy file has to grant permission to run passwd.te in order to install oh, say, foomatic-db.
it just goes against the grain of granting least privilege.
We can't grant least privilege to dpkg and rpm. By design these programs need write access to every significant file on the system and can totally break the system with the smallest bug.
Trying to reduce the access of such programs to the system makes no sense.
Quoted 2 lines
i'm just concerned that dpkg.te and rpm.te turn into these pretty-much-everything "monsters".
That's what they do!
Quoted 4 lines
so, let's see... is it possible to add something into dpkg (
se_dpkg?) to make it callrun_initor do adomain_auto_transjust before calling the postinstall / prerm etc. scripts, to move it from dpkg.te into dpkg_<PACKAGENAME>.te?
What good would that do? dpkg/rpm still has full control. They can replace libc, they can replace anything in /sbin, /bin, etc.
Signature · 9 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- 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.
Quoted 6 lines · Russell Coker
Quoted 3 lines · Luke Kenneth Casson Leighton
if you look at dpkg.te, and presumably rpm.te too, are you at all concerned about the ever-increasing permission set that's added to these two packages' policies?
No.
*grin*
Quoted 16 lines
Quoted 4 lines
it doesn't seem right to me that dpkg's policy file has to grant permission to run passwd.te in order to install oh, say, foomatic-db.
it just goes against the grain of granting least privilege.
We can't grant least privilege to dpkg and rpm. By design these programs need write access to every significant file on the system and can totally break the system with the smallest bug.
Trying to reduce the access of such programs to the system makes no sense.
Quoted 2 lines
i'm just concerned that dpkg.te and rpm.te turn into these pretty-much-everything "monsters".
That's what they do!
Quoted 7 lines
Quoted 4 lines
so, let's see... is it possible to add something into dpkg (
se_dpkg?) to make it callrun_initor do adomain_auto_transjust before calling the postinstall / prerm etc. scripts, to move it from dpkg.te into dpkg_<PACKAGENAME>.te?What good would that do? dpkg/rpm still has full control. They can replace libc, they can replace anything in /sbin, /bin, etc.
i'd just feel more comfortable if dpkg or rpm had control over their package files, and were only able to transition to certain groups of postinstall / prerm contexts, e.g.
dpkg_libc.te
dpkg_samba.te
dpkg_apache.te
in other words, how about, in each .te file, there being a set of policy permissions for:
- install and configuration
- normal operation
- deinstall
if that means having to have an apache.install.te, an apache.remove.te and an apache.te, then so be it.
so my passwd.install.te file could have that domain_auto_trans(dpkg_t, chfn_exec_t, chfn_t) in it because it's needed there.
just a thought.
l.
Signature · 14 lines
-- Information I post is with honesty, integrity, and the expectation that you will take full responsibility for acting on the information contained, and that, should you find it to be flawed or even mildly useful, you will act with both honesty and integrity in return - and tell me. -- <a href="http://lkcl.net"> lkcl.net </a> <br /> <a href="mailto:[email protected]"> [email protected] </a> <br /> -- 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.