Skip to contentSkip to conversation

Revert "mcstransd select correct colour range."

PATCH In review Vit Mojzis 4 participants 6 messages Jul 2, 2019 – Sep 16, 2019 SELinux security module

lore
Share & tools
lore

Vit Mojzis

author
#0 lore raw

PATCH 1/2 Revert "mcstransd select correct colour range."

This reverts commit fe17b3d2d924018750386c5ee74f12ca4b054136.

MLS ranges should be compared based on dominance.

This fixes mlscolor-test on mcstrans examples.

Eg. mlscolor-test using /usr/share/mcstrans/examples/urcsts when executed on mls machine fails as follows:

\#pushd /usr/share/mcstrans/examples/urcsts
\#cp -f secolor.conf /etc/selinux/mls/secolor.conf \#cp -f setrans.conf /etc/selinux/mls/setrans.conf \#systemctl restart mcstransd
\#python3 /usr/share/mcstrans/util/mlscolor-test urcsts.color For 'system_u:system_r:inetd_t:SystemLow' got

	'#000000 #000000 #000000 #000000 #000000 #000000 #000000 #000000' expected
	'#000000 #000000 #000000 #000000 #000000 #000000 #000000 #008000'

...
mlscolor-test done with 19 errors

---
 mcstrans/src/mcscolor.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
