Skip to contentSkip to conversation

Critical bug in semanage

PATCH Daniel J Walsh 5 participants 7 messages Jul 17, 2008 – Jul 29, 2008 SELinux security module

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

homedirs in /var and /usr/local were not being matched, causing bad context to be added.

genhomedircon port problem.

An extra / at the end of the regex was causing the problem

Geesh I love 'C'. :^P
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkh/k8IACgkQrlYvE4MpobPojgCggaXEFTVV+JdunE/jLOjhiTff +E4AoOSIYWVPVlRJ2w7LAo7ewCmt/+KY
=xb2w
-----END PGP SIGNATURE-----

src/genhomedircon.c +5 -0
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/genhomedircon.c libsemanage-2.0.25/src/genhomedircon.c
@@ -192,6 +193,11 @@
 			goto done;
 	}
 
+	if (ustr_cmp_suffix_cstr_eq(expr, "/")) {
+		if (!ustr_del(&expr, 1))
+			goto done;
+	}
+
 	/* Append pattern to eat up trailing slashes */
 	if (!ustr_add_cstr(&expr, "/*$"))
 		goto done;
#1 lore raw
Quoted 11 lines · Daniel J Walsh

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

homedirs in /var and /usr/local were not being matched, causing bad context to be added.

genhomedircon port problem.

An extra / at the end of the regex was causing the problem

Geesh I love 'C'. :^P

It has less to do with C and more to do with crazy string libraries :)

I'm not sure what the intention is here though, the comment directly below your patch says
" /* Append pattern to eat up trailing slashes */"

How is that not what you are trying to do?

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#2 lore raw
Quoted 11 lines · Joshua Brindle
Quoted 10 lines · Daniel J Walsh

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

homedirs in /var and /usr/local were not being matched, causing bad context to be added.

genhomedircon port problem.

An extra / at the end of the regex was causing the problem

Quoted 8 lines
Quoted 1 line

Geesh I love 'C'. :^P

It has less to do with C and more to do with crazy string libraries :)

I'm not sure what the intention is here though, the comment directly below your patch says
" /* Append pattern to eat up trailing slashes */"

How is that not what you are trying to do?

Trailing / in the pathname regex versus trailing / in the pathname being matched, IIUC.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 15 lines · Stephen Smalley
Quoted 14 lines · Joshua Brindle
Quoted 11 lines · Daniel J Walsh

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

homedirs in /var and /usr/local were not being matched, causing bad context to be added.

genhomedircon port problem.

An extra / at the end of the regex was causing the problem

Geesh I love 'C'. :^P

It has less to do with C and more to do with crazy string libraries :)

Quoted 8 lines
Quoted 4 lines

I'm not sure what the intention is here though, the comment directly below your patch says
" /* Append pattern to eat up trailing slashes */"

How is that not what you are trying to do?

Trailing / in the pathname regex versus trailing / in the pathname being matched, IIUC.

Yes the problem wat the tool was not matching

/var/.* system_u:object_r:var_t:s0

Ended up trying to compare
/var/ to /var

And failing to see the similarities.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkiA0/AACgkQrlYvE4MpobMG0ACfSKO9rfQC9iB44zxC5mrIMqKF anIAn1pKhwbklwdVUPtAElYjEoN6s4t1
=hEeI
-----END PGP SIGNATURE-----

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#4 lore raw

Setting login context for multiple Linux users using single semanage command...

In reply to Stephen Smalley

Hi All,

If I wanted to map multiple Linux users (Test1, Test2, and Test3), to a single SELinux user (staff_u),

Can I use a single semanage command to do this, instead of executing multiple semanage commands?

In other words,instead of executing:
semanage login -a -s staff_u Test1
semanage login -a -s staff_u Test2
semanage login -a -s staff_u Test3

Can I do something like: semanage login -a -s staff_u 'Test1 Test2
Test3'

Thanks as always for your help,

- Rezaul.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#5 lore raw

Re: Setting login context for multiple Linux users using single semanage command...

Quoted 13 lines · On Mon, 2008-07-21 at 13:41 -0400, Hasan Rezaul-CHR010 wrote:

Hi All,

If I wanted to map multiple Linux users (Test1, Test2, and Test3), to a single SELinux user (staff_u),

Can I use a single semanage command to do this, instead of executing multiple semanage commands?

In other words,instead of executing:
semanage login -a -s staff_u Test1
semanage login -a -s staff_u Test2
semanage login -a -s staff_u Test3

Quoted 4 lines

Can I do something like: semanage login -a -s staff_u 'Test1 Test2
Test3'

Thanks as always for your help,

Abstractly, that would be possible to do, but I doubt the semanage command today supports that syntax. The underpinnings of it (libsemanage) certainly would support applying several changes in the same transaction, just as you can install multiple policy modules on the same transaction using semodule. So I'd call this a deficiency of the semanage UI and patches of course are always welcome. I think we'd want something clearer though than just the quoted list.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#6 lore raw

Re: Setting login context for multiple Linux users using single semanage command...

Quoted 29 lines · Stephen Smalley
Quoted 13 lines · On Mon, 2008-07-21 at 13:41 -0400, Hasan Rezaul-CHR010 wrote:

Hi All,

If I wanted to map multiple Linux users (Test1, Test2, and Test3), to a single SELinux user (staff_u),

Can I use a single semanage command to do this, instead of executing multiple semanage commands?

In other words,instead of executing:
semanage login -a -s staff_u Test1
semanage login -a -s staff_u Test2
semanage login -a -s staff_u Test3

Quoted 4 lines

Can I do something like: semanage login -a -s staff_u 'Test1 Test2
Test3'

Thanks as always for your help,

Abstractly, that would be possible to do, but I doubt the semanage command today supports that syntax. The underpinnings of it (libsemanage) certainly would support applying several changes in the same transaction, just as you can install multiple policy modules on the same transaction using semodule. So I'd call this a deficiency of the semanage UI and patches of course are always welcome. I think we'd want something clearer though than just the quoted list.

Quoted 4 lines

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

A mere matter of coding. I have begun doing some of this with booleans.

I think the tool needs a way to set multiple and extract the custom settings so that they can be sent to other machines.

IE Extract all customizations from this machine and make all other machines match.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.