Add script to update kconfigs
authorWillenst <willenst@gmail.com>
Sat, 23 Nov 2024 17:46:18 +0000 (19:46 +0200)
committerWillenst <willenst@gmail.com>
Sat, 23 Nov 2024 17:58:51 +0000 (19:58 +0200)
kernel_hardening_checker/config_files/distros/get_kconfigs.sh [new file with mode: 0755]
kernel_hardening_checker/config_files/links.txt [deleted file]

diff --git a/kernel_hardening_checker/config_files/distros/get_kconfigs.sh b/kernel_hardening_checker/config_files/distros/get_kconfigs.sh
new file mode 100755 (executable)
index 0000000..8d0fdda
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+oracle_git_url="https://raw.githubusercontent.com/oracle/kconfigs/refs/heads/gh-pages/out/"
+arch_git_url="https://gitlab.archlinux.org/archlinux/packaging/packages/"
+
+distros_from_oracle=(
+    "Android 12 (5.10) aarch64"
+    "Android 15 (6.6) aarch64"
+    "Arch x86_64"
+    "CentOS Hyperscale 9 aarch64"
+    "CentOS Hyperscale 9 x86_64"
+    "Debian 10 Buster x86_64"
+    "Debian 13 Trixie aarch64"
+    "Debian 13 Trixie x86_64"
+    "Fedora 39 Core aarch64"
+    "Fedora 39 Core x86_64"
+    "Fedora 41 Core aarch64"
+    "Fedora 41 Core x86_64"
+    "Oracle Linux 7 (UEK 4) x86_64"
+    "Oracle Linux 9 (UEK-NEXT) aarch64"
+    "Oracle Linux 9 (UEK-NEXT) x86_64"
+    "Ubuntu 20.04 LTS Focal x86_64"
+    "Ubuntu 24.04 LTS Noble aarch64"
+    "Ubuntu 24.04 LTS Noble x86_64"
+)
+
+for distro in "${distros_from_oracle[@]}"; do
+    filename=$(echo ${distro// /_}) # Replace spaces with underscores
+    wget -O "${filename}.config" "${oracle_git_url}${distro}/config" # Fetch kconfig
+done
+
+# Fetch some other kconfigs
+wget -O Clearlinux_x86_64.config https://raw.githubusercontent.com/clearlinux-pkgs/linux/master/config
+wget -O Clearlinux_x86_64.cmdline https://raw.githubusercontent.com/clearlinux-pkgs/linux/master/cmdline
+wget -O OpenSUSE_x86_64.config https://raw.githubusercontent.com/openSUSE/kernel-source/refs/heads/master/config/x86_64/default
+wget -O OpenSUSE_aarch64.config https://raw.githubusercontent.com/openSUSE/kernel-source/refs/heads/master/config/arm64/default
+wget -O SLE-15-SP7_x86_64.config https://raw.githubusercontent.com/openSUSE/kernel-source/refs/heads/SLE15-SP7/config/x86_64/default
+wget -O SLE-15-SP7_aarch64.config https://raw.githubusercontent.com/openSUSE/kernel-source/refs/heads/SLE15-SP7/config/arm64/default
+wget -O Azure_linux_x86_64.config https://raw.githubusercontent.com/microsoft/azurelinux/refs/heads/1.0/SPECS/kernel/config
+wget -O Archlinux-hardened_x86_64.config ${arch_git_url}linux-hardened/-/raw/main/config?ref_type=heads
diff --git a/kernel_hardening_checker/config_files/links.txt b/kernel_hardening_checker/config_files/links.txt
deleted file mode 100644 (file)
index 421ed71..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-######################################################
-#                                                    #
-# Some kernel configurations are available directly. #
-#                                                    #
-######################################################
-
-Alpine Linux:
-https://git.alpinelinux.org/aports/plain/main/linux-lts/config-lts.x86_64
-
-Amazon Linux 2:
-http://52.45.193.166/mirrors/http/amazonlinux.us-east-1.amazonaws.com/amazon_linux_2/?C=M;O=D
-
-Arch Linux:
-https://git.archlinux.org/svntogit/packages.git/plain/linux-hardened/trunk/config
-
-Clear Linux OS:
-https://raw.githubusercontent.com/clearlinux-pkgs/linux/master/config
-https://raw.githubusercontent.com/clearlinux-pkgs/linux/master/cmdline
-
-Oracle Linux: Unbreakable Enterprise Kernel (UEK):
-https://raw.githubusercontent.com/oracle/linux-uek/uek6/master/uek-rpm/ol7/config-x86_64
-
-SUSE Linux Enterprise (SLE):
-https://kernel.opensuse.org/cgit/kernel-source/plain/config/x86_64/default?h=SLE15-SP2
-
-openSUSE:
-https://kernel.opensuse.org/cgit/kernel-source/plain/config/x86_64/default?h=openSUSE-15.1
-
-Pentoo:
-https://raw.githubusercontent.com/pentoo/pentoo-livecd/master/livecd/amd64/kernel/config-5.5.5
-
-Debian Buster:
-https://packages.debian.org/buster/amd64/linux-image-4.19.0-8-amd64/download
-
-Android Open Source Project (AOSP):
-https://source.android.com/docs/setup/build/building-kernels
-
-Android Generic Kernel Image (GKI):
-https://source.android.com/docs/core/architecture/kernel/gki-release-builds
-
-CLIP OS:
-https://docs.clip-os.org/clipos/kernel.html#configuration
-https://github.com/clipos/src_platform_config-linux-hardware
-https://github.com/clipos/products_clipos/blob/master/efiboot/configure.d/95_dracut.sh
-
-NixOS:
-run contrib/get-nix-kconfig.py from nix-shell to get the kernel configs
-
-CBL-Mariner:
-https://github.com/microsoft/CBL-Mariner/blob/1.0/SPECS/kernel/config