Skip to contentSkip to conversation

selinux-testsuite: Allow test domains to read /etc/passwd

PATCH Applied Stephen Smalley 4 participants 11 messages Sep 13, 2012 – Sep 25, 2012 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux-testsuite: Allow test domains to read /etc/passwd

Several test cases require the ability to read /etc/passwd to look up usernames. Recent Fedora introduced a separate type on /etc/passwd and therefore we need to add an interface call to test_global.te. Fixes three test failures on Fedora 17.

---
 policy/test_global.te | 2 ++
 1 file changed, 2 insertions(+)
policy/test_global.te +2 -0
index 77121ae..fdfd291 100644
@@ -88,3 +88,5 @@ selinux_compute_access_vector(testdomain)
 selinux_compute_create_context(testdomain)
 selinux_compute_relabel_context(testdomain)
 selinux_compute_user_contexts(testdomain)
+
+auth_read_passwd(testdomain)
Signature · 12 lines
1.7.11.4


-- 
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.
#1 lore raw

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

Quoted 9 lines · Stephen Smalley

Several test cases require the ability to read /etc/passwd to look up usernames. Recent Fedora introduced a separate type on /etc/passwd and therefore we need to add an interface call to test_global.te. Fixes three test failures on Fedora 17.

policy/test_global.te | 2 ++ 1 file changed, 2 insertions(+)

policy/test_global.te index renamed from policy/test_global.te +0 -0
Quoted 7 lines

77121ae..fdfd291 100644 --- a/policy/test_global.te +++ b/policy/test_global.te @@ -88,3 +88,5 @@ selinux_compute_access_vector(testdomain) selinux_compute_create_context(testdomain) selinux_compute_relabel_context(testdomain) selinux_compute_user_contexts(testdomain) + +auth_read_passwd(testdomain)

Probably should use

auth_use_nsswitch(testdomain)

Since this will handle cases where users are listed in ldap or use sssd. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBR+2oACgkQrlYvE4MpobMW4wCfatkbYxWYNhJCWH96YUS8frm8 kwMAoJrC6pS6YOFQcYlNFtqE07hFn6ia
=NZ1T
-----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.

#2 lore raw

PATCH 1/1 selinux-testsuite: Allow test domains to read /etc/passwd

Quoted 3 lines · Daniel J Walsh
Quoted 3 lines

selinux_compute_create_context(testdomain)
selinux_compute_relabel_context(testdomain)
selinux_compute_user_contexts(testdomain) +

+auth_read_passwd(testdomain)

Quoted 6 lines
Quoted 1 line

Probably should use

auth_use_nsswitch(testdomain)

Since this will handle cases where users are listed in ldap or use sssd.

Also please try to not depend on distribution policies but rather
refpolicy. Other distributions don't use a separate type for passwd (yet?) and I don't know if the interface suggested before is also supported. -------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.tresys.com/pipermail/refpolicy/attachments/20120914/cfc0a1d8/attachment.html

#3 lore raw
In reply to Daniel J Walsh
Quoted 22 lines · Daniel J Walsh

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

Quoted 9 lines · Stephen Smalley

Several test cases require the ability to read /etc/passwd to look up usernames. Recent Fedora introduced a separate type on /etc/passwd and therefore we need to add an interface call to test_global.te. Fixes three test failures on Fedora 17.

policy/test_global.te | 2 ++ 1 file changed, 2 insertions(+)

policy/test_global.te index renamed from policy/test_global.te +0 -0
Quoted 7 lines

77121ae..fdfd291 100644 --- a/policy/test_global.te +++ b/policy/test_global.te @@ -88,3 +88,5 @@ selinux_compute_access_vector(testdomain) selinux_compute_create_context(testdomain) selinux_compute_relabel_context(testdomain) selinux_compute_user_contexts(testdomain) + +auth_read_passwd(testdomain)

Probably should use

Quoted 3 lines

auth_use_nsswitch(testdomain)

Since this will handle cases where users are listed in ldap or use sssd.

Stephen, would you like that instead?

thanks,
-serge

--
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
Quoted 23 lines · Serge E. Hallyn
Quoted 22 lines · Daniel J Walsh

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

Quoted 9 lines · Stephen Smalley

Several test cases require the ability to read /etc/passwd to look up usernames. Recent Fedora introduced a separate type on /etc/passwd and therefore we need to add an interface call to test_global.te. Fixes three test failures on Fedora 17.

policy/test_global.te | 2 ++ 1 file changed, 2 insertions(+)

policy/test_global.te index renamed from policy/test_global.te +0 -0
Quoted 7 lines

77121ae..fdfd291 100644 --- a/policy/test_global.te +++ b/policy/test_global.te @@ -88,3 +88,5 @@ selinux_compute_access_vector(testdomain) selinux_compute_create_context(testdomain) selinux_compute_relabel_context(testdomain) selinux_compute_user_contexts(testdomain) + +auth_read_passwd(testdomain)

Probably should use

Quoted 5 lines
Quoted 3 lines

auth_use_nsswitch(testdomain)

Since this will handle cases where users are listed in ldap or use sssd.

Stephen, would you like that instead?

No, it doesn't work - you cannot pass an attribute name to that interface.

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.
#5 lore raw

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

Quoted 24 lines · Stephen Smalley
Quoted 23 lines · Serge E. Hallyn
Quoted 22 lines · Daniel J Walsh

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

