Skip to contentSkip to conversation

Patch to libsemanage to remove labeling of /root

PATCH Daniel J Walsh 4 participants 24 messages Jan 13, 2009 – Feb 28, 2009 SELinux security module

lore
Share & tools
lore
#0 lore raw

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

Policy should label /root with one label and this should not be effected by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label vary depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Labeling this directory as user_home_t, opens the system to possible security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAklslqMACgkQrlYvE4MpobPY/ACdHitHOeU+c77VVePxkkTpmSsw M2gAoJxZPlUKHJ3cL0zIb8fuHMq5VSRz
=LmKq
-----END PGP SIGNATURE-----

src/genhomedircon.c +6 -0
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/genhomedircon.c libsemanage-2.0.30/src/genhomedircon.c
@@ -794,6 +792,12 @@
 			 * /root */
 			continue;
 		}
+		if (strcmp(pwent->pw_dir, "/root") == 0) {
+			/* don't relabel / genhomdircon checked to see if root
+			 * was the user and if so, set his home directory to
+			 * /root */
+			continue;
+		}
 		if (push_user_entry(&head, name, seuname,
 				    prefix, pwent->pw_dir) != STATUS_SUCCESS) {
 			*errors = STATUS_ERR;
#1 lore raw
Quoted 9 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label vary depending on policy ends up with lines like

Quoted 8 lines

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Labeling this directory as user_home_t, opens the system to possible security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a huge whitelist for genhomedircon?

                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked to see if root
                         * was the user and if so, set his home directory to
                         * /root */
                        continue;
                }

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

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

Quoted 23 lines · Joshua Brindle
Quoted 9 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label vary depending on policy ends up with lines like

Quoted 8 lines

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Labeling this directory as user_home_t, opens the system to possible security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a huge whitelist for genhomedircon?

Quoted 8 lines
                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked to see
if root
                         * was the user and if so, set his home
directory to
                         * /root */
                        continue;
                }

No just /root

/root should not be labeled based on genhomedircon.

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

iEYEARECAAYFAkmbHrcACgkQrlYvE4MpobMOIACgi1w9HmZUACVvhyoJEgivYWQH WFgAn3WU11TDfFIx4wld0IKDbMYOe2Ks
=C4WY
-----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.

#3 lore raw
Quoted 34 lines · Daniel J Walsh

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

Quoted 22 lines · Joshua Brindle
Quoted 9 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label vary depending on policy ends up with lines like

Quoted 8 lines

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Labeling this directory as user_home_t, opens the system to possible security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a huge whitelist for genhomedircon?

Quoted 8 lines
                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked to see
if root
                         * was the user and if so, set his home
directory to
                         * /root */
                        continue;
                }
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

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

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

Quoted 36 lines · Joshua Brindle
Quoted 35 lines · Daniel J Walsh

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

Quoted 31 lines · Joshua Brindle
Quoted 10 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label vary depending on policy ends up with lines like

Quoted 8 lines

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Labeling this directory as user_home_t, opens the system to possible security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a huge whitelist for genhomedircon?

                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked to see
if root
                         * was the user and if so, set his home
directory to
                         * /root */
                        continue;
                }
Quoted 8 lines
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Well I guess we do want to protect / and /root.

Others should be fixed by looking at the parent, so if I added /var as a homedir it would blow up saying it conflicts with the previous definition of /var.

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

iEYEARECAAYFAkmbIJEACgkQrlYvE4MpobOMKwCfQ0ucpjUpGQJ4tDTN3zZTMWoH OPYAnjP/3JCDijP93ubH9+cCKzJa+vJm
=eAyd
-----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.

#5 lore raw
Quoted 44 lines · Daniel J Walsh

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

Quoted 40 lines · Joshua Brindle
Quoted 39 lines · Daniel J Walsh

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

Quoted 23 lines · Joshua Brindle
Quoted 10 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label vary depending on policy ends up with lines like

Quoted 8 lines

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Labeling this directory as user_home_t, opens the system to possible security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a huge whitelist for genhomedircon?

Quoted 8 lines
                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked to see
if root
                         * was the user and if so, set his home
directory to
                         * /root */
                        continue;
                }

No just /root

/root should not be labeled based on genhomedircon.

Quoted 9 lines
Quoted 3 lines

Why are the exact same lines there for "/" then?

Well I guess we do want to protect / and /root.

Others should be fixed by looking at the parent, so if I added /var as a homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

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

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

Quoted 50 lines · Joshua Brindle
Quoted 49 lines · Daniel J Walsh

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

Quoted 45 lines · Joshua Brindle
Quoted 37 lines · Daniel J Walsh

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

Quoted 25 lines · Joshua Brindle
Quoted 16 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label vary
depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Quoted 4 lines

Labeling this directory as user_home_t, opens the system to possible security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a huge whitelist for genhomedircon?

Quoted 8 lines
                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked to see
if root
                         * was the user and if so, set his home
directory to
                         * /root */
                        continue;
                }
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Quoted 8 lines
Quoted 6 lines

Well I guess we do want to protect / and /root.

Others should be fixed by looking at the parent, so if I added /var as a homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

Right now we do not know what /root is going to be labeled.

Sometime it is labeled admin_home_t sometimes sysadm_home_dir_t other times user_home_dir_t.

I believe this is wrong. It is not a "USER" home dir, it is something
far more special.

Allowing it to be set by an application like genhomedircon, prevents us from knowing what the label should be.

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

iEYEARECAAYFAkmbKVYACgkQrlYvE4MpobN5JgCg0Vf6Qe67UhBSc9DSjAUOnfTq 3KYAn2BSJAPHrmHDuCTpTD3rV889mJea
=uDb7
-----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.

#7 lore raw
Quoted 63 lines · Daniel J Walsh

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

Quoted 50 lines · Joshua Brindle
Quoted 49 lines · Daniel J Walsh

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

Quoted 45 lines · Joshua Brindle
Quoted 37 lines · Daniel J Walsh

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

Quoted 25 lines · Joshua Brindle
Quoted 16 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label vary
depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Quoted 4 lines

Labeling this directory as user_home_t, opens the system to possible security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a huge whitelist for genhomedircon?

Quoted 8 lines
                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked to see
if root
                         * was the user and if so, set his home
directory to
                         * /root */
                        continue;
                }
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Quoted 7 lines
Quoted 6 lines

Well I guess we do want to protect / and /root.

Others should be fixed by looking at the parent, so if I added /var as a homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

Right now we do not know what /root is going to be labeled.

Quoted 9 lines

Sometime it is labeled admin_home_t sometimes sysadm_home_dir_t other times user_home_dir_t.

I believe this is wrong. It is not a "USER" home dir, it is something
far more special.

Allowing it to be set by an application like genhomedircon, prevents us from knowing what the label should be.

Chris and I talked about this and we both think the same thing, genhomedircon is not in the business of knowing who is and is not an administrative user, "special" user, etc. root _is_ a user, and on an SELinux system can be an unprivileged user.

