Red Hat Bugzilla – Bug 1011843
RFE: restorecon secure mode
Last modified: 2015-01-14 08:11:01 EST
Description of problem:
selinux policies get updated. I want to apply those new labels to files and directories which, but I don't want to assign a good label to a malicious file.
A longer explanation:
Let's say I have a filesytem which an attacker has managed to place a malicious file on.
Let's also say that a new selinux policy has been released, and I want to update to it.
If I install that new selinux-policy, there will be some new labels for files, some deprecated labels, and so on. Like this one:
restorecon reset /usr/bin/package-cleanup context system_u:object_r:bin_t:s0->system_u:object_r:rpm_exec_t:s0
I need a way of telling restorecon to make those changes that are as a result of a change in the selinux policy, but without accidentally giving a good label to a malicious file.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Do you want to have a type like untrusted_t, which you can give to a file or directory, and then have restorecon ignore it?
If you added that type to /etc/selinux/targeted/contexts/customizable_types, you would get mostly what you want.
create a policy untrusted.te
Now compile the code
# make -f /usr/share/selinux/devel/Makefile untrusted.pp
# semodule -i untrusted.pp
echo untrusted_t >> /etc/selinux/targeted/contexts/customizable_types
# touch /etc/badfile
# chcon -t untrusted_t /etc/badfile
# restorecon -v /etc/badfile
# ls -Z /etc/badfile
restorecon -F /etc/badfile
Will still change the label.
No, I'd like to be able to run restorecon to update old labels to new ones, but without accidentally giving files with the wrong label the correct one.
James how would restorecon no the difference unless a administrator told them?
Because the policy would tell them.
Say you have /opt/blah with label t_stuff and you update the policy to give files under that directory the new label t_blah.
What would be good is if all the files under /opt/blah with the old t_stuff label got the new more-specific t_blah label - but without other files under /opt/blah accidentally getting the new label.
Well that is what is supposed to happen, but based on regular expressions.
The way we tell restorecon about labels is based on regular expressions, so we can change the labels on /opt/blah/.secret to one label versus the default label for all content under '/opt/blah(/.*)?'
Really? So in this scenario, what will happen?
New policy comes along, everything under /opt/blah(/.*)? should now be blah_t.
restorecon -R /opt/blah
What I expect to happen:
What I hope would happen:
Not sure how that could happen. Perhaps we should talk in IRC.
This message is a notice that Fedora 19 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 19. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.
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.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 19 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, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
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.