system

the Chamesle handbook, init, live ISO and install helpers
git clone https://github.com/tortr-rs/system
Log | Files | Refs | README | LICENSE

commit 5728edd6a5613a2f9ee1470462efa3ad49b935c7
parent b139ff7acdf6c69f73025a9a5f27fe7964d2560a
Author: torter <koubbamohamedrayan@gmail.com>
Date:   Sat, 21 Nov 2026 16:26:04 +0000

kernel hardening in sysctl.d, loaded by rc, /tmp nosuid,nodev

Diffstat:
Mfiles/etc/rc | 1+
Afiles/etc/sysctl.d/10-chamesle.conf | 24++++++++++++++++++++++++
Mhandbook/handbook.md | 13+++++++++++++
Mtools/chamesle-disk | 2+-
4 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/files/etc/rc b/files/etc/rc @@ -22,6 +22,7 @@ chmod 1777 /var/tmp hwclock -s 2>/dev/null host=$(conf hostname) [ -n "$host" ] && echo "$host" > /proc/sys/kernel/hostname +for f in /etc/sysctl.d/*.conf /etc/sysctl.conf; do [ -f "$f" ] && sysctl -q -p "$f"; done dmesg > /var/log/dmesg.boot for s in $(conf boot-services); do service "$s" start diff --git a/files/etc/sysctl.d/10-chamesle.conf b/files/etc/sysctl.d/10-chamesle.conf @@ -0,0 +1,24 @@ +# kernel addresses and its log are root's +kernel.kptr_restrict = 1 +kernel.dmesg_restrict = 1 +# ptrace only on your own children, no bpf for users +kernel.yama.ptrace_scope = 1 +kernel.unprivileged_bpf_disabled = 1 +net.core.bpf_jit_harden = 2 +# links and files in sticky directories like /tmp +fs.protected_symlinks = 1 +fs.protected_hardlinks = 1 +fs.protected_fifos = 2 +fs.protected_regular = 2 +fs.suid_dumpable = 0 +# network +net.ipv4.tcp_syncookies = 1 +net.ipv4.conf.all.rp_filter = 1 +net.ipv4.conf.default.rp_filter = 1 +net.ipv4.conf.all.accept_redirects = 0 +net.ipv4.conf.default.accept_redirects = 0 +net.ipv4.conf.all.secure_redirects = 0 +net.ipv4.conf.all.send_redirects = 0 +net.ipv4.conf.all.accept_source_route = 0 +net.ipv6.conf.all.accept_redirects = 0 +net.ipv6.conf.default.accept_redirects = 0 diff --git a/handbook/handbook.md b/handbook/handbook.md @@ -665,6 +665,18 @@ the network. dhcpcd gives it an address. On a ZFS root, `/etc/rc` runs `zfs mount -a` right after `mount -a`, which mounts `rpool/home` and `rpool/var`; the root itself was mounted by the initramfs. +### 6.10 Kernel settings + +`/etc/rc` loads every `/etc/sysctl.d/*.conf` and `/etc/sysctl.conf` at boot. The base ships +`/etc/sysctl.d/10-chamesle.conf`: kernel addresses and `dmesg` are for root only (`doas dmesg`), a process may +`ptrace` only its own children, users get no BPF, links and files in sticky directories like `/tmp` are protected, +setuid programs leave no core dumps, and the network takes no redirects or source routes and filters spoofed +addresses. To change one, put it in a file of your own that sorts later, `/etc/sysctl.d/90-local.conf`: + + kernel.dmesg_restrict = 0 + +`sysctl -a` lists them all, `sysctl -w name=value` changes one until the next boot. + ## 7. The kernel and firmware @@ -921,6 +933,7 @@ X writes `~/.local/share/xorg/Xorg.0.log`; `grep EE` in it shows the errors. | `/etc/profile` | `PATH`, `umask` | | `/etc/passwd`, `/etc/shadow`, `/etc/group`, `/etc/shells` | accounts, passwords, groups, login shells | | `/etc/fstab` | file systems | +| `/etc/sysctl.d/` | kernel settings loaded at boot (6.10) | | `/etc/os-release` | `NAME=Chamesle`, `ID=chamesle` | | `/etc/mag/` | `repos`, `keys/`, `arch` | | `/etc/mkinitfs/mkinitfs.conf` | what goes into the initramfs | diff --git a/tools/chamesle-disk b/tools/chamesle-disk @@ -57,7 +57,7 @@ else UUID=$(blkid -s UUID -o value "$boot") /boot vfat rw,noatime 0 2 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 -tmpfs /tmp tmpfs mode=1777 0 0 +tmpfs /tmp tmpfs mode=1777,nosuid,nodev 0 0 F fi