113 lines
2.8 KiB
Plaintext
113 lines
2.8 KiB
Plaintext
# CIS Debian 13 Benchmark - Kernel Hardening Configuration
|
|
# Implements CIS recommendations for kernel security parameters
|
|
|
|
# Network Configuration
|
|
net.ipv4.ip_forward = 0
|
|
net.ipv6.conf.all.forwarding = 0
|
|
net.ipv4.conf.all.send_redirects = 0
|
|
net.ipv4.conf.default.send_redirects = 0
|
|
net.ipv4.conf.all.accept_redirects = 0
|
|
net.ipv4.conf.default.accept_redirects = 0
|
|
net.ipv4.conf.all.accept_source_route = 0
|
|
net.ipv4.conf.default.accept_source_route = 0
|
|
net.ipv6.conf.all.accept_redirects = 0
|
|
net.ipv6.conf.default.accept_redirects = 0
|
|
net.ipv4.conf.all.log_martians = 1
|
|
net.ipv4.conf.default.log_martians = 1
|
|
|
|
# TCP Hardening
|
|
net.ipv4.tcp_syncookies = 1
|
|
net.ipv4.tcp_max_syn_backlog = 2048
|
|
net.ipv4.tcp_synack_retries = 2
|
|
net.ipv4.tcp_syn_retries = 5
|
|
|
|
# IP Source Routing
|
|
net.ipv4.conf.all.accept_source_route = 0
|
|
net.ipv4.conf.default.accept_source_route = 0
|
|
net.ipv6.conf.all.accept_source_route = 0
|
|
net.ipv6.conf.default.accept_source_route = 0
|
|
|
|
# ICMP Redirects
|
|
net.ipv4.conf.all.accept_redirects = 0
|
|
net.ipv4.conf.default.accept_redirects = 0
|
|
net.ipv6.conf.all.accept_redirects = 0
|
|
net.ipv6.conf.default.accept_redirects = 0
|
|
|
|
# ICMP Redirect Broadcast
|
|
net.ipv4.icmp_echo_ignore_broadcasts = 1
|
|
net.ipv4.icmp_ignore_bogus_error_responses = 1
|
|
|
|
# ICMP Rate Limiting
|
|
net.ipv4.icmp_ratelimit = 100
|
|
net.ipv4.icmp_ratemask = 88089
|
|
|
|
# IPv6
|
|
net.ipv6.conf.all.disable_ipv6 = 1
|
|
net.ipv6.conf.default.disable_ipv6 = 1
|
|
|
|
# Log Suspicious Packets
|
|
net.ipv4.conf.all.log_martians = 1
|
|
net.ipv4.conf.default.log_martians = 1
|
|
|
|
# ExecShield Protection
|
|
kernel.exec-shield = 1
|
|
kernel.randomize_va_space = 2
|
|
|
|
# Core Dumps
|
|
kernel.core_pattern = |/bin/false
|
|
fs.suid_dumpable = 0
|
|
|
|
# Shared Memory
|
|
kernel.shmmax = 4294967295
|
|
kernel.shmall = 268435456
|
|
|
|
# Network Protection
|
|
net.ipv4.tcp_timestamps = 0
|
|
net.ipv4.tcp_sack = 1
|
|
net.ipv4.tcp_dsack = 1
|
|
|
|
# Protection against SYN flood attacks
|
|
net.ipv4.tcp_syncookies = 1
|
|
net.ipv4.tcp_synack_retries = 2
|
|
net.ipv4.tcp_syn_retries = 5
|
|
|
|
# Log Invalid Packets
|
|
net.ipv4.conf.all.log_martians = 1
|
|
net.ipv4.conf.default.log_martians = 1
|
|
|
|
# Ignore ICMP redirects
|
|
net.ipv4.conf.all.accept_redirects = 0
|
|
net.ipv4.conf.default.accept_redirects = 0
|
|
net.ipv6.conf.all.accept_redirects = 0
|
|
net.ipv6.conf.default.accept_redirects = 0
|
|
|
|
# Ignore Send Redirects
|
|
net.ipv4.conf.all.send_redirects = 0
|
|
net.ipv4.conf.default.send_redirects = 0
|
|
|
|
# Enable RFC-recommended source validation
|
|
net.ipv4.conf.all.rp_filter = 1
|
|
net.ipv4.conf.default.rp_filter = 1
|
|
|
|
# Disable IPv6
|
|
net.ipv6.conf.all.disable_ipv6 = 1
|
|
net.ipv6.conf.default.disable_ipv6 = 1
|
|
|
|
# ASLR
|
|
kernel.randomize_va_space = 2
|
|
|
|
# Disable magic SysRq key
|
|
kernel.sysrq = 0
|
|
|
|
# Limits on core dumps
|
|
fs.suid_dumpable = 0
|
|
|
|
# Restrict ptrace scope
|
|
kernel.yama.ptrace_scope = 1
|
|
|
|
# Disable kexec system call
|
|
kernel.kexec_load_disabled = 1
|
|
|
|
# AppArmor protection
|
|
kernel.apparmor_restrict_unprivileged_userns = 1
|
|
kernel.apparmor_restrict_unprivileged_io_uring = 1 |