-
Notifications
You must be signed in to change notification settings - Fork 84
LKRG Lockdown #439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
LKRG Lockdown #439
Conversation
Thank you for the suggestion/contribution!
I think this is too much of a special case. If we add unload protection, it should be more general. Also, we need to maintain a consistent security model against a relevant threat model. There's little point in disallowing LKRG unload when we don't also disallow reconfiguration via sysctl that would effectively disable LKRG (while keeping it loaded). Rather, it'd make more sense to have a combined "no unload or configuration weakening" setting that would work for all installs. So as much as we'd have liked to gain you as a contributor, I think we shouldn't merge this specific change now. @Adam-pi3 @kerneltoast What do you think? There are also some minor issues I see in the code, such as wrong indentation. But no point fixing this if we aren't going to merge this in principle. |
I don't think this makes much sense given that lockdown only has value when used in conjunction with secure boot. That means you'd need to get lkrg.ko signed by a secure boot CA or use your own secure boot key. And per the spirit of lockdown, the sysctl knobs would indeed need to be locked down when the lockdown LSM is active. I don't think this effort is worth it right now. |
Yes, this needs to be combined with further lockdown of certain config values. |
I dislike tying this functionality to lockdown in any way at all. I think we don't have to. |
Kernel lockdown is a core part of kernel-mode security. Perhaps tying this could be set by a build-time flag? |
I really would rather keep our lockdown feature separate from kernel lockdown, working independently of whether kernel lockdown is supported/enabled. I don't want to clutter the project (and documentation!) with more build-time flags. |
Also, there was the idea of password-protected (we'd keep a hash) unload/reconfiguration. We'll probably want that eventually. |
That would be a good idea, gives users some more flexibility (fail safe in case of errors). |
It may have sense if we improve self-defense, hiding and lock sysctl as was mentioned by @solardiz and @kerneltoast. I think our old idea of passowrd protected unload (and sysctl) would likely be a good option to explore |
I've changed my code to add a separate LKRG lockdown mechanism (optionally auto-invoked by kernel lockdown). Will be easier now to add sysctl protection. EDIT: not yet added possibility of LKRG_LOCKED_DOWN=0 & LKRG_LOCKDOWN_BY_KERNEL=0 but lock down LKRG via command line |
Description
This adds some code to bump the module refcount to prevent unloading LKRG. Only makes sense with kernel lockdown enabled and a kernel built with 'CONFIG_MODULE_FORCE_UNLOAD=n' .
How Has This Been Tested?
Module was compiled with changes and behaved as expected during testing.