Question: Is it possible to grant selective Administrative access? #17096
-
I'm new to Cockpit and I'm trying to customize it for different admin levels, implementing a certain amount of granularity in permissions. The goal is to grant subadmin groups selective permissions to Cockpit's pages (much in the same way as can be done with sudo), or at least restrict some of them even if the user is in Administrative access mode. For instance, let's say we have the group accountoperators and allow them to manage (create/delete) user accounts by granting them privileges to run /sbin/useradd and /sbin/userdel in sudoers. I've tried to deny them access with a custom polkit rule based on the last example given on https://cockpit-project.org/guide/latest/feature-systemd.html
but this seems to be ignored by Cockpit which makes me assume that cockpit-bridge has an "all or nothing" approach to access rights. Is there a way to achieve selective Administrative access for different admin groups or am I fighting a loosing battle here? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Using polkit rules to grant non-admin users additional privileges is generally right (that's the main purpose of polkit, after all). The problem is just that most cockpit pages are not expecting that -- they just check if the user can become root (via sudo), but almost all pages don't try to do an administrative action as normal user. (The only exception is the firewall page). In many cases that's not even possible. E.g. the Accounts page calls programs like
That isn't possible in Linux (not specific to Cockpit). If you can get root privileges through sudo, you can't restrict your privileges afterwards. For that you need systems like SELinux or RSBAC. So this is by and large a duplicate of #16345. |
Beta Was this translation helpful? Give feedback.
-
Interesting, I kind of have a related question. I'd like to give a user only access to changing the network settings. Is that possible? |
Beta Was this translation helpful? Give feedback.
Using polkit rules to grant non-admin users additional privileges is generally right (that's the main purpose of polkit, after all). The problem is just that most cockpit pages are not expecting that -- they just check if the user can become root (via sudo), but almost all pages don't try to do an administrative action as normal user. (The only exception is the firewall page).
In many cases that's not even possible. E.g. the Accounts page calls programs like
useradd
orpasswd
, which don't support polkit. This is only possible for D-Bus APIs such as systemd. Specifically for the Services page we already have issue #16345 for that.