I think hardcoding in the library the specialness of /root is a bad idea, what if someone changes roots default role to user_r to make it unprivileged? They'd also need to change the file context entries explicitly with this patch rather than genhomedircon simply updating the entries.

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

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

Quoted 83 lines · Joshua Brindle
Quoted 67 lines · Daniel J Walsh

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

Quoted 53 lines · Joshua Brindle
Quoted 52 lines · Daniel J Walsh

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

Quoted 48 lines · Joshua Brindle
Quoted 40 lines · Daniel J Walsh

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

Quoted 29 lines · Joshua Brindle
Quoted 16 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label vary
depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Quoted 5 lines

Labeling this directory as user_home_t, opens the system to possible
security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a
huge whitelist for genhomedircon?

                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked
Quoted 7 lines

to see
if root
* was the user and if so, set his home
directory to

                         * /root */
                        continue;
                }
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Quoted 8 lines
Quoted 7 lines

Well I guess we do want to protect / and /root.

Others should be fixed by looking at the parent, so if I added /var as a
homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

Right now we do not know what /root is going to be labeled.

Quoted 9 lines

Sometime it is labeled admin_home_t sometimes sysadm_home_dir_t other times user_home_dir_t.

I believe this is wrong. It is not a "USER" home dir, it is something
far more special.

Allowing it to be set by an application like genhomedircon, prevents us from knowing what the label should be.

Chris and I talked about this and we both think the same thing, genhomedircon is not in the business of knowing who is and is not an administrative user, "special" user, etc. root _is_ a user, and on an SELinux system can be an unprivileged user.

Quoted 5 lines

I think hardcoding in the library the specialness of /root is a bad idea, what if someone changes roots default role to user_r to make it unprivileged? They'd also need to change the file context entries explicitly with this patch rather than genhomedircon simply updating the entries.

The problem with treating /root as the same as every other homedir, is confined daemons all consider /root their home dir, so they want to be able to read/write contents in the homedir. Lots of domains look at the
homedir and or getstarted in the /root directory and end up causing an
AVC looking at the current working directory. So we end up with a dontaudit_search_admin_home_dir. Which will not work if the context of the homedir varies.

Allowing user_r on the /root directory would be a bad idea since he would be able to modify .bash_profile and other scripts that could effect the way that a real admin works.

So I will carry the patch and eventually would like to get rid of genhomedircon all together an move to a mechanism where an admin can specify where his homedirs are and where is altermate directories are.

/home == /export/home

Which would then duplicate all of the contexts prefixed with /home to /export/home

Similarly

/var/www == /src/www

This would give administrators greater flexibility and would get us out of the business of guessing what a homedir, is.

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

iEYEARECAAYFAkmcMsgACgkQrlYvE4MpobMOHwCdHAOH+V7toBSSc9sKvHriIbpk e0wAoOTRd99vqmiBDheOitHzn+DqdqZN
=erUT
-----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.

#9 lore raw
Quoted 91 lines · Daniel J Walsh

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

Quoted 82 lines · Joshua Brindle
Quoted 67 lines · Daniel J Walsh

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

Quoted 53 lines · Joshua Brindle
Quoted 52 lines · Daniel J Walsh

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

Quoted 48 lines · Joshua Brindle
Quoted 40 lines · Daniel J Walsh

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

Quoted 29 lines · Joshua Brindle
Quoted 16 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label vary
depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Quoted 5 lines

Labeling this directory as user_home_t, opens the system to possible
security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a
huge whitelist for genhomedircon?

                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked
Quoted 7 lines

to see
if root
* was the user and if so, set his home
directory to

                         * /root */
                        continue;
                }
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Quoted 8 lines
Quoted 7 lines

Well I guess we do want to protect / and /root.

Others should be fixed by looking at the parent, so if I added /var as a
homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

Right now we do not know what /root is going to be labeled.

Quoted 9 lines

Sometime it is labeled admin_home_t sometimes sysadm_home_dir_t other times user_home_dir_t.

I believe this is wrong. It is not a "USER" home dir, it is something
far more special.

Allowing it to be set by an application like genhomedircon, prevents us from knowing what the label should be.

Chris and I talked about this and we both think the same thing, genhomedircon is not in the business of knowing who is and is not an administrative user, "special" user, etc. root _is_ a user, and on an SELinux system can be an unprivileged user.

Quoted 5 lines

I think hardcoding in the library the specialness of /root is a bad idea, what if someone changes roots default role to user_r to make it unprivileged? They'd also need to change the file context entries explicitly with this patch rather than genhomedircon simply updating the entries.

Quoted 8 lines

The problem with treating /root as the same as every other homedir, is confined daemons all consider /root their home dir, so they want to be able to read/write contents in the homedir. Lots of domains look at the
homedir and or getstarted in the /root directory and end up causing an
AVC looking at the current working directory. So we end up with a dontaudit_search_admin_home_dir. Which will not work if the context of the homedir varies.

I don't see where the source of the problem is coming in here. Is it because end users are changing the role of root and there are all of a sudden denials? If end users are changing roots role they probably would need to add some policy.

Quoted 4 lines

Allowing user_r on the /root directory would be a bad idea since he would be able to modify .bash_profile and other scripts that could effect the way that a real admin works.

There are legitimate use cases where root should be unprivileged (embedded systems, appliances, etc). We allow that flexibility and can't undermine it in a hard coded way in the library.

Quoted 1 line

So I will carry the patch and eventually would like to get rid of

I really don't think you should do this. My objections to merging it are rendered moot if the primary selinux distribution ships it anyway.

Quoted 3 lines

genhomedircon all together an move to a mechanism where an admin can specify where his homedirs are and where is altermate directories are.

So why not add this feature now? A simple variable in semanage.conf should suffice.

Quoted 5 lines

/home == /export/home

Which would then duplicate all of the contexts prefixed with /home to /export/home

Quoted 7 lines

Similarly

/var/www == /src/www

This would give administrators greater flexibility and would get us out of the business of guessing what a homedir, is.

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

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

Quoted 107 lines · Joshua Brindle
Quoted 92 lines · Daniel J Walsh

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

Quoted 83 lines · Joshua Brindle
Quoted 68 lines · Daniel J Walsh

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

Quoted 54 lines · Joshua Brindle
Quoted 53 lines · Daniel J Walsh

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

Quoted 49 lines · Joshua Brindle
Quoted 41 lines · Daniel J Walsh

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

Quoted 30 lines · Joshua Brindle
Quoted 17 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label
vary
depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Quoted 5 lines

Labeling this directory as user_home_t, opens the system to possible
security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a
huge whitelist for genhomedircon?

                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked
Quoted 7 lines

to see
if root
* was the user and if so, set his home
directory to

                         * /root */
                        continue;
                }
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Quoted 8 lines
Quoted 7 lines

Well I guess we do want to protect / and /root.

Others should be fixed by looking at the parent, so if I added /var as a
homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

Right now we do not know what /root is going to be labeled.

Quoted 9 lines

Sometime it is labeled admin_home_t sometimes sysadm_home_dir_t other times user_home_dir_t.

I believe this is wrong. It is not a "USER" home dir, it is something
far more special.

