selinux:confine_users
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
selinux:confine_users [2016/07/05 18:40] – peter | selinux:confine_users [2019/12/04 20:19] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== SELinux - Confine users ====== | ||
- | |||
- | |||
- | Confine almost all users as **user_u**. | ||
- | |||
- | <code bash> | ||
- | / | ||
- | </ | ||
- | |||
- | Users who need admin access I confine as **staff_u**. | ||
- | |||
- | <code bash> | ||
- | / | ||
- | </ | ||
- | |||
- | |||
- | There are 2 minor annoyances with this method. | ||
- | |||
- | First I like regular users to be able to ping. This is enabled as a boolean. | ||
- | |||
- | <code bash> | ||
- | setsebool -P selinuxuser_ping on | ||
- | </ | ||
- | |||
- | And second, although staff_u can use sudo, they are still restricted by SELinux. | ||
- | |||
- | <file bash / | ||
- | %user ALL=(ALL) TYPE=unconfined_t ROLE=unconfined_r ALL | ||
- | </ | ||
- | |||
- | Change “%user” to the user name you wish to allow unconfined root access. | ||
- | |||
- | |||
- | |||
- | |||
- | Might also (or instead) change the default login mapping: | ||
- | |||
- | <code bash> | ||
- | semanage login -m -S targeted -s user_u -r s0 __default__ | ||
- | </ | ||
- | |||
- | If you don’t expect or intend to have any unconfined users, you can deny such logins: | ||
- | |||
- | <code bash> | ||
- | setsebool -P unconfined_login off | ||
- | </ | ||
- | |||
- | Rather than changing sudo to run as unconfined by default, you can pass in the role as an option when you expect to need it; that way you can still run commands as root but with some confinement: | ||
- | |||
- | <code bash> | ||
- | alias sado=' | ||
- | </ | ||
- | |||
- | It should be noted that any staff_u can transition to sysadm_r via sudo -r or newrole so don’t rely on the sudoers trick for securing staff users. | ||
- | |||
- | |||
- | It was on this post: https:// | ||
- | |||
- | |||
- | |||
- | |||
selinux/confine_users.1467744036.txt.gz · Last modified: 2020/07/15 09:30 (external edit)