Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hookup attribute for user applications to run other applications #412

Merged

Conversation

0xC0ncord
Copy link
Contributor

@0xC0ncord 0xC0ncord commented Oct 8, 2021

This is the second part of the effort previously started in #381.

This PR modifies the calls to every _role() and _role_template() to use the new $1_application_exec_domain where appropriate, while still standardizing these role calls to use this format: myapp_role[_template](user, user_t, user_application_exec_domain, user_r). This PR does not touch any role interfaces that do not have any callers.

$1_application_exec_domain only gets permissions needed to execute and transition to other applications, as well as using stream_connect() on them if it was previously given to userdomains. $1_application_exec_domain does not get access to read or modify application data explicitly.

Additionally, $1_systemd_t gets the permissions needed to monitor applications started by users in order to capture output to journald, check their state, and so on.

Lastly, sudo, su, and shutdown get a new tunable (default off) to control whether $1_application_exec_domain should have access to execute these administrative applications.

Fixes #365

@0xC0ncord 0xC0ncord changed the title Bugfix/systemd user exec apps hookup Hookup attribute for user applications to run other applications Oct 8, 2021
policy/modules/admin/shutdown.if Show resolved Hide resolved
policy/modules/apps/mono.if Outdated Show resolved Hide resolved
policy/modules/apps/pulseaudio.if Show resolved Hide resolved
policy/modules/apps/wine.if Outdated Show resolved Hide resolved
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
The tunable 'sudo_allow_user_exec_domains' only allows user domains
themselves to use sudo if disabled (default), otherwise any domain with
the corresponding user exec domain attribute may use sudo.

Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Split `pulseaudio_domtrans()` into two interfaces: one that grants
transition access and the other the `pulseaudio_client` attribute. This
fixes a build error because calls to `pulseaudio_domtrans()` by the role
would associate the client attribute with the user exec domain
attribute.

Signed-off-by: Kenton Groombridge <me@concord.sh>
@pebenito
Copy link
Member

From the source diff it seems ok, but I noticed something concerning from sediff:

$ sediff policy.33{.orig,} | grep xguest | wc -l
175

These are all additions.

@0xC0ncord
Copy link
Contributor Author

From the source diff it seems ok, but I noticed something concerning from sediff:

$ sediff policy.33{.orig,} | grep xguest | wc -l
175

These are all additions.

It seems that most of these new rules are to xguest_wm_t, and most of those are allowing xguest_wm_t to transition to various httpd user scripts. Everything else looks fine to me.

I'm not sure what the use case is for xguest having the ability to run httpd user scripts. If you think we should lock this down, I can add a template for httpd user script guest access, or we can remove this call altogether: https://github.com/SELinuxProject/refpolicy/blob/master/policy/modules/roles/xguest.te#L89

@pebenito
Copy link
Member

pebenito commented Nov 12, 2021

Let's remove the access. I don't see a need for a guest to have apache access. If there is a good reason found in the future, we can reconsider.

Signed-off-by: Kenton Groombridge <me@concord.sh>
@0xC0ncord
Copy link
Contributor Author

OK. I added another commit to remove apache access from xguest. I also went ahead and did the same thing for normal guest for the same reason.

@pebenito pebenito merged commit e0d1b94 into SELinuxProject:master Nov 14, 2021
@0xC0ncord 0xC0ncord deleted the bugfix/systemd-user-exec-apps-hookup branch November 15, 2021 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: add an attribute for application execute and transition permissions
2 participants