Allowing it to be set by an application like genhomedircon, prevents us from knowing what the label should be.

Chris and I talked about this and we both think the same thing, genhomedircon is not in the business of knowing who is and is not an administrative user, "special" user, etc. root _is_ a user, and on an SELinux system can be an unprivileged user.

Quoted 5 lines

I think hardcoding in the library the specialness of /root is a bad idea, what if someone changes roots default role to user_r to make it unprivileged? They'd also need to change the file context entries explicitly with this patch rather than genhomedircon simply updating the entries.

Quoted 8 lines

The problem with treating /root as the same as every other homedir, is confined daemons all consider /root their home dir, so they want to be able to read/write contents in the homedir. Lots of domains look at the
homedir and or getstarted in the /root directory and end up causing an
AVC looking at the current working directory. So we end up with a dontaudit_search_admin_home_dir. Which will not work if the context of the homedir varies.

I don't see where the source of the problem is coming in here. Is it because end users are changing the role of root and there are all of a sudden denials? If end users are changing roots role they probably would need to add some policy.

Quoted 9 lines
Quoted 4 lines

Allowing user_r on the /root directory would be a bad idea since he would be able to modify .bash_profile and other scripts that could effect the way that a real admin works.

There are legitimate use cases where root should be unprivileged (embedded systems, appliances, etc). We allow that flexibility and can't undermine it in a hard coded way in the library.

But we end up with cruft all over the policy for stuff like donaudit_staff_home_dir_t, dontaudit_sysadm_home_dir_t dontaudit_user_home_dir_t, When every one of these is dealing with getattr on /root, and has nothing to do with /home/dwalsh.

I can also start to write rules that says /root/.ssh directory has a certain label, and be guaranteed that it does, So I don't have to deal with user_ssh_t, and admin_ssh_t

With the current situation you end up treating /root/.ssh and /home/dwalsh/.ssh the same or multiple policies.

I believe labeling should not be variable in places like /root ahd /home. It creates too much complexity. If you want to allow user_t to login as root, you need to give him access to admin_home_t.

Quoted 5 lines
Quoted 1 line

So I will carry the patch and eventually would like to get rid of

I really don't think you should do this. My objections to merging it are rendered moot if the primary selinux distribution ships it anyway.

See above, I don't agree with your decision to have variable labeling on the homedir and /root. So I will take my ball and go home. :^)

Quoted 7 lines
Quoted 3 lines

genhomedircon all together an move to a mechanism where an admin can specify where his homedirs are and where is altermate directories are.

So why not add this feature now? A simple variable in semanage.conf should suffice.

I plan too, as soon as I have time, or get a summer intern to do it. Or hope that someone out in opensource world does it.

Quoted 5 lines
Quoted 5 lines

/home == /export/home

Which would then duplicate all of the contexts prefixed with /home to /export/home

Quoted 7 lines
Quoted 7 lines

Similarly

/var/www == /src/www

This would give administrators greater flexibility and would get us out of the business of guessing what a homedir, is.

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

iEYEARECAAYFAkmcNxoACgkQrlYvE4MpobPQOQCfe3XZl2wYfcNZD8v2jOIGQ2x/ /wIAoLcw5uA+hMC5JQMmKofagg9yh7Jd
=R+4U
-----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.

#11 lore raw
In reply to Joshua Brindle

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

Quoted 121 lines · Joshua Brindle
Quoted 92 lines · Daniel J Walsh

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

Quoted 83 lines · Joshua Brindle
Quoted 68 lines · Daniel J Walsh

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

Quoted 54 lines · Joshua Brindle
Quoted 53 lines · Daniel J Walsh

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

Quoted 49 lines · Joshua Brindle
Quoted 41 lines · Daniel J Walsh

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

Quoted 30 lines · Joshua Brindle
Quoted 17 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label
vary
depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Quoted 5 lines

Labeling this directory as user_home_t, opens the system to possible
security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a
huge whitelist for genhomedircon?

                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked
Quoted 7 lines

to see
if root
* was the user and if so, set his home
directory to

                         * /root */
                        continue;
                }
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Quoted 8 lines
Quoted 7 lines

Well I guess we do want to protect / and /root.

Others should be fixed by looking at the parent, so if I added /var as a
homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

Right now we do not know what /root is going to be labeled.

Quoted 9 lines

Sometime it is labeled admin_home_t sometimes sysadm_home_dir_t other times user_home_dir_t.

I believe this is wrong. It is not a "USER" home dir, it is something
far more special.

Allowing it to be set by an application like genhomedircon, prevents us from knowing what the label should be.

Chris and I talked about this and we both think the same thing, genhomedircon is not in the business of knowing who is and is not an administrative user, "special" user, etc. root _is_ a user, and on an SELinux system can be an unprivileged user.

Quoted 5 lines

I think hardcoding in the library the specialness of /root is a bad idea, what if someone changes roots default role to user_r to make it unprivileged? They'd also need to change the file context entries explicitly with this patch rather than genhomedircon simply updating the entries.

Quoted 8 lines

The problem with treating /root as the same as every other homedir, is confined daemons all consider /root their home dir, so they want to be able to read/write contents in the homedir. Lots of domains look at the
homedir and or getstarted in the /root directory and end up causing an
AVC looking at the current working directory. So we end up with a dontaudit_search_admin_home_dir. Which will not work if the context of the homedir varies.

I don't see where the source of the problem is coming in here. Is it because end users are changing the role of root and there are all of a sudden denials? If end users are changing roots role they probably would need to add some policy.

Quoted 4 lines

Allowing user_r on the /root directory would be a bad idea since he would be able to modify .bash_profile and other scripts that could effect the way that a real admin works.

There are legitimate use cases where root should be unprivileged (embedded systems, appliances, etc). We allow that flexibility and can't undermine it in a hard coded way in the library.

Quoted 1 line

So I will carry the patch and eventually would like to get rid of

I really don't think you should do this. My objections to merging it are rendered moot if the primary selinux distribution ships it anyway.

Quoted 19 lines
Quoted 3 lines

genhomedircon all together an move to a mechanism where an admin can specify where his homedirs are and where is altermate directories are.

So why not add this feature now? A simple variable in semanage.conf should suffice.

Quoted 12 lines

/home == /export/home

Which would then duplicate all of the contexts prefixed with /home to /export/home

Similarly

/var/www == /src/www

This would give administrators greater flexibility and would get us out of the business of guessing what a homedir, is.

Case in point.

https://bugzilla.redhat.com/show_bug.cgi?id=486147

I have no way of dontauditing this if I allow the /root directory to have flexible labeling.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkmcPeAACgkQrlYvE4MpobOgkgCbBiOn25j+DTBf7COVswr/xJCU QA8AoMrVox1fUyB728ARNhoCcUB2eyMA
=oZw7
-----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.

#12 lore raw
Quoted 140 lines · Daniel J Walsh

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

Quoted 115 lines · Joshua Brindle
Quoted 92 lines · Daniel J Walsh

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

Quoted 83 lines · Joshua Brindle
Quoted 68 lines · Daniel J Walsh

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

