|
1 | 1 | class ocf::packages::kernel {
|
2 | 2 | if $::lsbdistcodename != 'stretch' {
|
3 |
| - # Disable some kernel features: module loading after boot, kexec, |
4 |
| - # Berkeley Packet Filter (BPF). Not to be confused with the lockdown |
5 |
| - # security module introduced with Linux 5.4, which imposes similar |
6 |
| - # restrictions. |
7 |
| - package { 'lockdown': } |
| 3 | + # Harden kernel using kernel command line options and sysctl settings |
| 4 | + # recommended by the Kernel Self Protection Project: |
| 5 | + # https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings |
| 6 | + # Tails makes similar changes: |
| 7 | + # https://tails.boum.org/contribute/design/kernel_hardening/ |
| 8 | + # kernel command line changes - potential performance impact: |
| 9 | + # * always enable kernel address space layout randomization (KASLR) |
| 10 | + # * always enable kernel page-table isolation (PTI, formerly KAISER) |
| 11 | + # * wipe slab and page allocations and enable sanity checks |
| 12 | + # * disable simultaneous multithreading (SMT) aka hyperthreading (HT) |
| 13 | + # sysctl changes: |
| 14 | + # * disable kexec |
| 15 | + # * restrict ptrace access to parent processes |
| 16 | + # * disable user namespaces |
| 17 | + # currently breaks systemd services specifying PrivateUsers=yes, |
| 18 | + # such as upower on bullseye, see |
| 19 | + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=959884 |
| 20 | + # * disable unprivileged Berkeley Packet Filter (BPF) access |
| 21 | + # For bullseye, also consider enabling the lockdown security module |
| 22 | + # introduced with Linux 5.4. |
| 23 | + package { 'hardening-runtime': } |
8 | 24 |
|
9 | 25 | if $::is_virtual {
|
10 | 26 | # Install cloud kernel image which removes some hardware support.
|
|
0 commit comments