Bug 1427142 - possible improvement - plugin restorecon suggests no-op command (99.5 confidence)
Summary: possible improvement - plugin restorecon suggests no-op command (99.5 confide...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: setroubleshoot-plugins
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Lautrbach
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-27 12:57 UTC by Alan Jenkins
Modified: 2017-12-12 10:07 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-12-12 10:07:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Alan Jenkins 2017-02-27 12:57:57 UTC
Description of problem:

I used `semanage fcontext` + `restorecon`, and then (still) suffered an AVC denial executing the file.

This is not my complaint, I clearly don't understand selinux enough to implement any workaround more subtle than disabling selinux,

The problem detected is that setroubleshootd suggests the most likely fix is to run `restorecon -v` on the file.  That was part of how I _caused_ the problem, and of course re-running it does nothing to help.

The plugin actually knows what label "should" be re-applied.  So it could easily see that something more is wrong.  (Just run the equivalent of `restorecon -nv`).


Version-Release number of selected component (if applicable):
setroubleshoot-3.3.11-1.fc25.x86_64


How reproducible:

Install Fedora 25, this might rely on BZ#1416540 still being not fixed, I don't know SELINUX.

sudo semanage fcontext -a -t unconfined_exec_t /usr/lib/systemd/systemd-machined
sudo restorecon /usr/lib/systemd/systemd-machined
sudo systemctl restart systemd-machined


Actual results:


SELinux is preventing (machined) from execute access on the file /usr/lib/systemd/systemd-machined.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/usr/lib/systemd/systemd-machined default label should be systemd_machined_exec_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /usr/lib/systemd/systemd-machined

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that (machined) should be allowed execute access on the systemd-machined file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c '(machined)' --raw | audit2allow -M my-machined
# semodule -X 300 -i my-machined.pp


Expected results:

setroubleshootd should be able to avoid making this incorrect command suggestion at 99.5 confidence, because it is very easy for it to disprove.

Options:

1. suggest the correct commands

# semanage fcontext -a -t systemd_machined_exec_t /usr/lib/systemd/systemd-machined
# restorecon -v /usr/lib/systemd/systemd-machined


2. recognize that user has started shooting themselves in the foot.  Report the same information - because knowing the inconsistency / that this is a local customization could be very useful!

But instead of saying "If you want to fix the label", say "the label is broken", and something to indicate that you have put yourself beyond the help of restorecon.

I guess we don't know how many files the user has re-labelled (and again, a simple `restorecon -R /` cannot fix the files).


3. trust all local customizations, if restorecon would not do anything, then have the restorecon plugin not report anything at all in setroubleshootd.


I'm not really recommending option 2 or 3, just noting the possibilities.

Comment 1 Petr Lautrbach 2017-02-27 13:06:21 UTC
Thanks for the report. I don't have a clear answer for this right now but we will try to address it in next release - https://github.com/fedora-selinux/setroubleshoot/issues/48

Comment 2 Fedora End Of Life 2017-11-16 19:02:19 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. 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 EOL if it remains open with a Fedora  'version'
of '25'.

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 25 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.

Comment 3 Fedora End Of Life 2017-12-12 10:07:09 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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