Quoted 54 lines · Joshua Brindle
Quoted 53 lines · Daniel J Walsh

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

Quoted 49 lines · Joshua Brindle
Quoted 41 lines · Daniel J Walsh

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

Quoted 30 lines · Joshua Brindle
Quoted 17 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label
vary
depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Quoted 5 lines

Labeling this directory as user_home_t, opens the system to possible
security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was suppose to be root before, why is / excluded? Are we going to start a
huge whitelist for genhomedircon?

                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked
Quoted 7 lines

to see
if root
* was the user and if so, set his home
directory to

                         * /root */
                        continue;
                }
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Quoted 8 lines
Quoted 7 lines

Well I guess we do want to protect / and /root.

Others should be fixed by looking at the parent, so if I added /var as a
homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

Right now we do not know what /root is going to be labeled.

Quoted 9 lines

Sometime it is labeled admin_home_t sometimes sysadm_home_dir_t other times user_home_dir_t.

I believe this is wrong. It is not a "USER" home dir, it is something
far more special.

Allowing it to be set by an application like genhomedircon, prevents us from knowing what the label should be.

Chris and I talked about this and we both think the same thing, genhomedircon is not in the business of knowing who is and is not an administrative user, "special" user, etc. root _is_ a user, and on an SELinux system can be an unprivileged user.

Quoted 5 lines

I think hardcoding in the library the specialness of /root is a bad idea, what if someone changes roots default role to user_r to make it unprivileged? They'd also need to change the file context entries explicitly with this patch rather than genhomedircon simply updating the entries.

Quoted 8 lines

The problem with treating /root as the same as every other homedir, is confined daemons all consider /root their home dir, so they want to be able to read/write contents in the homedir. Lots of domains look at the
homedir and or getstarted in the /root directory and end up causing an
AVC looking at the current working directory. So we end up with a dontaudit_search_admin_home_dir. Which will not work if the context of the homedir varies.

I don't see where the source of the problem is coming in here. Is it because end users are changing the role of root and there are all of a sudden denials? If end users are changing roots role they probably would need to add some policy.

Quoted 4 lines

Allowing user_r on the /root directory would be a bad idea since he would be able to modify .bash_profile and other scripts that could effect the way that a real admin works.

There are legitimate use cases where root should be unprivileged (embedded systems, appliances, etc). We allow that flexibility and can't undermine it in a hard coded way in the library.

Quoted 1 line

So I will carry the patch and eventually would like to get rid of

Quoted 21 lines

I really don't think you should do this. My objections to merging it are rendered moot if the primary selinux distribution ships it anyway.

Quoted 3 lines

genhomedircon all together an move to a mechanism where an admin can specify where his homedirs are and where is altermate directories are.

So why not add this feature now? A simple variable in semanage.conf should suffice.

Quoted 12 lines

/home == /export/home

Which would then duplicate all of the contexts prefixed with /home to /export/home

Similarly

/var/www == /src/www

This would give administrators greater flexibility and would get us out of the business of guessing what a homedir, is.

Quoted 6 lines

Case in point.

https://bugzilla.redhat.com/show_bug.cgi?id=486147

I have no way of dontauditing this if I allow the /root directory to have flexible labeling.

You will always know what the label of /root will be in the default configuration. These sorts of denials are going to happen on admin_home_t whether genhomedircon labels it that way or there are explicit labels.

If, however, you modify genhomedircon you'll make the situation worse if an end user does decide to change roots role, their login won't work, there will be all sorts of denials (denials that look like possible intrusions I might add) and the user is going to have to explicitly relabel /root anyway (which will cause the kind of denials you are talking about). By making it harder on users to change the root role you aren't solving the problem, you are just making it harder on users that have a legitimate need to change the role.

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

#13 lore raw

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

Quoted 159 lines · Joshua Brindle
Quoted 146 lines · Daniel J Walsh

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

Quoted 121 lines · Joshua Brindle
Quoted 97 lines · Daniel J Walsh

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

Quoted 87 lines · Joshua Brindle
Quoted 73 lines · Daniel J Walsh

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

Quoted 57 lines · Joshua Brindle
Quoted 56 lines · Daniel J Walsh

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

Quoted 43 lines · Joshua Brindle
Quoted 42 lines · Daniel J Walsh

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

Quoted 38 lines · Joshua Brindle
Quoted 17 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this label
vary
depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Quoted 5 lines

Labeling this directory as user_home_t, opens the system to possible
security risks since some domains have to be able to write to user_home_t when they would never be allowed to write to admin_home_t.

The comment right above the added lines seems to indicate that was
suppose to be root before, why is / excluded? Are we going to start a
huge whitelist for genhomedircon?

                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked

to see
if root
* was the user and if so, set his home
directory to

                         * /root */
                        continue;
                }
Quoted 7 lines
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Well I guess we do want to protect / and /root.

Quoted 7 lines
Quoted 5 lines

Others should be fixed by looking at the parent, so if I added /var as a
homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

Right now we do not know what /root is going to be labeled.

Sometime it is labeled admin_home_t sometimes sysadm_home_dir_t other times user_home_dir_t.

Quoted 8 lines

I believe this is wrong. It is not a "USER" home dir, it is
something
far more special.

Allowing it to be set by an application like genhomedircon, prevents us
from knowing what the label should be.

Chris and I talked about this and we both think the same thing, genhomedircon is not in the business of knowing who is and is not an administrative user, "special" user, etc. root _is_ a user, and on an SELinux system can be an unprivileged user.

Quoted 6 lines

I think hardcoding in the library the specialness of /root is a bad idea, what if someone changes roots default role to user_r to make it unprivileged? They'd also need to change the file context entries explicitly with this patch rather than genhomedircon simply updating the
entries.

Quoted 9 lines

The problem with treating /root as the same as every other homedir, is confined daemons all consider /root their home dir, so they want to be able to read/write contents in the homedir. Lots of domains look at the
homedir and or getstarted in the /root directory and end up causing an
AVC looking at the current working directory. So we end up with a dontaudit_search_admin_home_dir. Which will not work if the context of the homedir varies.

I don't see where the source of the problem is coming in here. Is it because end users are changing the role of root and there are all of a sudden denials? If end users are changing roots role they probably would need to add some policy.

Quoted 4 lines

Allowing user_r on the /root directory would be a bad idea since he would be able to modify .bash_profile and other scripts that could effect the way that a real admin works.

There are legitimate use cases where root should be unprivileged (embedded systems, appliances, etc). We allow that flexibility and can't undermine it in a hard coded way in the library.

Quoted 1 line

So I will carry the patch and eventually would like to get rid of

Quoted 21 lines

I really don't think you should do this. My objections to merging it are rendered moot if the primary selinux distribution ships it anyway.

Quoted 3 lines

genhomedircon all together an move to a mechanism where an admin can specify where his homedirs are and where is altermate directories are.

So why not add this feature now? A simple variable in semanage.conf should suffice.

Quoted 12 lines

/home == /export/home

Which would then duplicate all of the contexts prefixed with /home to /export/home

