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

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