Skip to contentSkip to conversation

libsemanage: genhomedircon: only set MLS level if MLS is enabled

PATCH In review Stephen Smalley 3 participants 11 messages Oct 14, 2016 – Oct 15, 2016 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsemanage: genhomedircon: only set MLS level if MLS is enabled

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

---
 libsemanage/src/genhomedircon.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
libsemanage/src/genhomedircon.c +5 -1
index 6991fff..5e9d722 100644
@@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out,
 			goto fail;
 		}
 
-		if (sepol_context_set_user(sepolh, context, user->sename) < 0 ||
+		if (sepol_context_set_user(sepolh, context, user->sename) < 0) {
+			goto fail;
+		}
+
+		if (sepol_policydb_mls_enabled(s->policydb) &&
 		    sepol_context_set_mls(sepolh, context, user->level) < 0) {
 			goto fail;
 		}
Signature · 1 line
2.7.4
#1 lore raw
Quoted 20 lines · Stephen Smalley

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

---
 libsemanage/src/genhomedircon.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
libsemanage/src/genhomedircon.c +0 -0
index 6991fff..5e9d722 100644
@@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out,
 			goto fail;
 		}

libsemanage/src/genhomedircon.c static int write_contexts(genhomedircon_settings_t *s, FILE *out, · line 648

Quoted 10 lines
libsemanage/src/genhomedircon.c +5 -1
 
-		if (sepol_context_set_user(sepolh, context, user->sename) < 0 ||
+		if (sepol_context_set_user(sepolh, context, user->sename) < 0) {
+			goto fail;
+		}
+
+		if (sepol_policydb_mls_enabled(s->policydb) &&
 		    sepol_context_set_mls(sepolh, context, user->level) < 0) {
 			goto fail;
 		}

I could not get this to work:

libsemanage.validate_handler: seuser mapping [kcinimod -> (wheel.id, s0-s0:c0.c1023)] is invalid (No such file or directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory)
semodule: failed!

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#2 lore raw
Quoted 34 lines · Dominick Grift
Quoted 20 lines · Stephen Smalley

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

---
 libsemanage/src/genhomedircon.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
libsemanage/src/genhomedircon.c +0 -0
index 6991fff..5e9d722 100644
@@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out,
 			goto fail;
 		}

libsemanage/src/genhomedircon.c static int write_contexts(genhomedircon_settings_t *s, FILE *out, · line 648

Quoted 10 lines
libsemanage/src/genhomedircon.c +5 -1
 
-		if (sepol_context_set_user(sepolh, context, user->sename) < 0 ||
+		if (sepol_context_set_user(sepolh, context, user->sename) < 0) {
+			goto fail;
+		}
+
+		if (sepol_policydb_mls_enabled(s->policydb) &&
 		    sepol_context_set_mls(sepolh, context, user->level) < 0) {
 			goto fail;
 		}

I could not get this to work:

Quoted 6 lines

libsemanage.validate_handler: seuser mapping [kcinimod -> (wheel.id, s0-s0:c0.c1023)] is invalid (No such file or directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory)
semodule: failed!

for reference:

https://www.youtube.com/watch?v=yUAikbw5BSQ

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#3 lore raw
Quoted 37 lines · Dominick Grift
Quoted 30 lines · Dominick Grift
Quoted 20 lines · Stephen Smalley

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

Stephen Smalley <[email protected]> --- libsemanage/src/genhomedircon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)

(quoted diff) +0 -0

b/libsemanage/src/genhomedircon.c index 6991fff..5e9d722 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c @@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out, goto fail; }

(quoted diff) +0 -1
-		if (sepol_context_set_user(sepolh, context, user->sename) <
Quoted 6 lines

0 || + if (sepol_context_set_user(sepolh, context,
user->sename) < 0) { + goto fail; + } + + if
(sepol_policydb_mls_enabled(s->policydb) && sepol_context_set_mls(sepolh, context, user->level) < 0) { goto fail; }

I could not get this to work:

Quoted 5 lines

libsemanage.validate_handler: seuser mapping [kcinimod -> (wheel.id, s0-s0:c0.c1023)] is invalid (No such file or directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory) semodule: failed!

Quoted 3 lines

for reference:

https://www.youtube.com/watch?v=yUAikbw5BSQ

Not sure about that, but with this patch, I could successfully do the following:

$ cd refpolicy
$ make conf
$ make
$ sudo make install
$ sudo make load

And genhomedircon ran without complaint, and I have the expected entries in file_contexts.homedirs.
That's with the standard policy.

#4 lore raw
Quoted 50 lines · Stephen Smalley
Quoted 37 lines · Dominick Grift
Quoted 30 lines · Dominick Grift
Quoted 20 lines · Stephen Smalley

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

Stephen Smalley <[email protected]> --- libsemanage/src/genhomedircon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)

(quoted diff) +0 -0

b/libsemanage/src/genhomedircon.c index 6991fff..5e9d722 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c @@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out, goto fail; }

