Skip to contentSkip to conversation

fcontexts for XDG_RUNTIME_DIR /run/user

refpolicy Jason Zaman 3 participants 8 messages Apr 11, 2016 – May 4, 2016

lore
Share & tools
lore
#0 lore raw

Hi all,

I submitted patches to add USERID and USERNAME to genhomedircon[1] and am now trying to fix refpol to work with it.

What labels do we want for things in /run/user?
Currently refpol has the following which seems pretty weird:
/var/run/user(/.*)? gen_context(system_u:object_r:var_auth_t,s0) It was originally added from fedora but fedora has since dropped that.

fedora now has:
/var/run/user(/.*)? gen_context(system_u:object_r:user_tmp_t,s0)

The problem with that fcontext is that users have write perms towards user_tmp_t so they would be able to do other things in /run/user/ instead of only within /run/user/%{USERID}/.

I think we should have some kind of _root_t and _home_t like how things are for /home and /home/USERNAME

In gentoo we have an xdg module which adds xdg_runtime_home_t which we have for the user's dir. I was thinking to add an xdg_runtime_dir_t or _root_t. then things would get search perms towards that root dir and get normal write perms within the actual runtime dir. Only logind/consolekit would need to manage xdg_runtime_dir_t.

If we send (parts of?) the xdg module upstream from gentoo, would it be accepted? and if not, I want to at least fix the label for /run/user/ (xdg_runtime_dir_t or whatever is decided) in refpol and then I can carry the xdg_runtime_home_t part in gentoo only.

Regards,
Jason

[1]: https://marc.info/?l=selinux&m=146013183309131&w=2

#1 lore raw
Quoted 13 lines · Jason Zaman

Hi all,

I submitted patches to add USERID and USERNAME to genhomedircon[1] and am now trying to fix refpol to work with it.

What labels do we want for things in /run/user?
Currently refpol has the following which seems pretty weird:
/var/run/user(/.*)? gen_context(system_u:object_r:var_auth_t,s0) It was originally added from fedora but fedora has since dropped that.

fedora now has:
/var/run/user(/.*)? gen_context(system_u:object_r:user_tmp_t,s0)

Quoted 6 lines

The problem with that fcontext is that users have write perms towards user_tmp_t so they would be able to do other things in /run/user/ instead of only within /run/user/%{USERID}/.

I think we should have some kind of _root_t and _home_t like how things are for /home and /home/USERNAME

This makes sense.

Quoted 10 lines

In gentoo we have an xdg module which adds xdg_runtime_home_t which we have for the user's dir. I was thinking to add an xdg_runtime_dir_t or _root_t. then things would get search perms towards that root dir and get normal write perms within the actual runtime dir. Only logind/consolekit would need to manage xdg_runtime_dir_t.

If we send (parts of?) the xdg module upstream from gentoo, would it be accepted? and if not, I want to at least fix the label for /run/user/ (xdg_runtime_dir_t or whatever is decided) in refpol and then I can carry the xdg_runtime_home_t part in gentoo only.

Which group (if any) specified how /run/user/UID should be used? XDG?

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#2 lore raw
Quoted 14 lines · Christopher J. PeBenito
Quoted 13 lines · Jason Zaman

Hi all,

I submitted patches to add USERID and USERNAME to genhomedircon[1] and am now trying to fix refpol to work with it.

What labels do we want for things in /run/user?
Currently refpol has the following which seems pretty weird:
/var/run/user(/.*)? gen_context(system_u:object_r:var_auth_t,s0) It was originally added from fedora but fedora has since dropped that.

fedora now has:
/var/run/user(/.*)? gen_context(system_u:object_r:user_tmp_t,s0)

Quoted 8 lines
Quoted 6 lines

The problem with that fcontext is that users have write perms towards user_tmp_t so they would be able to do other things in /run/user/ instead of only within /run/user/%{USERID}/.

I think we should have some kind of _root_t and _home_t like how things are for /home and /home/USERNAME

This makes sense.

so this?
/var/run/user system_u:object_r:xdg_runtime_root_t:s0 /var/run/user/1000 staff_u:object_r:xdg_runtime_home_t:s0

Once the patches get merged in to the userspace tools I will start preparing patches for this.

Quoted 6 lines
Quoted 6 lines

In gentoo we have an xdg module which adds xdg_runtime_home_t which we have for the user's dir. I was thinking to add an xdg_runtime_dir_t or _root_t. then things would get search perms towards that root dir and get normal write perms within the actual runtime dir. Only logind/consolekit would need to manage xdg_runtime_dir_t.

Quoted 6 lines
Quoted 4 lines

If we send (parts of?) the xdg module upstream from gentoo, would it be accepted? and if not, I want to at least fix the label for /run/user/ (xdg_runtime_dir_t or whatever is decided) in refpol and then I can carry the xdg_runtime_home_t part in gentoo only.

Which group (if any) specified how /run/user/UID should be used? XDG?

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

I think systemd started it, but ConsoleKit2 supports it too and it is officially a freedesktop/XDG spec.

-- Jason

