-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hardening: kernel config modularization
* Created separate Kconfig file to enable virtualization, networking, usb, user input devices, debug, guest and guest graphics support on top of hardened baseline kernel config. * Using kernel merge_config.sh to merge kconfig fragments. * Introduces a top-level option to enable host hardening for targets and moves the subarea options under it. This allows development to enable working and sensible defaults without cluttering the targets (and users) with the details of the host hardening. Nix does not have module interface protection mechanisms (e.g. protected/private) so these options can still be used from the targets should the users wish to do so. * "allowImportFromDerivation = false" removed as it's the default value. Allow (true) made the nix flake show fail earlier but allowed bypassing NixOS asserted kernel config options from the baseline config instead of inline. * Added host, guest and pkvm modules to cover tests - hardened host kernel building and code patching with host-options. - hardened lenovo X1 guest kernel building and code patching with guest-options - hardened host pkvm kernel building and code patching with pkvm options * Refactor pkvm kernel builder * Updated documentation. Co-authored-by: Ville Ilvonen <[email protected]> Signed-off-by: Ville Ilvonen <[email protected]> Signed-off-by: Vunny Sodhi <[email protected]>
- Loading branch information
1 parent
811d411
commit 9f195aa
Showing
28 changed files
with
535 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
{pkgs, ...}: let | ||
config = pkgs.nixos [./test-configuration.nix]; | ||
in | ||
config.config.system.build.toplevel |
34 changes: 34 additions & 0 deletions
34
modules/hardware/lenovo-x1/kernel/guest/test/test-configuration.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
{ | ||
config, | ||
lib, | ||
... | ||
}: { | ||
imports = [ | ||
../../../../x86_64-generic/kernel/host/default.nix | ||
../../../../x86_64-generic/kernel/guest/default.nix | ||
]; | ||
|
||
# baseline, virtualization and network hardening are | ||
# generic to all x86_64 devices | ||
config.ghaf.host.kernel.hardening.enable = true; | ||
config.ghaf.host.kernel.hardening.virtualization.enable = true; | ||
config.ghaf.host.kernel.hardening.networking.enable = true; | ||
config.ghaf.host.kernel.hardening.inputdevices.enable = true; | ||
# usb/debug hardening is host optional but required for -debug builds | ||
config.ghaf.host.kernel.hardening.usb.enable = true; | ||
config.ghaf.host.kernel.hardening.debug.enable = true; | ||
|
||
# guest VM kernel specific options | ||
config.ghaf.guest.kernel.hardening.enable = true; | ||
config.ghaf.guest.kernel.hardening.graphics.enable = true; | ||
|
||
# required to module test a module via top level configuration | ||
config.boot.loader.systemd-boot.enable = true; | ||
config.fileSystems."/" = { | ||
device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000"; | ||
fsType = "ext4"; | ||
}; | ||
config.system.stateVersion = lib.trivial.release; | ||
} |
Oops, something went wrong.