Similarly

/var/www == /src/www

This would give administrators greater flexibility and would get us out of the business of guessing what a homedir, is.

Quoted 6 lines

Case in point.

https://bugzilla.redhat.com/show_bug.cgi?id=486147

I have no way of dontauditing this if I allow the /root directory to have flexible labeling.

You will always know what the label of /root will be in the default configuration. These sorts of denials are going to happen on admin_home_t whether genhomedircon labels it that way or there are explicit labels.

Quoted 8 lines

If, however, you modify genhomedircon you'll make the situation worse if an end user does decide to change roots role, their login won't work, there will be all sorts of denials (denials that look like possible intrusions I might add) and the user is going to have to explicitly relabel /root anyway (which will cause the kind of denials you are talking about). By making it harder on users to change the root role you aren't solving the problem, you are just making it harder on users that have a legitimate need to change the role.

I repeat file context on disk should NOT be variable.

genhomedircon is about finding context for USER homedirectories. If you want a random user type to be able to login as root, then set the correct privileges for the user. Don't change the labeling.

We don't allow you to change the labeling on /var if you happen to specify /var as a home dir, so don't change it for /root.

If I want to write a rule that says qemu_t can transition to qemu_admin_pulse_t when creating files in /root/.pulse which is labeled admin_pulse_t then don't change the context out from under me.

Similar context might be written for sshd_t and others to allow them access to certain files in the /root dir, but you want this directory to suddenly change labels. I could not disagree more.

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

iEYEARECAAYFAkmcatwACgkQrlYvE4MpobNGgwCgtOzGS9id8aPAreuvXtPSjcQY 9l0AoLSujFGH2xPMXXSgEPOB75Cqeb9z
=sdbk
-----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.

#14 lore raw
Quoted 170 lines · Daniel J Walsh

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

Quoted 158 lines · Joshua Brindle
Quoted 146 lines · Daniel J Walsh

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

Quoted 121 lines · Joshua Brindle
Quoted 97 lines · Daniel J Walsh

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

Quoted 87 lines · Joshua Brindle
Quoted 73 lines · Daniel J Walsh

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

Quoted 57 lines · Joshua Brindle
Quoted 56 lines · Daniel J Walsh

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

Quoted 43 lines · Joshua Brindle
Quoted 42 lines · Daniel J Walsh

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

Quoted 38 lines · Joshua Brindle
Quoted 22 lines · Daniel J Walsh

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

Policy should label /root with one label and this should not be
effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this
label
vary
depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Labeling this directory as user_home_t, opens the system to
possible
security risks since some domains have to be able to write to
user_home_t when they would never be allowed to write to
admin_home_t.

The comment right above the added lines seems to indicate that was
suppose to be root before, why is / excluded? Are we going to start a
huge whitelist for genhomedircon?

                if (strcmp(pwent->pw_dir, "/") == 0) {
                        /* don't relabel / genhomdircon checked

to see
if root
* was the user and if so, set his home
directory to

                         * /root */
                        continue;
                }
Quoted 7 lines
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Well I guess we do want to protect / and /root.

Quoted 7 lines
Quoted 5 lines

Others should be fixed by looking at the parent, so if I added /var as a
homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

Right now we do not know what /root is going to be labeled.

Sometime it is labeled admin_home_t sometimes sysadm_home_dir_t other times user_home_dir_t.

Quoted 8 lines

I believe this is wrong. It is not a "USER" home dir, it is
something
far more special.

Allowing it to be set by an application like genhomedircon, prevents us
from knowing what the label should be.

Chris and I talked about this and we both think the same thing, genhomedircon is not in the business of knowing who is and is not an administrative user, "special" user, etc. root _is_ a user, and on an SELinux system can be an unprivileged user.

Quoted 6 lines

I think hardcoding in the library the specialness of /root is a bad idea, what if someone changes roots default role to user_r to make it unprivileged? They'd also need to change the file context entries explicitly with this patch rather than genhomedircon simply updating the
entries.

Quoted 9 lines

The problem with treating /root as the same as every other homedir, is confined daemons all consider /root their home dir, so they want to be able to read/write contents in the homedir. Lots of domains look at the
homedir and or getstarted in the /root directory and end up causing an
AVC looking at the current working directory. So we end up with a dontaudit_search_admin_home_dir. Which will not work if the context of the homedir varies.

I don't see where the source of the problem is coming in here. Is it because end users are changing the role of root and there are all of a sudden denials? If end users are changing roots role they probably would need to add some policy.

Quoted 4 lines

Allowing user_r on the /root directory would be a bad idea since he would be able to modify .bash_profile and other scripts that could effect the way that a real admin works.

There are legitimate use cases where root should be unprivileged (embedded systems, appliances, etc). We allow that flexibility and can't undermine it in a hard coded way in the library.

Quoted 1 line

So I will carry the patch and eventually would like to get rid of

Quoted 21 lines

I really don't think you should do this. My objections to merging it are rendered moot if the primary selinux distribution ships it anyway.

Quoted 3 lines

genhomedircon all together an move to a mechanism where an admin can specify where his homedirs are and where is altermate directories are.

So why not add this feature now? A simple variable in semanage.conf should suffice.

Quoted 12 lines

/home == /export/home

Which would then duplicate all of the contexts prefixed with /home to /export/home

Similarly

/var/www == /src/www

This would give administrators greater flexibility and would get us out of the business of guessing what a homedir, is.

Quoted 6 lines

Case in point.

https://bugzilla.redhat.com/show_bug.cgi?id=486147

I have no way of dontauditing this if I allow the /root directory to have flexible labeling.

You will always know what the label of /root will be in the default configuration. These sorts of denials are going to happen on admin_home_t whether genhomedircon labels it that way or there are explicit labels.

Quoted 8 lines

If, however, you modify genhomedircon you'll make the situation worse if an end user does decide to change roots role, their login won't work, there will be all sorts of denials (denials that look like possible intrusions I might add) and the user is going to have to explicitly relabel /root anyway (which will cause the kind of denials you are talking about). By making it harder on users to change the root role you aren't solving the problem, you are just making it harder on users that have a legitimate need to change the role.

Quoted 6 lines

I repeat file context on disk should NOT be variable.

genhomedircon is about finding context for USER homedirectories. If you want a random user type to be able to login as root, then set the correct privileges for the user. Don't change the labeling.

That is the case _for you_ ! That doesn't mean that no one else needs this capability, nor that we should remove it for all end users. We still work on systems here where we use types for confining users from one another and need those home directories labeled differently.

Just because one downstream wants to keep user home dirs all labeled the same thing doesn't mean we remove that from the toolchain.

If you don't want genhomedircon behavior anymore remove all the USER and ROLE file contexts from your policy, then you won't have anything added by genhomedircon.

Quoted 11 lines

We don't allow you to change the labeling on /var if you happen to specify /var as a home dir, so don't change it for /root.

If I want to write a rule that says qemu_t can transition to qemu_admin_pulse_t when creating files in /root/.pulse which is labeled admin_pulse_t then don't change the context out from under me.

