Blame SOURCES/0039-selinux-8-5-Describe-fcontext-regular-expressions.patch

d6d821
From c556c6ad0b94cf3ba4b441a1a0930f2468434227 Mon Sep 17 00:00:00 2001
d6d821
From: Vit Mojzis <vmojzis@redhat.com>
d6d821
Date: Wed, 10 Feb 2021 18:05:29 +0100
d6d821
Subject: [PATCH] selinux(8,5): Describe fcontext regular expressions
d6d821
d6d821
Describe which type of regular expression is used in file context
d6d821
definitions and which flags are in effect.
d6d821
d6d821
Explain how local file context modifications are processed.
d6d821
d6d821
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
d6d821
Acked-by: Petr Lautrbach <plautrba@redhat.com>
d6d821
---
d6d821
 python/semanage/semanage            |  2 +-
d6d821
 python/semanage/semanage-fcontext.8 | 18 ++++++++++++++++++
d6d821
 2 files changed, 19 insertions(+), 1 deletion(-)
d6d821
d6d821
diff --git a/python/semanage/semanage b/python/semanage/semanage
d6d821
index 781e8645..ebb93ea5 100644
d6d821
--- a/python/semanage/semanage
d6d821
+++ b/python/semanage/semanage
d6d821
@@ -366,7 +366,7 @@ If you do not specify a file type, the file type will default to "all files".
d6d821
     parser_add_seuser(fcontextParser, "fcontext")
d6d821
     parser_add_type(fcontextParser, "fcontext")
d6d821
     parser_add_range(fcontextParser, "fcontext")
d6d821
-    fcontextParser.add_argument('file_spec', nargs='?', default=None, help=_('file_spec'))
d6d821
+    fcontextParser.add_argument('file_spec', nargs='?', default=None, help=_('Path to be labeled (may be in the form of a Perl compatible regular expression)'))
d6d821
     fcontextParser.set_defaults(func=handleFcontext)
d6d821
 
d6d821
 
d6d821
diff --git a/python/semanage/semanage-fcontext.8 b/python/semanage/semanage-fcontext.8
d6d821
index 561123af..49635ba7 100644
d6d821
--- a/python/semanage/semanage-fcontext.8
d6d821
+++ b/python/semanage/semanage-fcontext.8
d6d821
@@ -11,6 +11,24 @@ SELinux policy without requiring modification to or recompilation
d6d821
 from policy sources.  semanage fcontext is used to  manage the default
d6d821
 file system labeling on an SELinux system.  This command maps file paths using regular expressions to SELinux labels.
d6d821
 
d6d821
+FILE_SPEC may contain either a fully qualified path,
d6d821
+or a Perl compatible regular expression (PCRE),
d6d821
+describing fully qualified path(s). The only PCRE flag in use is PCRE2_DOTALL,
d6d821
+which causes a wildcard '.' to match anything, including a new line.
d6d821
+Strings representing paths are processed as bytes (as opposed to Unicode),
d6d821
+meaning that non-ASCII characters are not matched by a single wildcard.
d6d821
+
d6d821
+Note, that file context definitions specified using 'semanage fcontext'
d6d821
+(i.e. local file context modifications stored in file_contexts.local)
d6d821
+have higher priority than those specified in policy modules.
d6d821
+This means that whenever a match for given file path is found in
d6d821
+file_contexts.local, no other file context definitions are considered.
d6d821
+Entries in file_contexts.local are processed from most recent one to the oldest,
d6d821
+with first match being used (as opposed to the most specific match,
d6d821
+which is used when matching other file context definitions).
d6d821
+All regular expressions should therefore be as specific as possible,
d6d821
+to avoid unintentionally impacting other parts of the filesystem.
d6d821
+
d6d821
 .SH "OPTIONS"
d6d821
 .TP
d6d821
 .I  \-h, \-\-help
d6d821
-- 
d6d821
2.29.2
d6d821