با سلام و احترام
چند پارامتر مهم در sysctl جهت کاهش مخاطرات احتمالی بر روی سرورهای لینوکسی(شایان ذکر است کلیه پارامترها می بایست بر اساس میزان لود موجود بر روی منابع سیستمی, ترافیک شبکه و تجهیزات امنیتی موجود در مسیر سرور تغییر یابد):
چند پارامتر مهم در sysctl جهت کاهش مخاطرات احتمالی بر روی سرورهای لینوکسی(شایان ذکر است کلیه پارامترها می بایست بر اساس میزان لود موجود بر روی منابع سیستمی, ترافیک شبکه و تجهیزات امنیتی موجود در مسیر سرور تغییر یابد):
کد PHP:
Prevent SYN Attack
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_max_syn_backlog = 4096
Disable packet forwarding
net.ipv4.ip_forward = 0
net.ipv4.conf.all.forwarding = 0
net.ipv4.conf.default.forwarding = 0
net.ipv6.conf.all.forwarding = 0
net.ipv6.conf.default.forwarding = 0
Disables IP source routing
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_source_route = 0
net.ipv6.conf.default.accept_source_route = 0
Enable IP spoofing protection, turn on source route verification
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
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
Enable Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.default.log_martians = 1
Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 7
Decrease the time default value for connections to keep alive
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 15
Disable proxy arp for anyone
net.ipv4.conf.all.proxy_arp = 0
Enable ignoring broadcasts request
net.ipv4.icmp_echo_ignore_broadcasts = 1
For servers with tcp-heavy workloads, enable 'fq' queue management scheduler (kernel > 3.12)
net.core.default_qdisc = fq
Increase the read-buffer space allocatable
net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem_min = 16384
net.core.rmem_default = 262144
net.core.rmem_max = 16777216
Turn on the tcp_window_scaling
net.ipv4.tcp_window_scaling = 1
Increase the tcp-time-wait buckets pool size to prevent simple DOS attacks
net.ipv4.tcp_max_tw_buckets = 1440000
Limit the maximum memory used to reassemble IP fragments
net.ipv4.ipfrag_low_thresh = 196608
net.ipv6.ip6frag_low_thresh = 196608
net.ipv4.ipfrag_high_thresh = 262144
net.ipv6.ip6frag_high_thresh = 262144