anthraxx / linux-hardened

Minimal supplement to upstream Kernel Self Protection Project changes. Features already provided by SELinux + Yama and archs other than multiarch arm64 / x86_64 aren't in scope. Only tags have stable history. Shared IRC channel with KSPP: irc.libera.chat #linux-hardening
Other
567 stars 56 forks source link

Manage kernel configuration hardening in a separate repository #28

Open tsautereau-anssi opened 4 years ago

tsautereau-anssi commented 4 years ago

Many commits from the linux-hardened patchset are fixing Kconfig files in order to change default values for various options. I think that such commits:

For these reasons, I'd really like to get rid of all such commits, but a security-minded kernel configuration definitely remains crucial and utterly relevant to a hardened Linux kernel project. Together with @msalaun-anssi, we thus discussed several ways of improving this situation, among which:

We think that the second proposition would be the best way to correct the aforementioned issues, and is particularly relevant in light of the upcoming creation of a GitHub organization dedicated to managing the linux-hardened project, since handling several repositories will become easier. I'm therefore creating this issue to gather feedback and keep track of any future work on that matter. Thanks!

Bernhard40 commented 4 years ago

This sounds very reasonable.

anthraxx commented 4 years ago

I have been thinking about this for quite a while but for now I'm not sure if I agree. I fully see the points provided here, but in my opinion this project should be more than just feature patches on top of vanilla. This is supposed to be a hardened kernel project which in my humble opinion should also include security by default with an opt-out instead of opt-in approach when it comes to choosing Kconfig options. I like the LINUX_HARDENED Kconfig enforcing options, but as that's an all or nothing approach, I would still prefer dealing with sane defaults on top of providing the LINUX_HARDENED options and the dedicated options would be touched anyway. It's not that i don't like CLIP OS approach, i very much do, but on the other hand I'm not sure if I want to make that "mandatory" on top of the kernel sources to achieve something appropriate. CLIP OS itself has a bigger scope and ecosystem around it, for now i really liked that using this repository as kernel source offers your security (including option adjustments) in a self contained way :thinking: What I especially like is the documentation of CLIP OS, so I believe it would be an awesome idea to do something similar to explain hardening options and their default values.

So for now i would suggest the following potential action points:

Bernhard40 commented 4 years ago

The linux-hardened kconfig selection is vastly incomplete so I wouldn't call it self-contained right now. I think dropping those few patches is accepting reality that this project is in maintenance mode and there is no manpower to achieve something better while other active projects exist which are filling that void.

anthraxx commented 4 years ago

I strongly disagree here. The goal is to get this into shape and not to bring it into maintenance mode. Patches are welcome so start contributing config proposals would be a way to bring it into dorm again instead of taking it to the graveyard.

Bernhard40 commented 4 years ago

Ok, but dropping kconfigs could help to get more focus on bringing new features. Unlike kconfigs there is already some activity in that part so we can guess this is what people are interested in contributing.

anthraxx commented 4 years ago

I don't see how removing kconfig changes would bring any activity in creating new features, that doesn't correlate with each other. The problem is lack of contributors and not lack of focus.

tsautereau-anssi commented 4 years ago

I have been thinking about this for quite a while but for now I'm not sure if I agree. I fully see the points provided here, but in my opinion this project should be more than just feature patches on top of vanilla. This is supposed to be a hardened kernel project which in my humble opinion should also include security by default with an opt-out instead of opt-in approach when it comes to choosing Kconfig options.

That's exactly why I mentioned a tool that would leverage this separate repository to help generate a custom but still-hardened-by-default kernel configuration, in a simple way. And the fact that this project should be more than just feature patches is truly one of the reasons that make me want to structure things better, making it clearer and easier to use and maintain.

I like the LINUX_HARDENED Kconfig enforcing options, but as that's an all or nothing approach,

That's why I think it's not the solution that should be adopted.

anthraxx commented 4 years ago

I think this is a bit selectively answered, as the following block explains why I believe I currently prefer to see that happening in a central and self contained place. I can just repeat that I like the structuring in CLIP OS src_platform_config-linux-hardware/kernel_config but on the other hand I still believe its more feasible in CLIP OS as the scope is far far beyond a kernel, its a whole operating system with an ecosystem around to build and maintain it. We "only" have a kernel here and not a whole operating system, moving all kconfig related things out of this place will in my opinion not bring many advantages, however downstream consumers would need to carry the burden by keep a secondary config tool repository in sync with the patchset (used tree version) to achieve something appropriate. A simple make defoldconf won't handle new switches and people would be expected to use additional tooling (which must carefully be kept in sync). I believe the scope here is a bit more limited and the gain doesn't really justify the scarifies, especially not for an average consumer of the kernel sources. I also didn't say LINUX_HARDENED should be the only approach, but it may be a neat an additional option to indicate if the strongly recommended set of hardening options is in place or if consumers have deviated from them.

tsautereau-anssi commented 4 years ago

I think this is a bit selectively answered, as the following block explains why I believe I currently prefer to see that happening in a central and self contained place.

Sorry, I just didn't feel it necessary to build on that part as I think the comparison with CLIP OS is not relevant here - I just mentioned it as an illustration.

I can just repeat that I like the structuring in CLIP OS src_platform_config-linux-hardware/kernel_config but on the other hand I still believe its more feasible in CLIP OS as the scope is far far beyond a kernel, its a whole operating system with an ecosystem around to build and maintain it. We "only" have a kernel here and not a whole operating system,

I don't understand this argument since I don't see how this is related to CLIP OS being more than a kernel. For that matter, we actually chose to have a separate repository for kernel settings precisely because we wanted to help people reuse our hardened kernel for their own projects, independently of CLIP OS. And you said yourself that you want linux-hardened to be more than just a set of patches.

moving all kconfig related things out of this place will in my opinion not bring many advantages, however downstream consumers would need to carry the burden by keep a secondary config tool repository in sync with the patchset (used tree version) to achieve something appropriate. A simple make defoldconf won't handle new switches and people would be expected to use additional tooling (which must carefully be kept in sync). I believe the scope here is a bit more limited and the gain doesn't really justify the scarifies, especially not for an average consumer of the kernel sources.

I understand your point. Yes, there's probably a little downside. I believe it's worth it though.

anthraxx commented 4 years ago

Maybe its just me, but I still fail to see how removing Kconfig suggestions to sane defaults stops or hinders people from reuse the hardened kernel for their own projects. Maybe we could start that config maker to play around with it, side by side, and maybe one day I change my mind to remove kconfig changes, but for the time being I still don't see the problem in having it in here on top.

theLOICofFRANCE commented 4 years ago

[RFC] kconfig: add hardened defconfig helpers (2018) [v2] kconfig: add hardened defconfig helpers

egberts commented 2 years ago

check out #68 for using a single text file full of desired hardened Kconfig settings