Similar context might be written for sshd_t and others to allow them access to certain files in the /root dir, but you want this directory to suddenly change labels. I could not disagree more.

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

#15 lore raw

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

Quoted 199 lines · Joshua Brindle
Quoted 186 lines · Daniel J Walsh

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

Quoted 174 lines · Joshua Brindle
Quoted 162 lines · Daniel J Walsh

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

Quoted 138 lines · Joshua Brindle
Quoted 104 lines · Daniel J Walsh

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

Quoted 93 lines · Joshua Brindle
Quoted 78 lines · Daniel J Walsh

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

Quoted 60 lines · Joshua Brindle
Quoted 59 lines · Daniel J Walsh

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

Quoted 46 lines · Joshua Brindle
Quoted 45 lines · Daniel J Walsh

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

Quoted 41 lines · Joshua Brindle

Daniel J Walsh wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Policy should label /root with one label and this should
not be
effected
by the passwd database.

In Fedora policy we label this as admin_home_t. Having this
label
vary
depending on policy ends up with lines like

dontaudit * user_home_t:dir search_dir_perms
dontaudit * admin_home_t:dir search_dir_perms
dontaudit * sysadmin_home_t:dir search_dir_perms
dontaudit * staff_home_t:dir search_dir_perms

Labeling this directory as user_home_t, opens the system to
possible
security risks since some domains have to be able to write to
user_home_t when they would never be allowed to write to
admin_home_t.
The comment right above the added lines seems to indicate
that was
suppose to be root before, why is / excluded? Are we going to
start a
huge whitelist for genhomedircon?

if (strcmp(pwent->pw_dir, "/") == 0) {
/* don't relabel / genhomdircon
checked
to see
if root
* was the user and if so, set his
home
directory to
* /root */
continue;
}

Quoted 7 lines
Quoted 4 lines

No just /root

/root should not be labeled based on genhomedircon.

Why are the exact same lines there for "/" then?

Well I guess we do want to protect / and /root.

Quoted 8 lines
Quoted 6 lines

Others should be fixed by looking at the parent, so if I added /var
as a
homedir it would blow up saying it conflicts with the previous definition of /var.

I don't think I understand the problem we are trying to solve here...

Right now we do not know what /root is going to be labeled.

Sometime it is labeled admin_home_t sometimes sysadm_home_dir_t other
times user_home_dir_t.

Quoted 8 lines

I believe this is wrong. It is not a "USER" home dir, it is
something
far more special.

Allowing it to be set by an application like genhomedircon, prevents us
from knowing what the label should be.

Chris and I talked about this and we both think the same thing, genhomedircon is not in the business of knowing who is and is not an administrative user, "special" user, etc. root _is_ a user, and on an
SELinux system can be an unprivileged user.

Quoted 7 lines

I think hardcoding in the library the specialness of /root is a bad idea, what if someone changes roots default role to user_r to make it
unprivileged? They'd also need to change the file context entries explicitly with this patch rather than genhomedircon simply updating the
entries.

Quoted 13 lines

The problem with treating /root as the same as every other homedir, is
confined daemons all consider /root their home dir, so they want to be
able to read/write contents in the homedir. Lots of domains look at the
homedir and or getstarted in the /root directory and end up
causing an
AVC looking at the current working directory. So we end up with a dontaudit_search_admin_home_dir. Which will not work if the context of
the homedir varies.

I don't see where the source of the problem is coming in here. Is it because end users are changing the role of root and there are all of a sudden denials? If end users are changing roots role they probably would
need to add some policy.

Quoted 4 lines

Allowing user_r on the /root directory would be a bad idea since he would be able to modify .bash_profile and other scripts that could effect the way that a real admin works.

There are legitimate use cases where root should be unprivileged (embedded systems, appliances, etc). We allow that flexibility and can't
undermine it in a hard coded way in the library.

Quoted 1 line

So I will carry the patch and eventually would like to get rid of

I really don't think you should do this. My objections to merging it are
rendered moot if the primary selinux distribution ships it anyway.

Quoted 20 lines
Quoted 4 lines

genhomedircon all together an move to a mechanism where an admin can specify where his homedirs are and where is altermate directories are.

So why not add this feature now? A simple variable in semanage.conf should suffice.

Quoted 13 lines

/home == /export/home

Which would then duplicate all of the contexts prefixed with /home to /export/home

Similarly

/var/www == /src/www

This would give administrators greater flexibility and would get us out
of the business of guessing what a homedir, is.

Quoted 6 lines

Case in point.

https://bugzilla.redhat.com/show_bug.cgi?id=486147

I have no way of dontauditing this if I allow the /root directory to have flexible labeling.

You will always know what the label of /root will be in the default configuration. These sorts of denials are going to happen on admin_home_t whether genhomedircon labels it that way or there are explicit labels.

Quoted 8 lines

If, however, you modify genhomedircon you'll make the situation worse if an end user does decide to change roots role, their login won't work, there will be all sorts of denials (denials that look like possible intrusions I might add) and the user is going to have to explicitly relabel /root anyway (which will cause the kind of denials you are talking about). By making it harder on users to change the root role you aren't solving the problem, you are just making it harder on users that have a legitimate need to change the role.

Quoted 6 lines

I repeat file context on disk should NOT be variable.

genhomedircon is about finding context for USER homedirectories. If you want a random user type to be able to login as root, then set the correct privileges for the user. Don't change the labeling.

That is the case _for you_ ! That doesn't mean that no one else needs this capability, nor that we should remove it for all end users. We still work on systems here where we use types for confining users from one another and need those home directories labeled differently.

Quoted 18 lines

Just because one downstream wants to keep user home dirs all labeled the same thing doesn't mean we remove that from the toolchain.

If you don't want genhomedircon behavior anymore remove all the USER and ROLE file contexts from your policy, then you won't have anything added by genhomedircon.

Quoted 11 lines

We don't allow you to change the labeling on /var if you happen to specify /var as a home dir, so don't change it for /root.

If I want to write a rule that says qemu_t can transition to qemu_admin_pulse_t when creating files in /root/.pulse which is labeled admin_pulse_t then don't change the context out from under me.

Similar context might be written for sshd_t and others to allow them access to certain files in the /root dir, but you want this directory to suddenly change labels. I could not disagree more.

The argument here is whether or not /root is a "homedirectory" I don't agree that it is, at least it is not the same as /home/dwalsh.

They are different and the tools should treat them different.

Allowing a domain to interact with /root is different then allowing it to interact with /home/dwalsh. By allowing random users to accidentally change this is in my mind a security risk.

I want genhomedircon to handle the case when a user puts his home directories in /home/devel/ and /export/home. So I need genhomedircon.

But I intend to write policy that relies on the /root directory having a fixed file context.

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

iEYEARECAAYFAkmcfNAACgkQrlYvE4MpobNqzACeLPXHQ5OliNfxdpwUDWFJCLrS tI4AnAtkQWbdNtJce1BIQRJs42VFZc05
=VOZm
-----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.

#16 lore raw

<snip>

Quoted 11 lines
Quoted 2 lines
Quoted 2 lines