mcstrans/src/mcscolor.c +6 -6
index 6ea1aa97..d597e0df 100644
@@ -134,12 +134,12 @@ static const secolor_t *find_color(int idx, const char *component,
 	}
 
 	while (ptr) {
-		if (fnmatch(ptr->pattern, component, 0) == 0) {
-			if (idx == COLOR_RANGE) {
-			    if (check_dominance(ptr->pattern, raw) == 0)
-					return &ptr->color;
-			} else 
-				return &ptr->color;
+		if (idx == COLOR_RANGE) {
+		    if (check_dominance(ptr->pattern, raw) == 0)
+			return &ptr->color;
+		} else {
+		    if (fnmatch(ptr->pattern, component, 0) == 0)
+			return &ptr->color;
 		}
 		ptr = ptr->next;
 	}
Signature · 1 line
2.17.2
author
#1 lore raw

PATCH 2/2 Fix mcstrans secolor examples

According to "check_dominance" function:
Range defined as "s15:c0.c1023" does not dominate any other range than
"s15:c0.c1023" (does not dominate "s15", "s15:c0.c200", etc.).
While range defined as "s15-s15:c0.c1023" dominates all of the above.

This is either a bug, or "s15:c0.c1023" should not be used in the examples.

---
 libselinux/man/man5/secolor.conf.5                      | 4 ++--
 libselinux/man/ru/man5/secolor.conf.5                   | 4 ++--
 mcstrans/share/examples/urcsts-via-include/secolor.conf | 2 +-
 mcstrans/share/examples/urcsts/secolor.conf             | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
libselinux/man/man5/secolor.conf.5 +2 -2
index b834577a..a3bf2da1 100644
@@ -123,7 +123,7 @@ range s7\-s7:c0.c1023 = black red
 .br
 range s9\-s9:c0.c1023 = black orange
 .br
-range s15:c0.c1023   = black yellow
+range s15\-s15:c0.c1023   = black yellow
 .RE
 
 .sp
@@ -165,7 +165,7 @@ type xguest_t     = black green
 .br
 user sysadm_u     = white black
 .br
-range s0:c0.c1023 = black white
+range s0-s0:c0.c1023 = black white
 .br
 user *            = black white
 .br
libselinux/man/ru/man5/secolor.conf.5 +2 -2
index 4c1236ae..bcae80c1 100644
@@ -121,7 +121,7 @@ range s7\-s7:c0.c1023 = black red
 .br
 range s9\-s9:c0.c1023 = black orange
 .br
-range s15:c0.c1023   = black yellow
+range s15\-s15:c0.c1023   = black yellow
 .RE
 
 .sp
@@ -163,7 +163,7 @@ type xguest_t     = black green
 .br
 user sysadm_u     = white black
 .br
-range s0:c0.c1023 = black white
+range s0\-s0:c0.c1023 = black white
 .br
 user *            = black white
 .br
mcstrans/share/examples/urcsts-via-include/secolor.conf +1 -1
index d35b3c67..3b3f5430 100644
@@ -17,5 +17,5 @@ range s3-s3:c0.c1023 = black tan
 range s5-s5:c0.c1023 = white blue
 range s7-s7:c0.c1023 = black red
 range s9-s9:c0.c1023 = black orange
-range s15:c0.c1023 = black yellow
+range s15-s15:c0.c1023 = black yellow
 
mcstrans/share/examples/urcsts/secolor.conf +1 -1
index d35b3c67..3b3f5430 100644
@@ -17,5 +17,5 @@ range s3-s3:c0.c1023 = black tan
 range s5-s5:c0.c1023 = white blue
 range s7-s7:c0.c1023 = black red
 range s9-s9:c0.c1023 = black orange
-range s15:c0.c1023 = black yellow
+range s15-s15:c0.c1023 = black yellow
 
Signature · 1 line
2.17.2
#2 lore raw

Re: [PATCH 2/2] Fix mcstrans secolor examples

Quoted 8 lines · Vit Mojzis

According to "check_dominance" function:
Range defined as "s15:c0.c1023" does not dominate any other range than
"s15:c0.c1023" (does not dominate "s15", "s15:c0.c200", etc.).
While range defined as "s15-s15:c0.c1023" dominates all of the above.

This is either a bug, or "s15:c0.c1023" should not be used in the examples.

Hello,
I am not familiar with the concepts about range dominance, so I do not know whether this is a bug that should be fixed or if updating the examples is better. Can someone please review this?

Cheers,
Nicolas

Quoted 77 lines
---
 libselinux/man/man5/secolor.conf.5                      | 4 ++--
 libselinux/man/ru/man5/secolor.conf.5                   | 4 ++--
 mcstrans/share/examples/urcsts-via-include/secolor.conf | 2 +-
 mcstrans/share/examples/urcsts/secolor.conf             | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
libselinux/man/man5/secolor.conf.5 +2 -2
index b834577a..a3bf2da1 100644
@@ -123,7 +123,7 @@ range s7\-s7:c0.c1023 = black red
 .br
 range s9\-s9:c0.c1023 = black orange
 .br
-range s15:c0.c1023   = black yellow
+range s15\-s15:c0.c1023   = black yellow
 .RE
 
 .sp
@@ -165,7 +165,7 @@ type xguest_t     = black green
 .br
 user sysadm_u     = white black
 .br
-range s0:c0.c1023 = black white
+range s0-s0:c0.c1023 = black white
 .br
 user *            = black white
 .br
libselinux/man/ru/man5/secolor.conf.5 +2 -2
index 4c1236ae..bcae80c1 100644
@@ -121,7 +121,7 @@ range s7\-s7:c0.c1023 = black red
 .br
 range s9\-s9:c0.c1023 = black orange
 .br
-range s15:c0.c1023   = black yellow
+range s15\-s15:c0.c1023   = black yellow
 .RE
 
 .sp
@@ -163,7 +163,7 @@ type xguest_t     = black green
 .br
 user sysadm_u     = white black
 .br
-range s0:c0.c1023 = black white
+range s0\-s0:c0.c1023 = black white
 .br
 user *            = black white
 .br
mcstrans/share/examples/urcsts-via-include/secolor.conf +1 -1
index d35b3c67..3b3f5430 100644
@@ -17,5 +17,5 @@ range s3-s3:c0.c1023 = black tan
 range s5-s5:c0.c1023 = white blue
 range s7-s7:c0.c1023 = black red
 range s9-s9:c0.c1023 = black orange
-range s15:c0.c1023 = black yellow
+range s15-s15:c0.c1023 = black yellow
 
mcstrans/share/examples/urcsts/secolor.conf +1 -2
index d35b3c67..3b3f5430 100644
@@ -17,5 +17,5 @@ range s3-s3:c0.c1023 = black tan
 range s5-s5:c0.c1023 = white blue
 range s7-s7:c0.c1023 = black red
 range s9-s9:c0.c1023 = black orange
-range s15:c0.c1023 = black yellow
+range s15-s15:c0.c1023 = black yellow
 
--

2.17.2

#3 lore raw

Re: [PATCH 2/2] Fix mcstrans secolor examples

I agree the secolor configuration file is lacking consistency. From a historical MLS perspective, there were two special labels in many MLS
systems: SystemLow and SystemHigh. This would be "s0" (lowest level/no categories) and "s15:c0.c1023" (highest level/all categories) respectively. At these special levels, there was traditionally no other category usage.

I concur we either do the proposed change in this patch or just change the "s0:c0.c1023" lines to just "s0" (SystemLow) to be consistent with the "s15:c0.c1023" (SystemHigh) range that exists currently. They will both provide the desired results.

-Chad

Quoted 97 lines · Nicolas Iooss
Quoted 8 lines · Vit Mojzis

According to "check_dominance" function:
Range defined as "s15:c0.c1023" does not dominate any other range than
"s15:c0.c1023" (does not dominate "s15", "s15:c0.c200", etc.).
While range defined as "s15-s15:c0.c1023" dominates all of the above.

This is either a bug, or "s15:c0.c1023" should not be used in the examples.

Hello,
I am not familiar with the concepts about range dominance, so I do not know whether this is a bug that should be fixed or if updating the examples is better. Can someone please review this?

Cheers,
Nicolas

Quoted 77 lines
---
 libselinux/man/man5/secolor.conf.5                      | 4 ++--
 libselinux/man/ru/man5/secolor.conf.5                   | 4 ++--
 mcstrans/share/examples/urcsts-via-include/secolor.conf | 2 +-
 mcstrans/share/examples/urcsts/secolor.conf             | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
libselinux/man/man5/secolor.conf.5 +2 -2
index b834577a..a3bf2da1 100644
@@ -123,7 +123,7 @@ range s7\-s7:c0.c1023 = black red
 .br
 range s9\-s9:c0.c1023 = black orange
 .br
-range s15:c0.c1023   = black yellow
+range s15\-s15:c0.c1023   = black yellow
 .RE
 
 .sp
@@ -165,7 +165,7 @@ type xguest_t     = black green
 .br
 user sysadm_u     = white black
 .br
-range s0:c0.c1023 = black white
+range s0-s0:c0.c1023 = black white
 .br
 user *            = black white
 .br
libselinux/man/ru/man5/secolor.conf.5 +2 -2
index 4c1236ae..bcae80c1 100644
@@ -121,7 +121,7 @@ range s7\-s7:c0.c1023 = black red
 .br
 range s9\-s9:c0.c1023 = black orange
 .br
-range s15:c0.c1023   = black yellow
+range s15\-s15:c0.c1023   = black yellow
 .RE
 
 .sp
@@ -163,7 +163,7 @@ type xguest_t     = black green
 .br
 user sysadm_u     = white black
 .br
-range s0:c0.c1023 = black white
+range s0\-s0:c0.c1023 = black white
 .br
 user *            = black white
 .br
mcstrans/share/examples/urcsts-via-include/secolor.conf +1 -1
index d35b3c67..3b3f5430 100644
@@ -17,5 +17,5 @@ range s3-s3:c0.c1023 = black tan
 range s5-s5:c0.c1023 = white blue
 range s7-s7:c0.c1023 = black red
 range s9-s9:c0.c1023 = black orange
-range s15:c0.c1023 = black yellow
+range s15-s15:c0.c1023 = black yellow
 
mcstrans/share/examples/urcsts/secolor.conf +1 -2
index d35b3c67..3b3f5430 100644
@@ -17,5 +17,5 @@ range s3-s3:c0.c1023 = black tan
 range s5-s5:c0.c1023 = white blue
 range s7-s7:c0.c1023 = black red
 range s9-s9:c0.c1023 = black orange
-range s15:c0.c1023 = black yellow
+range s15-s15:c0.c1023 = black yellow
 
--

2.17.2

#4 lore raw

Re: [PATCH 2/2] Fix mcstrans secolor examples

Quoted 11 lines · Chad Hanson

I agree the secolor configuration file is lacking consistency. From a historical MLS perspective, there were two special labels in many MLS
systems: SystemLow and SystemHigh. This would be "s0" (lowest level/no categories) and "s15:c0.c1023" (highest level/all categories) respectively. At these special levels, there was traditionally no other category usage.

I concur we either do the proposed change in this patch or just change the "s0:c0.c1023" lines to just "s0" (SystemLow) to be consistent with the "s15:c0.c1023" (SystemHigh) range that exists currently. They will both provide the desired results.

I see that these two patches were never merged and still apply. Does anyone have any objection to merging them both?

Quoted 102 lines

-Chad

Quoted 97 lines · Nicolas Iooss
Quoted 8 lines · Vit Mojzis

According to "check_dominance" function:
Range defined as "s15:c0.c1023" does not dominate any other range than
"s15:c0.c1023" (does not dominate "s15", "s15:c0.c200", etc.).
While range defined as "s15-s15:c0.c1023" dominates all of the above.

This is either a bug, or "s15:c0.c1023" should not be used in the examples.

Hello,
I am not familiar with the concepts about range dominance, so I do not know whether this is a bug that should be fixed or if updating the examples is better. Can someone please review this?

Cheers,
Nicolas

Quoted 77 lines
---
  libselinux/man/man5/secolor.conf.5                      | 4 ++--
  libselinux/man/ru/man5/secolor.conf.5                   | 4 ++--
  mcstrans/share/examples/urcsts-via-include/secolor.conf | 2 +-
  mcstrans/share/examples/urcsts/secolor.conf             | 2 +-
  4 files changed, 6 insertions(+), 6 deletions(-)
libselinux/man/man5/secolor.conf.5 +2 -2
index b834577a..a3bf2da1 100644
@@ -123,7 +123,7 @@ range s7\-s7:c0.c1023 = black red
  .br
  range s9\-s9:c0.c1023 = black orange
  .br
-range s15:c0.c1023   = black yellow
+range s15\-s15:c0.c1023   = black yellow
  .RE
 
  .sp
@@ -165,7 +165,7 @@ type xguest_t     = black green
  .br
  user sysadm_u     = white black
  .br
-range s0:c0.c1023 = black white
+range s0-s0:c0.c1023 = black white
  .br
  user *            = black white
  .br
libselinux/man/ru/man5/secolor.conf.5 +2 -2
index 4c1236ae..bcae80c1 100644
@@ -121,7 +121,7 @@ range s7\-s7:c0.c1023 = black red
  .br
  range s9\-s9:c0.c1023 = black orange
  .br
-range s15:c0.c1023   = black yellow
+range s15\-s15:c0.c1023   = black yellow
  .RE
 
  .sp
@@ -163,7 +163,7 @@ type xguest_t     = black green
  .br
  user sysadm_u     = white black
  .br
-range s0:c0.c1023 = black white
+range s0\-s0:c0.c1023 = black white
  .br
  user *            = black white
  .br
mcstrans/share/examples/urcsts-via-include/secolor.conf +1 -1
index d35b3c67..3b3f5430 100644
@@ -17,5 +17,5 @@ range s3-s3:c0.c1023 = black tan
  range s5-s5:c0.c1023 = white blue
  range s7-s7:c0.c1023 = black red
  range s9-s9:c0.c1023 = black orange
-range s15:c0.c1023 = black yellow
+range s15-s15:c0.c1023 = black yellow
 
mcstrans/share/examples/urcsts/secolor.conf +1 -2
index d35b3c67..3b3f5430 100644
@@ -17,5 +17,5 @@ range s3-s3:c0.c1023 = black tan
  range s5-s5:c0.c1023 = white blue
  range s7-s7:c0.c1023 = black red
  range s9-s9:c0.c1023 = black orange
-range s15:c0.c1023 = black yellow
+range s15-s15:c0.c1023 = black yellow
 
--

2.17.2

#5 lore raw

Re: [PATCH 2/2] Fix mcstrans secolor examples

Quoted 8 lines · Stephen Smalley
Quoted 7 lines · Chad Hanson

I agree the secolor configuration file is lacking consistency. From a historical MLS perspective, there were two special labels in many MLS
systems: SystemLow and SystemHigh.  This would be "s0" (lowest level/no categories)  and "s15:c0.c1023" (highest level/all categories) respectively.  At these special  levels, there was traditionally no other category usage.

Quoted 6 lines
Quoted 4 lines

I concur we either do the proposed change in this patch or just change the "s0:c0.c1023" lines to just "s0" (SystemLow) to be consistent with the "s15:c0.c1023" (SystemHigh) range that exists currently. They will both provide the desired results.

I see that these two patches were never merged and still apply.  Does anyone have any objection to merging them both?

Both patches applied.

Quoted 104 lines
Quoted 103 lines

-Chad

Quoted 97 lines · Nicolas Iooss
Quoted 8 lines · Vit Mojzis

According to "check_dominance" function:
Range defined as "s15:c0.c1023" does not dominate any other range than "s15:c0.c1023" (does not dominate "s15", "s15:c0.c200", etc.). While range defined as "s15-s15:c0.c1023" dominates all of the above.

This is either a bug, or "s15:c0.c1023" should not be used in the examples.

Hello,
I am not familiar with the concepts about range dominance, so I do not know whether this is a bug that should be fixed or if updating the examples is better. Can someone please review this?

Cheers,
Nicolas

Quoted 77 lines

---
  libselinux/man/man5/secolor.conf.5                      | 4 ++-- libselinux/man/ru/man5/secolor.conf.5                   | 4 ++-- mcstrans/share/examples/urcsts-via-include/secolor.conf | 2 +- mcstrans/share/examples/urcsts/secolor.conf             | 2 +-

  4 files changed, 6 insertions(+), 6 deletions(-)
libselinux/man/man5/secolor.conf.5 +0 -0
index b834577a..a3bf2da1 100644
@@ -123,7 +123,7 @@ range s7\-s7:c0.c1023 = black red

  .br
  range s9\-s9:c0.c1023 = black orange
  .br

libselinux/man/man5/secolor.conf.5 +1 -1
-range s15:c0.c1023   = black yellow
+range s15\-s15:c0.c1023   = black yellow

  .RE

  .sp

libselinux/man/man5/secolor.conf.5 +0 -0
@@ -165,7 +165,7 @@ type xguest_t     = black green

  .br
  user sysadm_u     = white black
  .br

libselinux/man/man5/secolor.conf.5 +1 -1
-range s0:c0.c1023 = black white
+range s0-s0:c0.c1023 = black white

  .br
  user *            = black white
  .br

libselinux/man/ru/man5/secolor.conf.5 +0 -0
index 4c1236ae..bcae80c1 100644
@@ -121,7 +121,7 @@ range s7\-s7:c0.c1023 = black red

  .br
  range s9\-s9:c0.c1023 = black orange
  .br

libselinux/man/ru/man5/secolor.conf.5 +1 -1
-range s15:c0.c1023   = black yellow
+range s15\-s15:c0.c1023   = black yellow

  .RE

  .sp

libselinux/man/ru/man5/secolor.conf.5 +0 -0
@@ -163,7 +163,7 @@ type xguest_t     = black green

  .br
  user sysadm_u     = white black
  .br

libselinux/man/ru/man5/secolor.conf.5 +1 -1
-range s0:c0.c1023 = black white
+range s0\-s0:c0.c1023 = black white

  .br
  user *            = black white
  .br

mcstrans/share/examples/urcsts-via-include/secolor.conf +0 -0
index d35b3c67..3b3f5430 100644
@@ -17,5 +17,5 @@ range s3-s3:c0.c1023 = black tan

  range s5-s5:c0.c1023 = white blue
  range s7-s7:c0.c1023 = black red
  range s9-s9:c0.c1023 = black orange

mcstrans/share/examples/urcsts-via-include/secolor.conf +1 -1
-range s15:c0.c1023 = black yellow
+range s15-s15:c0.c1023 = black yellow
mcstrans/share/examples/urcsts/secolor.conf +0 -0
index d35b3c67..3b3f5430 100644
@@ -17,5 +17,5 @@ range s3-s3:c0.c1023 = black tan

  range s5-s5:c0.c1023 = white blue
  range s7-s7:c0.c1023 = black red
  range s9-s9:c0.c1023 = black orange

mcstrans/share/examples/urcsts/secolor.conf +1 -1
-range s15:c0.c1023 = black yellow
+range s15-s15:c0.c1023 = black yellow
Signature · 2 lines
-- 
2.17.2