#3 lore raw
Quoted 31 lines · Jason Zaman
Quoted 14 lines · Christopher J. PeBenito
Quoted 13 lines · Jason Zaman

Hi all,

I submitted patches to add USERID and USERNAME to genhomedircon[1] and am now trying to fix refpol to work with it.

What labels do we want for things in /run/user?
Currently refpol has the following which seems pretty weird:
/var/run/user(/.*)? gen_context(system_u:object_r:var_auth_t,s0) It was originally added from fedora but fedora has since dropped that.

fedora now has:
/var/run/user(/.*)? gen_context(system_u:object_r:user_tmp_t,s0)

Quoted 8 lines
Quoted 6 lines

The problem with that fcontext is that users have write perms towards user_tmp_t so they would be able to do other things in /run/user/ instead of only within /run/user/%{USERID}/.

I think we should have some kind of _root_t and _home_t like how things are for /home and /home/USERNAME

This makes sense.

so this?
/var/run/user system_u:object_r:xdg_runtime_root_t:s0 /var/run/user/1000 staff_u:object_r:xdg_runtime_home_t:s0

Once the patches get merged in to the userspace tools I will start preparing patches for this.

[...]

Quoted 6 lines
Quoted 1 line

Which group (if any) specified how /run/user/UID should be used? XDG?

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

I think systemd started it, but ConsoleKit2 supports it too and it is officially a freedesktop/XDG spec.

I think it makes more sense for these not to be XDG-named types, since XDG isn't the only one that uses it. Perhaps something like user_runtime_root_t and user_runtime_t, or maybe user_runtime_t and user_tmp_t (I'm open to other suggestions).

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#4 lore raw
Quoted 37 lines · Christopher J. PeBenito
Quoted 31 lines · Jason Zaman
Quoted 14 lines · Christopher J. PeBenito
Quoted 13 lines · Jason Zaman

Hi all,

I submitted patches to add USERID and USERNAME to genhomedircon[1] and am now trying to fix refpol to work with it.

What labels do we want for things in /run/user?
Currently refpol has the following which seems pretty weird:
/var/run/user(/.*)? gen_context(system_u:object_r:var_auth_t,s0) It was originally added from fedora but fedora has since dropped that.

fedora now has:
/var/run/user(/.*)? gen_context(system_u:object_r:user_tmp_t,s0)

Quoted 8 lines
Quoted 6 lines

The problem with that fcontext is that users have write perms towards user_tmp_t so they would be able to do other things in /run/user/ instead of only within /run/user/%{USERID}/.

I think we should have some kind of _root_t and _home_t like how things are for /home and /home/USERNAME

This makes sense.

so this?
/var/run/user system_u:object_r:xdg_runtime_root_t:s0 /var/run/user/1000 staff_u:object_r:xdg_runtime_home_t:s0

Once the patches get merged in to the userspace tools I will start preparing patches for this.

[...]

Quoted 4 lines
Quoted 1 line

Which group (if any) specified how /run/user/UID should be used? XDG?

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Quoted 8 lines
Quoted 2 lines

I think systemd started it, but ConsoleKit2 supports it too and it is officially a freedesktop/XDG spec.

I think it makes more sense for these not to be XDG-named types, since XDG isn't the only one that uses it. Perhaps something like user_runtime_root_t and user_runtime_t, or maybe user_runtime_t and user_tmp_t (I'm open to other suggestions).

Ok, this is again https://github.com/systemd/systemd/issues/257.

Signature · 3 lines
Miroslav Grepl
Senior Software Engineer, SELinux Solutions
Red Hat, Inc.
#5 lore raw
Quoted 41 lines · Miroslav Grepl
Quoted 40 lines · Christopher J. PeBenito
Quoted 31 lines · Jason Zaman
Quoted 14 lines · Christopher J. PeBenito
Quoted 13 lines · Jason Zaman

Hi all,

I submitted patches to add USERID and USERNAME to genhomedircon[1] and am now trying to fix refpol to work with it.

What labels do we want for things in /run/user?
Currently refpol has the following which seems pretty weird:
/var/run/user(/.*)? gen_context(system_u:object_r:var_auth_t,s0) It was originally added from fedora but fedora has since dropped that.

fedora now has:
/var/run/user(/.*)? gen_context(system_u:object_r:user_tmp_t,s0)

Quoted 8 lines
Quoted 6 lines

The problem with that fcontext is that users have write perms towards user_tmp_t so they would be able to do other things in /run/user/ instead of only within /run/user/%{USERID}/.

I think we should have some kind of _root_t and _home_t like how things are for /home and /home/USERNAME

This makes sense.

so this?
/var/run/user system_u:object_r:xdg_runtime_root_t:s0 /var/run/user/1000 staff_u:object_r:xdg_runtime_home_t:s0

Once the patches get merged in to the userspace tools I will start preparing patches for this.

[...]

Quoted 6 lines
Quoted 1 line

Which group (if any) specified how /run/user/UID should be used? XDG?

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

I think systemd started it, but ConsoleKit2 supports it too and it is officially a freedesktop/XDG spec.

