mirror of
https://github.com/BagelHole/DevOps-Security-Agent-Skills.git
synced 2026-08-22 12:49:53 +02:00
.
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
# Linux Kernel Security Hardening
|
||||
# Place in /etc/sysctl.d/99-security.conf
|
||||
# Apply with: sysctl -p /etc/sysctl.d/99-security.conf
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# NETWORK SECURITY
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Disable IP forwarding (unless router)
|
||||
net.ipv4.ip_forward = 0
|
||||
net.ipv6.conf.all.forwarding = 0
|
||||
|
||||
# Disable packet redirect sending
|
||||
net.ipv4.conf.all.send_redirects = 0
|
||||
net.ipv4.conf.default.send_redirects = 0
|
||||
|
||||
# Disable ICMP redirect acceptance
|
||||
net.ipv4.conf.all.accept_redirects = 0
|
||||
net.ipv4.conf.default.accept_redirects = 0
|
||||
net.ipv4.conf.all.secure_redirects = 0
|
||||
net.ipv4.conf.default.secure_redirects = 0
|
||||
net.ipv6.conf.all.accept_redirects = 0
|
||||
net.ipv6.conf.default.accept_redirects = 0
|
||||
|
||||
# Disable 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
|
||||
|
||||
# Log suspicious packets
|
||||
net.ipv4.conf.all.log_martians = 1
|
||||
net.ipv4.conf.default.log_martians = 1
|
||||
|
||||
# Ignore ICMP broadcast requests
|
||||
net.ipv4.icmp_echo_ignore_broadcasts = 1
|
||||
|
||||
# Ignore bogus ICMP error responses
|
||||
net.ipv4.icmp_ignore_bogus_error_responses = 1
|
||||
|
||||
# Enable reverse path filtering (spoofing protection)
|
||||
net.ipv4.conf.all.rp_filter = 1
|
||||
net.ipv4.conf.default.rp_filter = 1
|
||||
|
||||
# Enable TCP SYN cookies (SYN flood protection)
|
||||
net.ipv4.tcp_syncookies = 1
|
||||
|
||||
# Disable IPv6 router advertisements
|
||||
net.ipv6.conf.all.accept_ra = 0
|
||||
net.ipv6.conf.default.accept_ra = 0
|
||||
|
||||
# Disable IPv6 if not needed
|
||||
# net.ipv6.conf.all.disable_ipv6 = 1
|
||||
# net.ipv6.conf.default.disable_ipv6 = 1
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# KERNEL SECURITY
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Enable ASLR
|
||||
kernel.randomize_va_space = 2
|
||||
|
||||
# Restrict access to kernel pointers
|
||||
kernel.kptr_restrict = 2
|
||||
|
||||
# Restrict dmesg access
|
||||
kernel.dmesg_restrict = 1
|
||||
|
||||
# Restrict ptrace scope
|
||||
kernel.yama.ptrace_scope = 1
|
||||
|
||||
# Disable magic SysRq key
|
||||
kernel.sysrq = 0
|
||||
|
||||
# Restrict unprivileged user namespaces
|
||||
# kernel.unprivileged_userns_clone = 0
|
||||
|
||||
# Restrict loading TTY line disciplines
|
||||
dev.tty.ldisc_autoload = 0
|
||||
|
||||
# Restrict userfaultfd to privileged users
|
||||
vm.unprivileged_userfaultfd = 0
|
||||
|
||||
# Restrict BPF
|
||||
kernel.unprivileged_bpf_disabled = 1
|
||||
net.core.bpf_jit_harden = 2
|
||||
|
||||
# Restrict perf events
|
||||
kernel.perf_event_paranoid = 3
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# FILE SYSTEM SECURITY
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Restrict core dumps
|
||||
fs.suid_dumpable = 0
|
||||
|
||||
# Restrict hardlinks and symlinks
|
||||
fs.protected_hardlinks = 1
|
||||
fs.protected_symlinks = 1
|
||||
|
||||
# Protect FIFOs and regular files
|
||||
fs.protected_fifos = 2
|
||||
fs.protected_regular = 2
|
||||
Reference in New Issue
Block a user