(quoted diff) +0 -1
-		if (sepol_context_set_user(sepolh, context, user->sename) <
Quoted 6 lines

0 || + if (sepol_context_set_user(sepolh, context,
user->sename) < 0) { + goto fail; + } + + if
(sepol_policydb_mls_enabled(s->policydb) && sepol_context_set_mls(sepolh, context, user->level) < 0) { goto fail; }

I could not get this to work:

Quoted 5 lines

libsemanage.validate_handler: seuser mapping [kcinimod -> (wheel.id, s0-s0:c0.c1023)] is invalid (No such file or directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory) semodule: failed!

Quoted 3 lines

for reference:

https://www.youtube.com/watch?v=yUAikbw5BSQ

Not sure about that, but with this patch, I could successfully do the following:

$ cd refpolicy
$ make conf
$ make
$ sudo make install
$ sudo make load
Quoted 4 lines

And genhomedircon ran without complaint, and I have the expected entries in file_contexts.homedirs.
That's with the standard policy.

Ok thats good enough for me. I admit i just upgraded my systems, and made major changes to my policy so it may just be me.

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#5 lore raw
Quoted 51 lines · Dominick Grift
Quoted 50 lines · Stephen Smalley
Quoted 37 lines · Dominick Grift
Quoted 30 lines · Dominick Grift
Quoted 20 lines · Stephen Smalley

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

Stephen Smalley <[email protected]> --- libsemanage/src/genhomedircon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)

(quoted diff) +0 -0

b/libsemanage/src/genhomedircon.c index 6991fff..5e9d722 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c @@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out, goto fail; }

(quoted diff) +0 -1
-		if (sepol_context_set_user(sepolh, context, user->sename) <
Quoted 6 lines

0 || + if (sepol_context_set_user(sepolh, context,
user->sename) < 0) { + goto fail; + } + + if
(sepol_policydb_mls_enabled(s->policydb) && sepol_context_set_mls(sepolh, context, user->level) < 0) { goto fail; }

I could not get this to work:

Quoted 5 lines

libsemanage.validate_handler: seuser mapping [kcinimod -> (wheel.id, s0-s0:c0.c1023)] is invalid (No such file or directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory) semodule: failed!

Quoted 3 lines

for reference:

https://www.youtube.com/watch?v=yUAikbw5BSQ

Not sure about that, but with this patch, I could successfully do the following:

$ cd refpolicy
$ make conf
$ make
$ sudo make install
$ sudo make load
Quoted 9 lines
Quoted 4 lines

And genhomedircon ran without complaint, and I have the expected entries in file_contexts.homedirs.
That's with the standard policy.

Ok thats good enough for me. I admit i just upgraded my systems, and made major changes to my policy so it may just be me.

I might just be wrong though but i think it has to do with how cil allows you deal with seusers in policy (defaultselinuxuser and selinuxuser)

I think that is where it conflicts. basically i suspect that it hasnt dealt with generating the seusers file yet. and so it looks there and sees a range in a non mcs policy.

So i suspect that this is an issue, its just not a noticable with refpolicy becuase refpolicy copies its own seusers file

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#6 lore raw
Quoted 65 lines · Dominick Grift
Quoted 51 lines · Dominick Grift
Quoted 50 lines · Stephen Smalley
Quoted 37 lines · Dominick Grift
Quoted 30 lines · Dominick Grift
Quoted 20 lines · Stephen Smalley

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

Stephen Smalley <[email protected]> --- libsemanage/src/genhomedircon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)

