I installed lynis and run lynis audit system --quick
with quite plain and basic configuration.nix
.
The overall score was a bit too low for my personal taste. Some of the suggestions that lynis gives, are probably meaningless on a single user case, or otherwise on a category of either a bit naive or overlapping to some other existing one.
But then, there were a whole set of suggestions that were much more important. Here are some findings.
The hardened section describes, how we can add a set of security settings in one go and the link shows the underlying single configuration settings. This covers some of the lynis
suggestions.
The closest topic on discourse is cis benchmark.
Lynis coverage shortly
Memory and processes; users, groups and authentication; shells; file systems; usb devices; storage; nfs; name services; ports and packages; networking; printers and spools; software on several separate categories; ssh; logging and files; insecure services; banners; scheduled tasks; accounting; time and sync; cryptography; virtualisation; containers; kernel hardening etc.
For full list, please do run the audit.
Findings, suggestions, questions about manual
On manual the text on hardened says:
It also disables the User Namespaces feature of the kernel, which stops Nix from being able to build anything (this particular setting can be overriden via
security.allowUserNamespaces
).
Can this lead to a kind of lock-down? That is, if nixos-rebuild switch
needs to compile something, and one doesn’t remember to override that usenamespace setting, does this mean that the NixOs is lock-down to that particular setup and re-installation is the only option after this one? Or does the building refer to installing any packages?
I’m asking, since this is how I get the manual.
-
Could manual section 39.7 be extended a bit on what it does? Or maybe add an example on how to do it in a way that doesn’t mean troubles to the user? Or is the re-boot and using older generation of configuration.nix the way to go here if in trouble? Maybe a short note about this. (If tweaking settings, I wouldn’t like to re-boot, unless necessary, as it takes long time.)
-
Maybe add some notes on how to enable, configure and use
usbguard
. Links to wiki’s or some places containing examples? -
Maybe add some notes on how to enable, configure and use
audit
andauditd
options. Links to wiki’s or some places containing examples? -
Further, the manual could say something about, how to check or audit the security or give some hints what tools can be used to do such things.
Findings, suggestions, questions about hardening settings
-
It would be really nice if there were either sections of settings that could be turned on separately, or a kind of layers of progressively harder settings like select your paranoidity level. This probably requires more development work and is not just a question of updating the manual, if made easy to use for users.
Anyhow, manual could already reflect something like this and show: “if you want to take the first step towards hardering, set the following.” “If still feeling unshaky, these are the next steps…” etc. -
Default settings for ssh?
Lynis
almost screamed on the ssh settings. -
Password quality and in general the password management default settings. Even though this is also a convenience matter for personal users, the defaults could be bit more towards generally accepted good conventions and there could be more options that users can set (and instructions).
-
There were several other things that could be done, and maybe set on as default. Maybe change the defaults to a bit more secure and add options that allow less secure settings? Inclugind the above things. Anyhow, lot’s of work. Maybe a plan or road-map for some of the things to-do?