adm removal (I will research that too but also speculate pretty sure it will not cause issues - why would it be “standard to be expected” that a linux user is in that group) - If you like please send pull requests:
Some or even all of above could get invalid with the inception of wayland and/or not apply for CLI or non-gui linux users such as user sdwdate.
Updating, you mean apt-get dist-upgrade?
I am not sure I understand that one. Difficult to use since one would require another login session to run commands as root (indeed) or use su or something like that?
No, my way would have used a systemd service to restrict the permissions at boot. They get “overrided” as there are new files created at each boot. “mask” prevents the service from ever being started again unless you unmask it.
Yes.
Well, I was thinking that su and logging in as root would be restricted as well. You can prevent logging in as root from a tty by clearing /etc/securetty and su can be restricted to the sudo group by changing a few permissions. This way root is impossible to get without a root exploit.
That would be interesting but it would be a massive drain on resources and you’d need pretty good hardware if you want to run a lot of apps at the same time.
Non-Qubes-Whonix: file owned by nobody, created by grml-debootstrap at image creation and then left alone.
Qubes-Whonix: as per Qubes default:
dpkg -S /etc/fstab
qubes-core-agent: /etc/fstab
The Qubes version is much different.
So this would require a new package which get installed in Non-Qubes-Whonix only to avoid package conflict. (And Qubes would require a separate issue and pull request [which is optional].) We don’t have such a package yet.
I am not sure if by introducing such a package we might break user customization for people who modified /etc/fstab but probably not and for Whonix 15 upgrade this is ok (and still in time).
Any naming suggestion for such a package? It’s not just hidepid, perhaps later other fstab hardening? It’s general security also, not hardcoded for Whonix.
Can we use /etc/fstab.d rather than /etc/fstab while we are at it? /etc/fstab would be really bad since it has to be complete which then might make it (Whonix|hardended debian) VM specific.
/etc/fstab.d would be super helpful if we could just harden/reconfigure /proc rather than shipping a complete /etc/fstab. (Then probably even Qubes compatible.) In that case we could even add this to security-misc package too.
I don’t think this really matters. Both should work fine.
fstab hardening would be a good name for it. It could also be used to set different mount options for different file systems like nosuid, nodev or noexec.
I haven’t ever heard of a /etc/fstab.d. It seems that support for it was abandoned.
Indeed. (There is also config-package-dev transform but only slightly less terrible, I guess.)
Alternative much better idea in theory #1:
systemd unit file (that runs very early after fstab processing) which uses mount (remount) on /proc if that is possible? That could be part of security-misc package. Only remounts /proc for start (perhaps later more). Name of systemd unit file: security-misc-early.service? Automatically Qubes compatible / working in Qubes too, working on all supported platforms actually.
Alternative much better idea in theory #2:
Also a search for systemd fstab looks like systemd does a lot related to fstab. If above does not work, perhaps there would be any useful hook to overwrite what is written in /etc/fstab so we don’t have to touch that file.
That sounds not too bad. We could make it run a bash script that can even configure other directories. It could be confusing for people trying to change their mount options though.
I’ll look into this and see what I can find.
Alternative much better idea in theory #3:
Use a systemd .mount file. You seem to configure it just like a systemd service. Configure /proc and add Options=nosuid,nodev,noexec,hidepid=2,gid=proc. I don’t know much about these though. See:
Also, there are more sysctl changes that’d be good to add.
Setting “kernel.kexec_load_disabled=1” will disable kexec which can be used to replace the running kernel.
Setting “net.ipv4.tcp_rfc1337=1” protects against time-wait assassination. It drops RST packets for sockets in the time-wait state.
Setting "net.ipv4.conf.default.rp_filter=1 and “net.ipv4.conf.all.rp_filter=1” enables source validation of packets and protects against IP spoofing methods in which an attacker can send a packet with a fake IP address.
Tails has more files in their /etc/sysctl.d. Could you please look through the other /etc/sysctl.d snippets that Tails has that we don’t have? And copy over anything relevant so we’re on par with Tails? (Please keep same file names as Tails for simplicity/comparison (as far as that makes sense but I guess so)).
Thanks for all the hard work you’re putting into Whonix! Looking forward to your enhancements in the Whonix code. If I can do anything for you, please let me know!
cat /etc/sysctl.d/protect-links.conf
###################################################################
# Protected links
#
# Protects against creating or following links under certain conditions
# Debian kernels have both set to 1 (restricted)
# See https://www.kernel.org/doc/Documentation/sysctl/fs.txt
fs.protected_hardlinks = 1
fs.protected_symlinks = 1