Score:0

Protecting a Linux against root users

hm flag

I'm searching for a way to "protect" a Linux operating system against (root) users that can potentially misbehave.

My threat model is the one of university students, having access to root password of desktops (to deal with network configuration, install packages, and so on), but without any access to the UEFI, and my goal is to be able to restore the system in its original state after a simple reboot (without having to resilver the whole system).

It seems to me a ram-backed overlayfs on the whole system would probably allow for such a behaviour if I were to restrict root to have read-write access on the disk block devices, and prevent root from "removing" this overlay, in a way or another (maybe with SELinux ?).

Is there a name for such a technique / setup, name that would allow me to find resources about doing this on Linux such as e.g Ubuntu ? Is that easily achievable or would it be a nightmare to think about all the restrictions that would need to be put in place regarding e.g. devices ?

HBruijn avatar
in flag
In general don't grant root access and ensure that systems will boot in a good working configuration. Instruct your users to install / configure the software they need in their home directory. i.e. docker containers, snap packages, virtual python environments etc. If/ when root access can't be avoided, i.e. when teaching a sysadmin class - lock the bios, set a boot order to boot from network before disk, run a network boot server that presents a menu to allow booting from local disk or allows the user to select a fresh install that will deploy a base system in a known good state.
Biswajit Mohanty avatar
in flag
you can look into sudo , user with specific access to command mentioned in visudo file ,even though they can run commands as root but only the permitted one by root which i assume is you https://kifarunix.com/run-only-specific-commands-with-sudo-in-linux/
U880D avatar
ca flag
"_My threat model is the one of university students ..._", for such I've seen hardware solutions with PCI Recovery / Guard Cards. For a full reset just a restart was necessary.
Nikita Kipriyanov avatar
za flag
`root` is GOD. Absolutely. You can't "protect Linux from root". If you are sure you need to give plain root on some machine, consider setting up netboot and write a custom init script which copies the image from seed server during boot and right, establishes an overlay with it. Then it will be refreshed every reboot, no matter what the "root" did. Notice that this way you move security into the seed server, where the "student" is *not* root and so they can't do anything.
user19917937 avatar
hm flag
I disagree that root is "god". For example, using kerberos / nfs, you cannot access the files of an user even if you are root if you don't have some ticket. In the same way, the kernel might refuse to provide access to some devices, even to the root user, and if the kernel cannot be tampered with, then root is not "god". My question is not some XY-problem, I'm not searching for a way of limiting the access to the root account with e.g. sudo or other mechanisms.
frax avatar
cn flag
Here’s a suggestion in the same spirit as using a RAM-backed overlayfs. Boot into a hypervisor that launches a VM having full pass-through to all hardware devices, apart from the block devices. The VM FS should be a snapshot that is removed and recreated at boot time. The student has root access only on the VM, not the hypervisor. Theoretically, this would solve your problem, but I haven't investigated it so I don't know how well kvm allows for the full passthrough of e.g. graphic cards, etc that might be required for giving the same experience as running naively on the hardware.
raj avatar
ye flag
raj
I support @U880D s comment that hardware recovery cards are the best solution for that case.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.