Quoted 9 lines · Stephen Smalley

Several test cases require the ability to read /etc/passwd to look up usernames. Recent Fedora introduced a separate type on /etc/passwd and therefore we need to add an interface call to test_global.te. Fixes three test failures on Fedora 17.

policy/test_global.te | 2 ++ 1 file changed, 2 insertions(+)

policy/test_global.te index renamed from policy/test_global.te +0 -0
Quoted 8 lines

77121ae..fdfd291 100644 --- a/policy/test_global.te +++ b/policy/test_global.te @@ -88,3 +88,5 @@ selinux_compute_access_vector(testdomain) selinux_compute_create_context(testdomain) selinux_compute_relabel_context(testdomain) selinux_compute_user_contexts(testdomain) + +auth_read_passwd(testdomain)

Probably should use

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

auth_use_nsswitch(testdomain)

Since this will handle cases where users are listed in ldap or use sssd.

Stephen, would you like that instead?

No, it doesn't work - you cannot pass an attribute name to that interface.

Ahh yes, you can not assign an attribute to an attribute. That is right up there with no assigning an attribute within a boolean as my least liked things about our policy compiler.

I guess you need to add auth_use_nsswitch() for each type that gets set to test_domain.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBYoi4ACgkQrlYvE4MpobP60wCgl/6UDWf0MSTnjfr1psB6DsvB hdIAoImqV09iWasmP1hnuNAiOl0Mf8O4
=lf6L
-----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.

#6 lore raw
Quoted 35 lines · Daniel J Walsh
Quoted 24 lines · Stephen Smalley
Quoted 23 lines · Serge E. Hallyn
Quoted 22 lines · Daniel J Walsh

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

Quoted 9 lines · Stephen Smalley

Several test cases require the ability to read /etc/passwd to look up usernames. Recent Fedora introduced a separate type on /etc/passwd and therefore we need to add an interface call to test_global.te. Fixes three test failures on Fedora 17.

policy/test_global.te | 2 ++ 1 file changed, 2 insertions(+)

policy/test_global.te index renamed from policy/test_global.te +0 -0
Quoted 8 lines

77121ae..fdfd291 100644 --- a/policy/test_global.te +++ b/policy/test_global.te @@ -88,3 +88,5 @@ selinux_compute_access_vector(testdomain) selinux_compute_create_context(testdomain) selinux_compute_relabel_context(testdomain) selinux_compute_user_contexts(testdomain) + +auth_read_passwd(testdomain)

Probably should use

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

auth_use_nsswitch(testdomain)

Since this will handle cases where users are listed in ldap or use sssd.

Stephen, would you like that instead?

No, it doesn't work - you cannot pass an attribute name to that interface.

Quoted 7 lines

Ahh yes, you can not assign an attribute to an attribute. That is right up there with no assigning an attribute within a boolean as my least liked things about our policy compiler.

I guess you need to add auth_use_nsswitch() for each type that gets set to test_domain.

That would be rather painful. For now, let's just use auth_read_passwd(testdomain). Works for me.

auth_use_nsswitch() might have undesirable side effects, like allowing every test domain network access. Which would then prevent testing enforcement of the socket permission checks.

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.
#7 lore raw

Thanks, applied.

--
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.

#8 lore raw
Quoted 1 line · Serge E. Hallyn

Thanks, applied.

Can we please get auth_read_passwd defined in refpolicy then? If anything, have it grant read access to etc_t. Otherwise tests in other distributions but fedora will fail.

#9 lore raw

PATCH 1/1 selinux-testsuite: Wrap auth_read_passwd with ifdef(`distro_redhat') .

Wrap Fedora-specific policy with an ifdef. Alternative would be to fork a copy of the test policy per distro under policy/<distro>/<release> as we have already done for redhat 4 and 5.
But I'd prefer to only do that for long-term stable/enterprise releases that won't be changing very often.

---
 policy/test_global.te | 2 ++
 1 file changed, 2 insertions(+)
policy/test_global.te +2 -0
index fdfd291..b92cc1c 100644
@@ -89,4 +89,6 @@ selinux_compute_create_context(testdomain)
 selinux_compute_relabel_context(testdomain)
 selinux_compute_user_contexts(testdomain)
 
+ifdef(`distro_redhat', `
 auth_read_passwd(testdomain)
+')
Signature · 12 lines
1.7.11.4


-- 
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.
#10 lore raw

Re: [PATCH] selinux-testsuite: Wrap auth_read_passwd with ifdef(`distro_redhat') .

Quoted 24 lines · Stephen Smalley

Wrap Fedora-specific policy with an ifdef. Alternative would be to fork a copy of the test policy per distro under policy/<distro>/<release> as we have already done for redhat 4 and 5.
But I'd prefer to only do that for long-term stable/enterprise releases that won't be changing very often.

---
 policy/test_global.te | 2 ++
 1 file changed, 2 insertions(+)
policy/test_global.te +2 -0
index fdfd291..b92cc1c 100644
@@ -89,4 +89,6 @@ selinux_compute_create_context(testdomain)
 selinux_compute_relabel_context(testdomain)
 selinux_compute_user_contexts(testdomain)
 
+ifdef(`distro_redhat', `
 auth_read_passwd(testdomain)
+')
Signature · 1 line
1.7.11.4

Applied, thanks.

--
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.