[PR #5830/c8a2ac3a backport][stable-6] sefcontext: add support for path substitutions #6098
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #5830 as merged into main (c8a2ac3).
SUMMARY
Fixes #1193.
Add support for path substitution mappings in the
sefcontext
module.I would like to get feedback on this architecture that is quite a bit different from another (dead) PR #5189:
setype
argument withstate=absent
- it is not really required for deletion and it was not even used in the old code.setype
orsubstitute
arg passed: delete both path substitutions and regular context mappings fortarget
if either was found when deletion requested.substitute
was passed withstate=absent
then delete only that equivalence if found (don't delete regular context mappings); if not found then return unchanged, if found buttarget
substitutes some other path then return unchanged.setype
was passed withstate=absent
then delete only existing context mappings (don't delete path substitutions), don't care about thesetype
matching the current mapping to delete (this is the old behavior which seems a bit loose).Fixes #4564.
Change the incorrect
setype
in documentation example to a working label.ISSUE TYPE
COMPONENT NAME
sefcontext
ADDITIONAL INFORMATION
Feedback please! It is the largest code change I have done yet so I really need feedback.
sefcontext setype=tmp_t target=/opt/tmp state=absent
: what if/opt/tmp
is currently not mapped totmp_t
, say it's mapped toopt_t
- in this case should the module just returnchanged=false
? Or should it delete the mapping anyways? The old behavior is the latter and I've kept that unchanged. Personally I feel that it is wrong and would like to hear feedback on this.substitute
? I couldn't come up with a great name for it. Theman
page forsemanage-fcontext
talks about "path substitution" and the switch-e
for this is called "equals". Better args names welcome: current comments seem to supportsubstitute
but there is also request to addequal
as an alias (I would hesitate, perhaps unnecessarily, to add an alias to a new feature).Also adds "attributes" block to documentation & some minor documentation improvements.