Kernel Hardening
I’ve adjusted the kernel parameters to reduce information leaks and limit attack surfaces:
- Restricted kernel pointer exposure (kptr_restrict=1) and kernel message access (dmesg_restrict=1) to prevent leaking sensitive kernel info.
- Enabled heap protections (slab_nomerge=1, slub_debug=PZ) to harden kernel memory management.
- Disabled kernel features like kexec to prevent certain rootkit exploits.
- Set ptrace_scope=1 to restrict debugging and attachment by untrusted processes.
- Disabled core dumps from SUID programs (fs.suid_dumpable=0) to prevent leaking sensitive data.
- Restricted unprivileged BPF and user namespace cloning, adding layers of process isolation.
Network Security
I’ve hardened my network stack by:
- Enabling TCP SYN cookies (tcp_syncookies=1) and RFC 1337 compliance for TCP.
- Activating reverse path filtering (rp_filter=1) to prevent IP spoofing.
- Disabling ICMP redirects and router advertisements for IPv4 and IPv6, reducing attack vectors.
Filesystem Protections
To prevent malicious symlinks and hardlinks, I enabled:
- fs.protected_symlinks=1
- fs.protected_hardlinks=1
- Additional protections for FIFOs and regular files.
Performance & Usability Tweaks
I fine-tuned memory management to keep my system responsive:
- Set vm.swappiness=0 to favor RAM over swap. (12gig installed)
- Adjusted cache pressure and dirty ratios to optimize disk and memory performance.
Boot Configuration
I’ve modified my GRUB boot parameters to further enhance security:
- Added mitigations=auto for balanced CPU vulnerability mitigation.
- Enabled slab_nomerge to prevent certain kernel heap exploits.
- Included init_on_alloc=0 and init_on_free=0 for better performance, which are safe for desktop use.
Additional Security Measures
- Enabled ufw firewall with default deny policies, only opening necessary ports.
- Set up automatic security updates with unattended-upgrades.
- Ensured AppArmor is active and enforcing profiles for application confinement.
- Use privacy-enhancing browser extensions (like uBlock Origin & Privacy Badger & Malwarebytes Browser Guard) for safe browsing.
- Regularly back up my system with Timeshift and external storage to safeguard against data loss.
Overall, this setup provides a solid security foundation while keeping the system fast and user-friendly. It’s a work in progress, but I feel confident that it strikes the right balance for my daily desktop use.