(quoted diff) +0 -0

b/libsemanage/src/genhomedircon.c index 6991fff..5e9d722 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c @@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out, goto fail; }

(quoted diff) +0 -1
-		if (sepol_context_set_user(sepolh, context, user->sename) <
Quoted 6 lines

0 || + if (sepol_context_set_user(sepolh, context,
user->sename) < 0) { + goto fail; + } + + if
(sepol_policydb_mls_enabled(s->policydb) && sepol_context_set_mls(sepolh, context, user->level) < 0) { goto fail; }

I could not get this to work:

Quoted 5 lines

libsemanage.validate_handler: seuser mapping [kcinimod -> (wheel.id, s0-s0:c0.c1023)] is invalid (No such file or directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory) semodule: failed!

Quoted 3 lines

for reference:

https://www.youtube.com/watch?v=yUAikbw5BSQ

Not sure about that, but with this patch, I could successfully do the following:

$ cd refpolicy
$ make conf
$ make
$ sudo make install
$ sudo make load
Quoted 9 lines
Quoted 4 lines

And genhomedircon ran without complaint, and I have the expected entries in file_contexts.homedirs.
That's with the standard policy.

Ok thats good enough for me. I admit i just upgraded my systems, and made major changes to my policy so it may just be me.

I might just be wrong though but i think it has to do with how cil allows you deal with seusers in policy (defaultselinuxuser and selinuxuser)

Quoted 7 lines

I think that is where it conflicts. basically i suspect that it hasnt dealt with generating the seusers file yet. and so it looks there and sees a range in a non mcs policy.

So i suspect that this is an issue, its just not a noticable with refpolicy becuase refpolicy copies its own seusers file

I think the CIL people might be able to shed some light on this so CCing jwcart2

In particular how "selinuxuser and defaultselinuxuser" could affect or be affected by this patch

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#7 lore raw
Quoted 74 lines · Dominick Grift
Quoted 65 lines · Dominick Grift
Quoted 51 lines · Dominick Grift
Quoted 50 lines · Stephen Smalley
Quoted 37 lines · Dominick Grift
Quoted 30 lines · Dominick Grift
Quoted 20 lines · Stephen Smalley

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

Stephen Smalley <[email protected]> --- libsemanage/src/genhomedircon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)

(quoted diff) +0 -0

b/libsemanage/src/genhomedircon.c index 6991fff..5e9d722 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c @@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out, goto fail; }

(quoted diff) +0 -1
-		if (sepol_context_set_user(sepolh, context, user->sename) <
Quoted 6 lines

0 || + if (sepol_context_set_user(sepolh, context,
user->sename) < 0) { + goto fail; + } + + if
(sepol_policydb_mls_enabled(s->policydb) && sepol_context_set_mls(sepolh, context, user->level) < 0) { goto fail; }

I could not get this to work:

Quoted 5 lines

libsemanage.validate_handler: seuser mapping [kcinimod -> (wheel.id, s0-s0:c0.c1023)] is invalid (No such file or directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory) semodule: failed!

Quoted 3 lines

for reference:

https://www.youtube.com/watch?v=yUAikbw5BSQ

Not sure about that, but with this patch, I could successfully do the following:

$ cd refpolicy
$ make conf
$ make
$ sudo make install
$ sudo make load
Quoted 9 lines
Quoted 4 lines

And genhomedircon ran without complaint, and I have the expected entries in file_contexts.homedirs.
That's with the standard policy.

Ok thats good enough for me. I admit i just upgraded my systems, and made major changes to my policy so it may just be me.

I might just be wrong though but i think it has to do with how cil allows you deal with seusers in policy (defaultselinuxuser and selinuxuser)

Quoted 7 lines

I think that is where it conflicts. basically i suspect that it hasnt dealt with generating the seusers file yet. and so it looks there and sees a range in a non mcs policy.

So i suspect that this is an issue, its just not a noticable with refpolicy becuase refpolicy copies its own seusers file

Quoted 6 lines

I think the CIL people might be able to shed some light on this so CCing jwcart2

In particular how "selinuxuser and defaultselinuxuser" could affect or be affected by this patch

They won't be effected. cil_selinuxusers_to_string() will only print the mls parts if a MLS policy is specified.

Jim

Quoted 8 lines

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

Signature · 2 lines
James Carter <[email protected]>
National Security Agency
#8 lore raw
Quoted 81 lines · James Carter
Quoted 80 lines · Dominick Grift
Quoted 68 lines · Dominick Grift
Quoted 53 lines · Dominick Grift
Quoted 52 lines · Stephen Smalley
Quoted 39 lines · Dominick Grift
Quoted 32 lines · Dominick Grift
Quoted 19 lines · Stephen Smalley

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

Stephen Smalley <[email protected]> --- libsemanage/src/genhomedircon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)

