Linux security hardening and other tweaks
vez.mrsk.me
vez.mrsk.me
For security, I recommend following Madaidan's Insecurities Linux hardening guide, it has good explanations of most of the same sysctl options and kernel flags. [1]
The only option that may be best left disabled is `init_on_free=0` since this is one of the few options that has a measurable performance impact (besides the normal spectre/meltdown related options).
For NTP, systemd-timesyncd works fine and is probably the default for any modern distro.
Desktop security is still a nightmare, if you use a Wayland based desktop environment and Pipewire for audio/video streams then maybe in 10 years you'll a secure clipboard and no unauthorized keyloggers.
[1] https://madaidans-insecurities.github.io/guides/linux-harden...
Is there something desktop users can do? Fedora seem to use both by default.
Reading it through now, pulseaudio might be the way. Now i am in github rabbithole…
Note that Firejail is a suid binary that has had a reasonable number of vulnerabilities in it, so it may hurt more than it helps.
https://www.cvedetails.com/product/36171/Firejail-Project-Fi...
If we use a web browser as an example, what are the odds that a compromised website is going to try to exploit the browser itself vs. exploiting an external sandbox application? Clearly the former. Sandboxing a web browser will prevent many more classes of attack than it exposes you to.
Also worth noting that the suid binary you mention will refuse to run at all if the executing user isn't in its whitelist. It's not like you can pop a shell on some ftp user and run firejail as root.
# chmod -R go-rwx /home/*
Why are most default homes setup with a mode other than 700 directories 600 files? I know, it is because of the default mask system wide, but it seems to make sense to do this to homes, unless I am missing something?
With UPGs, every user will have a bespoke primary group, so having group access to the homedir is not a problem. Whether the distro still keeps the other-readable bit is up to the distro. For example, OpenSUSE used to be in the pre-UPG 0755 camp, but switched some time ago to the UPG 0700 camp.
The default UPG usage and homedir permissions are controlled by USERGROUPS_ENAB and HOME_MODE in login.defs (under /etc or /usr/etc, depending on your distro).
When was this? 15.4 doesn't have user per group by default, nor does it have 0700 on $HOME by default. I have several fairly recent installs around I checked. Something in Tumbleweed perhaps? My last Tumbleweed install was last year sometime and does not have user per group nor 0700 $HOME.
https://bugzilla.opensuse.org/show_bug.cgi?id=1189139
I did a new TW install in April 2022 that had UPG by default, which is how I noticed.
You'd be surprised how many executables can actually permit running commands.
The author seems opposed to disabling security mitigations for performance reasons, but what are the trade-offs? What if you use your workstation for 3D rendering or machine learning, and you really do want to maximize the performance of your hardware?
If anything some of these options are more likely to break the occasional application completely e.g. some applications use user-namespaces.
I remember during my first job discovering that SunOS had C2 security available and trying to enable that, then realizing it messed up a lot of stuff and trying to disable it by hand... what a nightmare. I was fascinated by compartmentalized security type stuff but I really had no idea. That sort of security will really hamper user productivity and collaboration. You need to spec it out, because otherwise an OS is going to default to the latter.