Fedora-maintained hardening for general use cases REVIEW

*Editing to tag @py0xc3 for awareness.

This is a review of the Fedora-maintained hardening for general use cases documentation. I recommend that you take a look at this if you care about your machine’s security.

Please be aware, I wrote this elsewhere and formatting is imperfect. So:
• = main bullet
◦ = sub bullet to the main bullet above it

Keep:
• I like the partial CIA (or AIC) triad reference at that beginning.
• I like the note to urging users to read the whole thing because attention spans are pretty short these days.
• Overall, the page content, explanations, and in-line considerations/notes are great. The overall organization and categorization is good (self-updating and enable & forget).
• I like the reverting instructions.
◦ Perhaps, these should also be in a revert summary at the very end in the same self-updating and enable & forget categorizations instead of merely existing “in-line” because they have to be hunted for in current state.

Include/Improve:
• One thing I do want to see on the security doc is a release date when one is decided.
◦ I check on some things when I see systemd updated because I want to use this. I just have not seen anything that indicates that is ready for use at this time apart from manually adding the hardening .conf file. I would prefer not to go the manual route because these settings are pretty hands off (based on the data), and I will eventually forget to remove the manual configuration when the official one releases.
• I think separating each paragraph with a space between them would make it seem less off-putting for non-technical users. Without those spaces, it can look pretty intense and cluttered.
• Bulleted content is easier to digest, but only use them where necessary/applicable.
◦ Sometimes it is impractical to use that type of format, but it may be warranted in the paragraph beginning with “Outside of general use cases, the hardening changes…” because I realized that whole thing is basically one convoluted sentence. I struggle with the same thing sometimes, so I understand the headspace of why it is written like that.
• Consider linking to pages that describe what gdb, strace, and ptrace are.
◦ This is not Arch, but I think the Arch wiki would do something along those lines for those that prefer to enter rabbit holes because these are fundamental to your implementation’s purpose.
• Consider including some links to documentation explaining how a “backup” can be made if the end user later finds that this borks their system’s use cases and/or purpose.
• Consider making “fedoraproject.org, redhat.com and danwalsh.livejournal.com” into hyperlinks.

Questions:
• For the permanent adjustments made by end users to accommodate special needs, how will the “self-updating” kernel hardening handle those configurations that it may have changes for during updates?
◦ Will it ignore them or will it overwrite my permanent settings as an end user?
◦ Will it realize that field is not “null” and pass over it to continue on with the other changes published during an update?

Specific Call-Outs:
• “This does NOT conflict with the kernel hardening above. But the ptrace-disabling measures of the kernel and of SELinux are largely overlapping (not equal though) and act primarily as redundant security layers.”
◦ I like this because it enforces the fact that good security implementations are multi-layered. Security is an approach. Security is not a simple configuration setting.
• “When the hardening is enabled, do NOT file reports for broken applications that depend on ptrace, or for web services that need open ports: they are intentionally broke. Please do NOT file a report until you have verified the hardening is the origin of your issues: in order to find out, please remove the hardening and then reboot (see above about how to disable the hardening means).”
◦ Make this information front and center at the very top of the document. No one wants false positive bug reports for an end user’s oversight or misunderstanding of what they are doing with security implementations or the consequences that result from them.
• “Be careful to know what you are doing when changing SELinux booleans.”
◦ Yes, please draw as much attention to this as possible!
• “Be careful to know what you are doing when enabling “SELinux confined users”. And don’t forget about the limited support!”
◦ Again, very good!

Overall, I think is excellent, and thank you for the work put into this! I think it could even be part (or the start :eyes:) of a larger project. I think it would be stellar to have an official Fedora “STIG” (Security Technical Implementation Guides) site or reference material. Feel free to ask questions, but it may take me some time to get back to you with meaningful responses or opinions.

1 Like

Big changes often have knock-on impacts: it would be helpful to have dnf info report if a package is known to work with the extensions enabled, or even have dnf refuse to install packages that won’t work, or warn if a package will have limited functionality.

I implemented a few of your points, maybe more later. Some things I do not want to change at this time as I would need to get a new approval for this to publish, so I have to stick with trivial changes for now, but I might add further of your points in the first revision after the initial publishing (which I want to be at the time the related systemd is released in daily updates).

Some points I had when reading:

The forge formatting is not representative for how it will be formatted by Docs later… luckily :slight_smile: So that should come automatically once its published.

Good point. Done :classic_smiley:

The file does not yet exist because the related systemd update is not yet on your system → it’s not yet pushed to stable updates.

That’s why I do not yet merge this document but leave it unpublished: I aim to publish it a few days after the related systemd update has been pushed to stable. There are some implications, so I cannot say for sure when this will be: that’s also why I do not want to make major changes at this time but wait for some changes for the first revision after publishing.

I will revise that paragraph. You’re right that’s hard to read.


I will push the changes that I already implemented now later today or tomorrow.

Thanks again for your feedback, much appreciated :classic_smiley: …and maybe the first revision after publishing will implement more.

Links give people the impression they should follow them in the very sections as its relevant and should be known. On one hand, this is good, but I feel average users feel intimidated by information about such stuff. That’s why I have the CATION sentence with a note its not relevant if not known. I expect affected software developers to know.

That’s on the to do list for loooong :classic_smiley: I once wrote a page when I was in the Docs team, maybe its still in the drafts, but we didn’t publish it as finalizing something like this thoroughly takes time, and partially even more to maintain it. The latter made me worry: we have already a lot of Docs pages that are obsoleted. So for now, this is left to Ask.Fedora.

So I’m afraid backup exceeds the hardening page, despite it having a security relation. However, on the long term, a security-related page for backups might be interesting. But again, it will need to have someone to work on it and maintain it :frowning:

The idea is good though!

There is much more to be done in these paragraphs… I just added them to have “something” about it, and to ensure that a few core arguments are known to users before they find that stuff by other means. Also, its to create some incentives to work on that. So these sections are definitely not good yet :X So far, this is more a “better than nothing, and avoid some dangerous assumptions” section :smiley:

I hope I understood your question right (feel free to tell me if not):

the file will be updated by systemd updates. Changes to the file will be overwritten on the next systemd update (that’s mentioned in a note in the hardening page). The file is intentionally designed to override other application’s configs that try to override defaults (such as the file that disabled yama.ptrace_scope). However, if users want intentionally to override the hardening defaults, they can do so by a 99*.conf file that is used after the 99-kernel-hardening conf. See the sysctl.d man section " CONFIGURATION DIRECTORIES AND PRECEDENCE". The relevant folder for that is /etc/sysctl.d

Maybe its worth to add a paragraph in future about this, but I felt it gets too much for average users, and those who really need to know (usually with some existing expertise about how such things are organized) or those who ask us, will find out themselves: I think this might be better something we document in #hardening in Discourse. Just another compromise of course. I think #hardening will be better for eccentric cases, to avoid the page to peter out.

Answered in my last answer :classic_smiley: (I think?)

I do not understand this question in the given context, sorry :classic_smiley:

Initial trivial update:

Keep in mind, regarding formatting and related stuff, adoc is unfortunately limited. Some basic functions people take for granted are not available there, or only with little adjustment possibilities.