Bug 1063371 - man selinux-fcontext needs to include sort order
Summary: man selinux-fcontext needs to include sort order
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: policycoreutils
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Lautrbach
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1206767
TreeView+ depends on / blocked
 
Reported: 2014-02-10 15:10 UTC by James Patterson
Modified: 2018-05-29 12:03 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1206767 (view as bug list)
Environment:
Last Closed: 2018-05-29 12:03:41 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
seobject/__init__.py test patch (1.28 KB, patch)
2015-03-04 15:32 UTC, Miroslav Grepl
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 678577 0 medium CLOSED Context depends on rules order 2021-02-22 00:41:40 UTC

Internal Links: 678577

Description James Patterson 2014-02-10 15:10:58 UTC
Description of problem:
The semanage-fcontext man page needs to mention information about the sort order used for deciding which label a file or directory gets.

i.e. the last section from https://fedoraproject.org/wiki/SELinux/ManagingFileContext

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 4 Miroslav Grepl 2015-03-04 14:35:16 UTC
Yes, semanage-fcontext "just" shows us which file contexts are defined and do a sort which does not follow real order.

Comment 5 Miroslav Grepl 2015-03-04 15:27:45 UTC
(In reply to Miroslav Grepl from comment #4)
> Yes, semanage-fcontext "just" shows us which file contexts are defined and
> do a sort which does not follow real order.

Also we use python dictionary which changes an order by default that makes searching efficient.

We could get it working with

from collections import OrderedDict

and without sorting which we do.

Comment 6 Miroslav Grepl 2015-03-04 15:32:35 UTC
Created attachment 997926 [details]
seobject/__init__.py test patch

You could try to test it with the following patch for seobject/__init__.py patch.

Comment 7 James Patterson 2015-03-05 08:39:58 UTC
I don't really understand what is going on here :)

Does the patch change the sort order?

Comment 8 Miroslav Grepl 2015-03-05 09:25:29 UTC
Yes, this is a quick "fix". We will talk about a fix more with plautrba.

Comment 9 Filip Krska 2015-03-28 11:30:20 UTC
To me the patch Attachment #997926 [details] seem to work as desired, thanks:

before patch

# semanage fcontext -l|grep \/directory
/tmp/directory(/.*)?                               all files          system_u:object_r:httpd_cache_t:s0 
/tmp/directory/subdirectory(/.*)?                  all files          system_u:object_r:httpd_sys_content_t:s0 
/tmp/directory/subdirectory/([ab].*)?              all files          system_u:object_r:httpd_cache_t:s0

# cat /etc/selinux/targeted/contexts/files/file_contexts.local
# This file is auto-generated by libsemanage
# Do not edit directly.

/tmp/directory(/.*)?    system_u:object_r:httpd_cache_t:s0
/tmp/directory/subdirectory/([ab].*)?    system_u:object_r:httpd_cache_t:s0
/tmp/directory/subdirectory(/.*)?    system_u:object_r:httpd_sys_content_t:s0
# matchpathcon /tmp/directory/subdirectory/aa
/tmp/directory/subdirectory/aa	system_u:object_r:httpd_sys_content_t:s0

after patch

# semanage fcontext -l|grep \/directory
/tmp/directory(/.*)?                               all files          system_u:object_r:httpd_cache_t:s0 
/tmp/directory/subdirectory/([ab].*)?              all files          system_u:object_r:httpd_cache_t:s0 
/tmp/directory/subdirectory(/.*)?                  all files          system_u:object_r:httpd_sys_content_t:s0

semanage fcontext -l follows the user defined order the same way as restorecon and matchpathcon does.

Of course, the man page should be more specific on the rules order as well.

Comment 10 Jan Kurik 2015-07-15 14:43:12 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 11 Fedora End Of Life 2016-11-24 11:06:36 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. 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 '23'.

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 23 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 12 Fedora End Of Life 2016-12-20 12:44:59 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 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.

Comment 13 Vit Mojzis 2017-01-02 09:15:23 UTC
This issue is still present in current version of selinux-fcontext man page.

Comment 14 Fedora End Of Life 2017-02-28 09:36:33 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 15 Fedora End Of Life 2018-05-03 08:54:41 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. 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 '26'.

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 26 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 16 Fedora End Of Life 2018-05-29 12:03:41 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
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.