(quoted diff) +0 -0

b/libsemanage/src/genhomedircon.c index 6991fff..5e9d722 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c @@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out, goto fail; }

Quoted 9 lines

- if (sepol_context_set_user(sepolh, context,
user->sename) <
0 || + if (sepol_context_set_user(sepolh, context,
user->sename) < 0) { + goto fail; + } +
+ if
(sepol_policydb_mls_enabled(s->policydb) && sepol_context_set_mls(sepolh, context, user->level) < 0) { goto fail; }

I could not get this to work:

Quoted 5 lines

libsemanage.validate_handler: seuser mapping [kcinimod -> (wheel.id, s0-s0:c0.c1023)] is invalid (No such file or directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory) semodule: failed!

Quoted 3 lines

for reference:

https://www.youtube.com/watch?v=yUAikbw5BSQ

Not sure about that, but with this patch, I could successfully do the following:

$ cd refpolicy
$ make conf
$ make
$ sudo make install
$ sudo make load
Quoted 9 lines
Quoted 4 lines

And genhomedircon ran without complaint, and I have the expected entries in file_contexts.homedirs.
That's with the standard policy.

Ok thats good enough for me. I admit i just upgraded my systems, and made major changes to my policy so it may just be me.

I might just be wrong though but i think it has to do with how cil allows you deal with seusers in policy (defaultselinuxuser and selinuxuser)

Quoted 7 lines

I think that is where it conflicts. basically i suspect that it hasnt dealt with generating the seusers file yet. and so it looks there and sees a range in a non mcs policy.

So i suspect that this is an issue, its just not a noticable with refpolicy becuase refpolicy copies its own seusers file

I think the CIL people might be able to shed some light on this so CCing jwcart2

Quoted 6 lines
Quoted 3 lines

In particular how "selinuxuser and defaultselinuxuser" could affect or be affected by this patch

They won't be effected. cil_selinuxusers_to_string() will only print the mls parts if a MLS policy is specified.

And the other way around? Could the patch above cause things to break because the seusers arent updated yet?

e.g. switching on the fly from an mls policy to a standard policy.

the seusers need to be processed. could it be that this patch makes it fail because the seusers havent been processed yet

as you can see here:

libsemanage.validate_handler: seuser mapping [kcinimod ->
(wheel.id, s0-s0:c0.c1023)] is invalid (No such file or
directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory) semodule: failed!

it is refereing to my seuser mapping. That mapping is from the initial mls policy. So it hasnt been processed yet, because if it was then it would not have mentioned the s0-s0:c0.c1023

Quoted 13 lines

Jim

Quoted 9 lines

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#9 lore raw
In reply to James Carter
Quoted 81 lines · James Carter
Quoted 80 lines · Dominick Grift
Quoted 68 lines · Dominick Grift
Quoted 53 lines · Dominick Grift
Quoted 52 lines · Stephen Smalley
Quoted 39 lines · Dominick Grift
Quoted 32 lines · Dominick Grift
Quoted 19 lines · Stephen Smalley

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

Stephen Smalley <[email protected]> --- libsemanage/src/genhomedircon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)

