- deny-by-default iptables/ip6tables: public cuma 22/80/443/4013, sisanya localhost + tailscale CGNAT; log FW-DROP rate-limited - persist via netfilter-persistent (rules.v4/v6) + /usr/local/bin/firewall.sh - sysctl hardening: syncookies, rp_filter, redirect off, kptr/dmesg restrict, protected links, somaxconn, tcp retries tuner - sshd: PasswordAuthentication no (fix 50-cloud-init.conf override), PermitRootLogin prohibit-password, MaxAuthTries 4, LoginGraceTime 30, X11Forwarding no
41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
# OrangeVPS hardening sysctl — /etc/sysctl.d/99-hardening.conf
|
|
# Network hardening
|
|
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.send_redirects = 0
|
|
net.ipv4.conf.default.send_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.ipv6.conf.all.accept_source_route = 0
|
|
net.ipv6.conf.default.accept_source_route = 0
|
|
|
|
# TCP hardening
|
|
net.ipv4.tcp_max_syn_backlog = 4096
|
|
net.ipv4.tcp_synack_retries = 2
|
|
net.ipv4.tcp_syn_retries = 3
|
|
net.ipv4.tcp_fin_timeout = 15
|
|
net.ipv4.tcp_keepalive_time = 120
|
|
net.ipv4.tcp_keepalive_intvl = 30
|
|
net.ipv4.tcp_keepalive_probes = 5
|
|
net.ipv4.tcp_tw_reuse = 1
|
|
net.ipv4.ip_local_port_range = 1024 65535
|
|
|
|
# Kernel hardening
|
|
kernel.randomize_va_space = 2
|
|
kernel.core_uses_pid = 1
|
|
kernel.dmesg_restrict = 1
|
|
kernel.kptr_restrict = 1
|
|
kernel.yama.ptrace_scope = 2
|
|
fs.protected_hardlinks = 1
|
|
fs.protected_symlinks = 1
|
|
fs.suid_dumpable = 0
|
|
|
|
# Resource limits (SYN flood protection)
|
|
net.core.somaxconn = 1024
|
|
net.core.netdev_max_backlog = 4096
|