suddenly change labels. I could not disagree more.

The argument here is whether or not /root is a "homedirectory" I don't agree that it is, at least it is not the same as /home/dwalsh.

They are different and the tools should treat them different.

Allowing a domain to interact with /root is different then allowing it to interact with /home/dwalsh. By allowing random users to accidentally change this is in my mind a security risk.

Quoted 6 lines

I want genhomedircon to handle the case when a user puts his home directories in /home/devel/ and /export/home. So I need genhomedircon.

But I intend to write policy that relies on the /root directory having a fixed file context.

Ok, the tools should be policy agnostic IMO, and this patch hard codes a behavior that is policy specific.

I'm not going to merge this patch but if/when you or someone sends one that addresses the issue in a flexible way I'll be more open to that.

My suggestion is to make an excluded paths variable in semanage.conf that allows downstream users to exclude the paths they care about (alternatively an included paths list might be more appropriate, but I'd have to think that through).

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

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

The problem with treating /root as the same as every other homedir, is confined daemons all consider /root their home dir, so they want to be able to read/write contents in the homedir.

We should not be allowing confined daemons to write to /root.

There is little point in confining a daemon if it can write to a file such as /root/.bashrc which is likely to be executed as unconfined_t.

The only reason a confined daemon should access /root is if the sysadmin starts it immediately after logging in without changing directory. A daemon starting with a cwd that is not accessible should not be a problem, if it is then there are other usage cases that will get you.

Signature · 8 lines
[email protected]
http://etbe.coker.com.au/          My Main Blog
http://doc.coker.com.au/           My Documents Blog

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

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

Quoted 7 lines · Russell Coker
Quoted 3 lines · Daniel J Walsh

The problem with treating /root as the same as every other homedir, is confined daemons all consider /root their home dir, so they want to be able to read/write contents in the homedir.

We should not be allowing confined daemons to write to /root.

Quoted 8 lines

There is little point in confining a daemon if it can write to a file such as /root/.bashrc which is likely to be executed as unconfined_t.

The only reason a confined daemon should access /root is if the sysadmin starts it immediately after logging in without changing directory. A daemon starting with a cwd that is not accessible should not be a problem, if it is then there are other usage cases that will get you.

There is potential to allow confine domains to write to subdirs of /root. or at least read it.

sshd_t needs to be able to read /root/.ssh/*

Others like xauth_t need to be able to write but this is more a confined helper app then a real confined app.

In current targeted policy I see the following

# sesearch --allow -t admin_home_t  -c dir | grep write | awk '{ print
$2 " " $3 }'
sysadm_t admin_home_t
rpm_t admin_home_t
rpm_script_t admin_home_t
xauth_t admin_home_t
nfsd_t admin_home_t
nmbd_t admin_home_t
smbd_t admin_home_t
ftpd_t admin_home_t
kernel_t admin_home_t

Where these are either an unconfined_domain or have a boolean that allows them to write anywhere.

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

iEYEARECAAYFAkmoZGoACgkQrlYvE4MpobPtjQCfYRtnQvjRxdEwk5Fugev1fs+M 33sAoN+LFFJS37gpGNAY/MIMSr5vlick
=DiAa
-----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.

#19 lore raw
Quoted 6 lines · Daniel J Walsh
Quoted 1 line

We should not be allowing confined daemons to write to /root.

There is potential to allow confine domains to write to subdirs of /root. or at least read it.

sshd_t needs to be able to read /root/.ssh/*

Well if you have the boolean set to allow sysadm_t logins then sshd can entirely break your security anyway.

Quoted 17 lines

Others like xauth_t need to be able to write but this is more a confined helper app then a real confined app.

In current targeted policy I see the following

# sesearch --allow -t admin_home_t  -c dir | grep write | awk '{ print
$2 " " $3 }'
sysadm_t admin_home_t
rpm_t admin_home_t
rpm_script_t admin_home_t
xauth_t admin_home_t
nfsd_t admin_home_t
nmbd_t admin_home_t
smbd_t admin_home_t
ftpd_t admin_home_t
kernel_t admin_home_t
Quoted 2 lines

Where these are either an unconfined_domain or have a boolean that allows them to write anywhere.

Those cases all have genuine reasons for accessing /root (at least in certain configurations based on boolean settings).

I recall that at one time the RHGB used to write files under /root because the library code was too complex to allow them to do otherwise. While RHGB was unlikely to break your system, other programs with similar design would be a risk.

Signature · 8 lines
[email protected]
http://etbe.coker.com.au/          My Main Blog
http://doc.coker.com.au/           My Documents Blog

--
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.
#20 lore raw
Quoted 10 lines · Russell Coker
Quoted 6 lines · Daniel J Walsh
Quoted 1 line

We should not be allowing confined daemons to write to /root.

There is potential to allow confine domains to write to subdirs of /root. or at least read it.

sshd_t needs to be able to read /root/.ssh/*

Well if you have the boolean set to allow sysadm_t logins then sshd can entirely break your security anyway.

A bit offtopic but on Fedora that boolean does not seem to work (completely):

sh-4.0# getsebool -a | grep sysadm
allow_sysadm_exec_content --> on
ssh_sysadm_login --> off
xdm_sysadm_login --> off

[dgrift@notebook1 ~]$ ssh dgrift/sysadm_r@localhost WARNING!!! You have accessed a private network. UNAUTHORIZED ACCESS IS PROHIBITED BY LAW
Violators may be prosecuted to the full extend of the law. Your access to this network may be monitored and recorded for quality assurance, security, performance, and maintenance purposes. dgrift/sysadm_r@localhost's password:
Last login: Fri Feb 27 13:35:33 2009 from localhost.localdomain [dgrift@notebook1 ~]$ id -Z dgrift:sysadm_r:sysadm_t:SystemLow-SystemHigh [dgrift@notebook1 ~]$

Quoted 20 lines
Quoted 17 lines

Others like xauth_t need to be able to write but this is more a confined helper app then a real confined app.

In current targeted policy I see the following

# sesearch --allow -t admin_home_t  -c dir | grep write | awk '{ print
$2 " " $3 }'
sysadm_t admin_home_t
rpm_t admin_home_t
rpm_script_t admin_home_t
xauth_t admin_home_t
nfsd_t admin_home_t
nmbd_t admin_home_t
smbd_t admin_home_t
ftpd_t admin_home_t
kernel_t admin_home_t
Quoted 2 lines

Where these are either an unconfined_domain or have a boolean that allows them to write anywhere.

Quoted 8 lines

Those cases all have genuine reasons for accessing /root (at least in certain configurations based on boolean settings).

I recall that at one time the RHGB used to write files under /root because the library code was too complex to allow them to do otherwise. While RHGB was unlikely to break your system, other programs with similar design would be a risk.

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

#21 lore raw

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

Quoted 59 lines · Dominick Grift
Quoted 8 lines · Russell Coker
Quoted 5 lines · Daniel J Walsh
Quoted 1 line

We should not be allowing confined daemons to write to /root.

There is potential to allow confine domains to write to subdirs of /root. or at least read it.

sshd_t needs to be able to read /root/.ssh/*

Well if you have the boolean set to allow sysadm_t logins then sshd can entirely break your security anyway.

A bit offtopic but on Fedora that boolean does not seem to work (completely):

sh-4.0# getsebool -a | grep sysadm
allow_sysadm_exec_content --> on
ssh_sysadm_login --> off
xdm_sysadm_login --> off

[dgrift@notebook1 ~]$ ssh dgrift/sysadm_r@localhost WARNING!!! You have accessed a private network. UNAUTHORIZED ACCESS IS PROHIBITED BY LAW
Violators may be prosecuted to the full extend of the law. Your access to this network may be monitored and recorded for quality assurance, security, performance, and maintenance purposes. dgrift/sysadm_r@localhost's password:
Last login: Fri Feb 27 13:35:33 2009 from localhost.localdomain [dgrift@notebook1 ~]$ id -Z dgrift:sysadm_r:sysadm_t:SystemLow-SystemHigh [dgrift@notebook1 ~]$

Quoted 19 lines
Quoted 17 lines

Others like xauth_t need to be able to write but this is more a confined helper app then a real confined app.

In current targeted policy I see the following

# sesearch --allow -t admin_home_t  -c dir | grep write | awk '{ print
$2 " " $3 }'
sysadm_t admin_home_t
rpm_t admin_home_t
rpm_script_t admin_home_t
xauth_t admin_home_t
nfsd_t admin_home_t
nmbd_t admin_home_t
smbd_t admin_home_t
ftpd_t admin_home_t
kernel_t admin_home_t
Quoted 2 lines

Where these are either an unconfined_domain or have a boolean that allows them to write anywhere.

Quoted 8 lines

Those cases all have genuine reasons for accessing /root (at least in certain configurations based on boolean settings).

I recall that at one time the RHGB used to write files under /root because the library code was too complex to allow them to do otherwise. While RHGB was unlikely to break your system, other programs with similar design would be a risk.

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.

Dominick can you open a bugzilla.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkmpLjAACgkQrlYvE4MpobPwiQCgm2+ElFC98W7KnYtysngi4Wih P3EAn3wwB11nR7pOpBz3Q98nThrncBvS
=5ADb
-----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.

#22 lore raw
Quoted 63 lines · Daniel J Walsh

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

Quoted 59 lines · Dominick Grift
Quoted 8 lines · Russell Coker
Quoted 5 lines · Daniel J Walsh
Quoted 1 line

We should not be allowing confined daemons to write to /root.

There is potential to allow confine domains to write to subdirs of /root. or at least read it.

sshd_t needs to be able to read /root/.ssh/*

Well if you have the boolean set to allow sysadm_t logins then sshd can entirely break your security anyway.

A bit offtopic but on Fedora that boolean does not seem to work (completely):

sh-4.0# getsebool -a | grep sysadm
allow_sysadm_exec_content --> on
ssh_sysadm_login --> off
xdm_sysadm_login --> off

[dgrift@notebook1 ~]$ ssh dgrift/sysadm_r@localhost WARNING!!! You have accessed a private network. UNAUTHORIZED ACCESS IS PROHIBITED BY LAW
Violators may be prosecuted to the full extend of the law. Your access to this network may be monitored and recorded for quality assurance, security, performance, and maintenance purposes. dgrift/sysadm_r@localhost's password:
Last login: Fri Feb 27 13:35:33 2009 from localhost.localdomain [dgrift@notebook1 ~]$ id -Z dgrift:sysadm_r:sysadm_t:SystemLow-SystemHigh [dgrift@notebook1 ~]$

Quoted 27 lines
Quoted 17 lines

Others like xauth_t need to be able to write but this is more a confined helper app then a real confined app.

In current targeted policy I see the following

# sesearch --allow -t admin_home_t  -c dir | grep write | awk '{ print
$2 " " $3 }'
sysadm_t admin_home_t
rpm_t admin_home_t
rpm_script_t admin_home_t
xauth_t admin_home_t
nfsd_t admin_home_t
nmbd_t admin_home_t
smbd_t admin_home_t
ftpd_t admin_home_t
kernel_t admin_home_t
Quoted 2 lines

Where these are either an unconfined_domain or have a boolean that allows them to write anywhere.

Those cases all have genuine reasons for accessing /root (at least in certain configurations based on boolean settings).

I recall that at one time the RHGB used to write files under /root because the library code was too complex to allow them to do otherwise. While RHGB was unlikely to break your system, other programs with similar design would be a risk.

Quoted 5 lines
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.

Dominick can you open a bugzilla.

Sure: https://bugzilla.redhat.com/show_bug.cgi?id=487860

Quoted 8 lines

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

iEYEARECAAYFAkmpLjAACgkQrlYvE4MpobPwiQCgm2+ElFC98W7KnYtysngi4Wih P3EAn3wwB11nR7pOpBz3Q98nThrncBvS
=5ADb
-----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.

#23 lore raw
In reply to Russell Coker

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

Quoted 10 lines · Russell Coker
Quoted 5 lines · Daniel J Walsh
Quoted 1 line

We should not be allowing confined daemons to write to /root.

There is potential to allow confine domains to write to subdirs of /root. or at least read it.

sshd_t needs to be able to read /root/.ssh/*

Well if you have the boolean set to allow sysadm_t logins then sshd can entirely break your security anyway.

Well that is one case, but the far more common case is ssh into root as unconfined_t which is also valid.

Confinement of sshd is not necessarily full proof, since if someone gets full control they can potentially grab passwords or transition to unocnfined_t or sysadm_t as you say. But sshd has been partially subvirted in the past to allow download of files without even breaking though password control or getting full control of the daemon.

Quoted 20 lines
Quoted 17 lines

Others like xauth_t need to be able to write but this is more a confined helper app then a real confined app.

In current targeted policy I see the following

# sesearch --allow -t admin_home_t  -c dir | grep write | awk '{ print
$2 " " $3 }'
sysadm_t admin_home_t
rpm_t admin_home_t
rpm_script_t admin_home_t
xauth_t admin_home_t
nfsd_t admin_home_t
nmbd_t admin_home_t
smbd_t admin_home_t
ftpd_t admin_home_t
kernel_t admin_home_t
Quoted 2 lines

Where these are either an unconfined_domain or have a boolean that allows them to write anywhere.

Quoted 8 lines

Those cases all have genuine reasons for accessing /root (at least in certain configurations based on boolean settings).

I recall that at one time the RHGB used to write files under /root because the library code was too complex to allow them to do otherwise. While RHGB was unlikely to break your system, other programs with similar design would be a risk.

Yes we see lots of code that wants to treat /root has a homedir. But most we can deny getattr support and that solves the problem. But allowing the context to vary depending on genhomedircon is what makes the policy complicated. Which is why we wrote the patch in the first place.

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

iEYEARECAAYFAkmpK2MACgkQrlYvE4MpobPvvwCgkDTHd0sBUMMzgz3zcvuFtc37 Dg4An1obZexWmdbWDKKcUcpsjgtv1bc+
=d9pd
-----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.