All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libselinux: log no default label warning in verbose mode
@ 2017-09-11 10:41 Christian Göttsche
  2017-09-12 16:04 ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Göttsche @ 2017-09-11 10:41 UTC (permalink / raw)
  To: selinux

Since 1cd972f restorecon does not print a warning in recurse mode for child files without a default label.
Change it back in verbose mode:

$ touch /run/test.pid
$ restorecon -R /run
$ restorecon -v -R /run
Warning no default label for /run/test.pid

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libselinux/src/selinux_restorecon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c
index ced41152..6d0eabe0 100644
--- a/libselinux/src/selinux_restorecon.c
+++ b/libselinux/src/selinux_restorecon.c
@@ -614,7 +614,7 @@ static int restorecon_sb(const char *pathname, const struct stat *sb,
 						    sb->st_mode);
 
 	if (rc < 0) {
-		if (errno == ENOENT && flags->warnonnomatch)
+		if (errno == ENOENT && (flags->verbose || flags->warnonnomatch))
 			selinux_log(SELINUX_INFO,
 				    "Warning no default label for %s\n",
 				    lookup_path);
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libselinux: log no default label warning in verbose mode
  2017-09-11 10:41 [PATCH] libselinux: log no default label warning in verbose mode Christian Göttsche
@ 2017-09-12 16:04 ` Stephen Smalley
  2017-09-12 19:49   ` Christian Göttsche
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2017-09-12 16:04 UTC (permalink / raw)
  To: Christian Göttsche; +Cc: selinux

[-- Attachment #1: Type: text/plain, Size: 1415 bytes --]

On Sep 11, 2017 3:45 AM, "Christian Göttsche via Selinux" <
selinux@tycho.nsa.gov> wrote:

Since 1cd972f restorecon does not print a warning in recurse mode for child
files without a default label.
Change it back in verbose mode:

$ touch /run/test.pid
$ restorecon -R /run
$ restorecon -v -R /run
Warning no default label for /run/test.pid


This seems to revert what was an intentional change to avoid noise in
fixfiles check output. See the mailing list discussions that preceded and
followed the patch.


Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libselinux/src/selinux_restorecon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_
restorecon.c
index ced41152..6d0eabe0 100644
--- a/libselinux/src/selinux_restorecon.c
+++ b/libselinux/src/selinux_restorecon.c
@@ -614,7 +614,7 @@ static int restorecon_sb(const char *pathname, const
struct stat *sb,
                                                    sb->st_mode);

        if (rc < 0) {
-               if (errno == ENOENT && flags->warnonnomatch)
+               if (errno == ENOENT && (flags->verbose ||
flags->warnonnomatch))
                        selinux_log(SELINUX_INFO,
                                    "Warning no default label for %s\n",
                                    lookup_path);
--
2.14.1

[-- Attachment #2: Type: text/html, Size: 2326 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libselinux: log no default label warning in verbose mode
  2017-09-12 16:04 ` Stephen Smalley
@ 2017-09-12 19:49   ` Christian Göttsche
  2017-09-12 22:09     ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Göttsche @ 2017-09-12 19:49 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: selinux

> This seems to revert what was an intentional change to avoid noise in
> fixfiles check output. See the mailing list discussions that preceded and
> followed the patch.


In my opinion, it's a helpful noise, which is triggered by an intended
file context `<<none>>`.
Is there any hack to get the old behavior back other than `find /run
-exec restorecon -n {} \;`?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libselinux: log no default label warning in verbose mode
  2017-09-12 19:49   ` Christian Göttsche
@ 2017-09-12 22:09     ` Stephen Smalley
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Smalley @ 2017-09-12 22:09 UTC (permalink / raw)
  To: Christian Göttsche; +Cc: selinux

[-- Attachment #1: Type: text/plain, Size: 718 bytes --]

On Sep 12, 2017 12:49 PM, "Christian Göttsche" <cgzones@googlemail.com>
wrote:

> This seems to revert what was an intentional change to avoid noise in
> fixfiles check output. See the mailing list discussions that preceded and
> followed the patch.


In my opinion, it's a helpful noise, which is triggered by an intended
file context `<<none>>`.
Is there any hack to get the old behavior back other than `find /run
-exec restorecon -n {} \;`?


Why is that helpful/useful? It seems counterintuitive to warn the user that
you didn't label a file that was explicitly configured to not be labeled.
The only case where it makes sense is if the user explicitly requested to
label that particular file.

[-- Attachment #2: Type: text/html, Size: 1137 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-12 23:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 10:41 [PATCH] libselinux: log no default label warning in verbose mode Christian Göttsche
2017-09-12 16:04 ` Stephen Smalley
2017-09-12 19:49   ` Christian Göttsche
2017-09-12 22:09     ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.