(quoted diff) +0 -0

b/libsemanage/src/genhomedircon.c index 6991fff..5e9d722 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c @@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out, goto fail; }

Quoted 9 lines

- if (sepol_context_set_user(sepolh, context,
user->sename) <
0 || + if (sepol_context_set_user(sepolh, context,
user->sename) < 0) { + goto fail; + } +
+ if
(sepol_policydb_mls_enabled(s->policydb) && sepol_context_set_mls(sepolh, context, user->level) < 0) { goto fail; }

I could not get this to work:

Quoted 5 lines

libsemanage.validate_handler: seuser mapping [kcinimod -> (wheel.id, s0-s0:c0.c1023)] is invalid (No such file or directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory) semodule: failed!

Quoted 3 lines

for reference:

https://www.youtube.com/watch?v=yUAikbw5BSQ

Not sure about that, but with this patch, I could successfully do the following:

$ cd refpolicy
$ make conf
$ make
$ sudo make install
$ sudo make load
Quoted 9 lines
Quoted 4 lines

And genhomedircon ran without complaint, and I have the expected entries in file_contexts.homedirs.
That's with the standard policy.

Ok thats good enough for me. I admit i just upgraded my systems, and made major changes to my policy so it may just be me.

I might just be wrong though but i think it has to do with how cil allows you deal with seusers in policy (defaultselinuxuser and selinuxuser)

Quoted 7 lines

I think that is where it conflicts. basically i suspect that it hasnt dealt with generating the seusers file yet. and so it looks there and sees a range in a non mcs policy.

So i suspect that this is an issue, its just not a noticable with refpolicy becuase refpolicy copies its own seusers file

I think the CIL people might be able to shed some light on this so CCing jwcart2

Quoted 9 lines
Quoted 3 lines

In particular how "selinuxuser and defaultselinuxuser" could affect or be affected by this patch

They won't be effected. cil_selinuxusers_to_string() will only print the mls parts if a MLS policy is specified.

Jim

Thanks. I thought about this and I think i see now what the issue is. and i suppose i can live with this "limitation"

It is indeed choking on seusers{.local}

if i manually remove /etc/selinux/SELINUXTYPE/seusers and /var/lib/selinux/SELINUXTYPE/seusers{.local} then it works

The problem is that i am switching model without switching SELINUXTYPE. libsemanage can't deal with that and I suppose there never was a need for this because It never was possible to switch models with semodule alone

So on the one hand the patch above works, but on the other hand it raises the question about whether libsemanage should support switching modules without switcing SELINUXTYPE.

Quoted 11 lines
Quoted 9 lines

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#10 lore raw
In reply to Dominick Grift
Quoted 30 lines · Dominick Grift
Quoted 20 lines · Stephen Smalley

When a non-MLS policy was used with genhomedircon context_from_record() in sepol would report an error because an MLS level was present when MLS is disabled. Based on a patch by Gary Tierney, amended to use sepol_policydb_mls_enabled rather than semanage_mls_enabled because we are testing the temporary working policy, not the active policy.

Stephen Smalley <[email protected]> --- libsemanage/src/genhomedircon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)

(quoted diff) +0 -0

b/libsemanage/src/genhomedircon.c index 6991fff..5e9d722 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c @@ -638,7 +638,11 @@ static int write_contexts(genhomedircon_settings_t *s, FILE *out, goto fail; }

(quoted diff) +0 -1
-		if (sepol_context_set_user(sepolh, context, user->sename) < 0
Quoted 6 lines

|| + if (sepol_context_set_user(sepolh, context, user->sename) <
0) { + goto fail; + } + + if
(sepol_policydb_mls_enabled(s->policydb) && sepol_context_set_mls(sepolh, context, user->level) < 0) { goto fail; }

I could not get this to work:

Quoted 4 lines

libsemanage.validate_handler: seuser mapping [kcinimod -> (wheel.id, s0-s0:c0.c1023)] is invalid (No such file or directory). libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory) semodule: failed!

I don't see what that error has to do with the patch in question. Is this a separate problem with using non-MLS policies?