Quoted 7 lines
Quoted 5 lines

I think it makes more sense for these not to be XDG-named types, since XDG isn't the only one that uses it. Perhaps something like user_runtime_root_t and user_runtime_t, or maybe user_runtime_t and user_tmp_t (I'm open to other suggestions).

Ok, this is again https://github.com/systemd/systemd/issues/257.

I don't see how this is related. This isn't about systemd's behavior, but simply choosing what are the correct .fc entries for this directory structure.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#6 lore raw
Quoted 48 lines · Christopher J. PeBenito
Quoted 47 lines · Miroslav Grepl
Quoted 45 lines · Christopher J. PeBenito
Quoted 31 lines · Jason Zaman
Quoted 14 lines · Christopher J. PeBenito
Quoted 13 lines · Jason Zaman

Hi all,

I submitted patches to add USERID and USERNAME to genhomedircon[1] and am now trying to fix refpol to work with it.

What labels do we want for things in /run/user?
Currently refpol has the following which seems pretty weird:
/var/run/user(/.*)? gen_context(system_u:object_r:var_auth_t,s0) It was originally added from fedora but fedora has since dropped that.

fedora now has:
/var/run/user(/.*)? gen_context(system_u:object_r:user_tmp_t,s0)

Quoted 8 lines
Quoted 6 lines

The problem with that fcontext is that users have write perms towards user_tmp_t so they would be able to do other things in /run/user/ instead of only within /run/user/%{USERID}/.

I think we should have some kind of _root_t and _home_t like how things are for /home and /home/USERNAME

This makes sense.

so this?
/var/run/user system_u:object_r:xdg_runtime_root_t:s0 /var/run/user/1000 staff_u:object_r:xdg_runtime_home_t:s0

Once the patches get merged in to the userspace tools I will start preparing patches for this.

[...]

Quoted 6 lines
Quoted 1 line

Which group (if any) specified how /run/user/UID should be used? XDG?

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

I think systemd started it, but ConsoleKit2 supports it too and it is officially a freedesktop/XDG spec.

I think it makes more sense for these not to be XDG-named types, since XDG isn't the only one that uses it. Perhaps something like user_runtime_root_t and user_runtime_t, or maybe user_runtime_t and user_tmp_t (I'm open to other suggestions).

Quoted 5 lines
Quoted 1 line

Ok, this is again https://github.com/systemd/systemd/issues/257.

I don't see how this is related. This isn't about systemd's behavior, but simply choosing what are the correct .fc entries for this directory structure.

Yeah systemd looks up the fcontext from the policy. The reason for this patch and the genhomedircon patches is so that we actually have a way to label these subdirs correctly in the policy in the first place. Once this is merged in systemd can be corrected if it needs to be. I am part way through fixing up ConsoleKit2 to do the same thing.

-- Jason

#7 lore raw
In reply to Christopher J. PeBenito
Quoted 48 lines · Christopher J. PeBenito
Quoted 47 lines · Miroslav Grepl
Quoted 45 lines · Christopher J. PeBenito
Quoted 31 lines · Jason Zaman
Quoted 14 lines · Christopher J. PeBenito
Quoted 13 lines · Jason Zaman

Hi all,

I submitted patches to add USERID and USERNAME to genhomedircon[1] and am now trying to fix refpol to work with it.

What labels do we want for things in /run/user?
Currently refpol has the following which seems pretty weird:
/var/run/user(/.*)? gen_context(system_u:object_r:var_auth_t,s0) It was originally added from fedora but fedora has since dropped that.

fedora now has:
/var/run/user(/.*)? gen_context(system_u:object_r:user_tmp_t,s0)

Quoted 8 lines
Quoted 6 lines

The problem with that fcontext is that users have write perms towards user_tmp_t so they would be able to do other things in /run/user/ instead of only within /run/user/%{USERID}/.

I think we should have some kind of _root_t and _home_t like how things are for /home and /home/USERNAME

This makes sense.

so this?
/var/run/user system_u:object_r:xdg_runtime_root_t:s0 /var/run/user/1000 staff_u:object_r:xdg_runtime_home_t:s0

Once the patches get merged in to the userspace tools I will start preparing patches for this.

[...]

Quoted 6 lines
Quoted 1 line

Which group (if any) specified how /run/user/UID should be used? XDG?

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

I think systemd started it, but ConsoleKit2 supports it too and it is officially a freedesktop/XDG spec.

I think it makes more sense for these not to be XDG-named types, since XDG isn't the only one that uses it. Perhaps something like user_runtime_root_t and user_runtime_t, or maybe user_runtime_t and user_tmp_t (I'm open to other suggestions).

Quoted 6 lines
Quoted 1 line

Ok, this is again https://github.com/systemd/systemd/issues/257.

I don't see how this is related. This isn't about systemd's behavior, but simply choosing what are the correct .fc entries for this directory structure.

Correct. My bad.

Signature · 3 lines
Miroslav Grepl
Senior Software Engineer, SELinux Solutions
Red Hat, Inc.