# Webinoly (This configuration file is only for internal use) ##################################################################################################### # Please, DO NOT MODIFY this file, all the changes will be lost. # # If you need to add/modify any of the existing rules, here: /etc/sysctl.conf # # Please, read the documentation: https://webinoly.com/documentation/ # ##################################################################################################### ####################################### ### GENERAL SYSTEM SECURITY OPTIONS ### ####################################### # Maximum number of files the kernel can be allocated fs.file-max = 9223372036854775807 # Maximum number of files that can be assigned a single process fs.nr_open = 2147483584 # Maximum number of asynchronous I/O requests fs.aio-max-nr = 18446744073709551615 # Controls the System Request debugging functionality of the kernel kernel.sysrq = 0 # Controls whether core dumps will append the PID to the core filename. # Useful for debugging multi-threaded applications. kernel.core_uses_pid = 1 #Allow for more PIDs kernel.pid_max = 4194304 # Address space layout randomization (ASLR) kernel.randomize_va_space = 2 # Controls the maximum size of a message, in bytes kernel.sem = 32000 1024000000 500 32000 kernel.msgmni = 16384 kernel.msgmax = 65535 kernel.msgmnb = 65535 # Restrict core dumps fs.suid_dumpable = 0 # Restrict access to kernel logs kernel.dmesg_restrict = 1 # Hide exposed kernel pointers kernel.kptr_restrict = 1 # Sets the time before the kernel considers migrating a proccess to another core # This variable is no longer in sysctl, moved to: /sys/kernel/debug/sched/migration_cost_ns #kernel.sched_migration_cost_ns = 5000000 # Group tasks by TTY kernel.sched_autogroup_enabled = 0 ######################################## ### IMPROVE SYSTEM MEMORY MANAGEMENT ### ######################################## # Do less swapping vm.swappiness = 10 vm.dirty_ratio = 50 vm.dirty_background_ratio = 5 vm.dirty_expire_centisecs = 1400 # Only for ram > 28G #vm.dirty_bytes = 5505024000 #vm.dirty_background_bytes = 917504000 #vm.dirty_writeback_centisecs = 100 # specifies the minimum virtual address that a process is allowed to mmap vm.mmap_min_addr = 65535 # 50% overcommitment of available memory vm.overcommit_ratio = 50 vm.overcommit_memory = 0 # Set maximum amount of memory allocated to shm kernel.shmall = 4294967296 kernel.shmmax = 68719476736 kernel.shmmni = 4096 # Keep at least 64MB of free RAM space available vm.min_free_kbytes = 65535 # Vitual memory vm.max_map_count = 262144 # Disable reclaim memory when a zone runs out of memory. vm.zone_reclaim_mode = 0 ######################################## ### GENERAL NETWORK SECURITY OPTIONS ### ######################################## #Prevent SYN attack, enable SYNcookies (they will kick-in when the max_syn_backlog reached) net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_max_syn_backlog = 65535 # Never decrease these 'retries' values net.ipv4.tcp_syn_retries = 6 net.ipv4.tcp_synack_retries = 5 # Disables packet forwarding net.ipv4.ip_forward = 0 net.ipv4.conf.all.forwarding = 0 #net.ipv4.conf.all.mc_forwarding = 0 net.ipv4.conf.default.forwarding = 0 net.ipv6.conf.all.forwarding = 0 #net.ipv6.conf.all.mc_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 # 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 # Deny Router Solicitations net.ipv6.conf.all.router_solicitations = 0 net.ipv6.conf.default.router_solicitations = 0 net.ipv6.conf.all.accept_ra_rtr_pref = 0 net.ipv6.conf.default.accept_ra_rtr_pref = 0 net.ipv6.conf.all.accept_ra_pinfo = 0 net.ipv6.conf.default.accept_ra_pinfo = 0 net.ipv6.conf.all.accept_ra_defrtr = 0 net.ipv6.conf.default.accept_ra_defrtr = 0 net.ipv6.conf.all.dad_transmits = 0 net.ipv6.conf.default.dad_transmits = 0 # Enable IP spoofing protection, turn on source route verification net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.default.rp_filter = 1 # 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 = 90 net.ipv4.tcp_keepalive_intvl = 10 net.ipv4.tcp_keepalive_probes = 9 # Don't relay bootp net.ipv4.conf.all.bootp_relay = 0 # Don't proxy arp for anyone net.ipv4.conf.all.proxy_arp = 0 # Turn on the tcp_timestamps, accurate timestamp make TCP congestion control algorithms work better net.ipv4.tcp_timestamps = 1 # Don't ignore directed pings net.ipv4.icmp_echo_ignore_all = 0 # Enable ignoring broadcasts request net.ipv4.icmp_echo_ignore_broadcasts = 1 # Enable bad error message Protection net.ipv4.icmp_ignore_bogus_error_responses = 1 # Allowed local port range net.ipv4.ip_local_port_range = 1024 65535 # Enable a fix for RFC1337 - time-wait assassination hazards in TCP net.ipv4.tcp_rfc1337 = 1 net.ipv4.tcp_sack=1 net.ipv4.tcp_mtu_probing = 1 net.ipv4.tcp_base_mss = 1024 # Workaround for the RFC 5961 Linux TCP flaw? net.ipv4.tcp_challenge_ack_limit = 999999999 # Restrict IPv6 Maximum Addresses net.ipv6.conf.all.max_addresses = 1 net.ipv6.conf.default.max_addresses = 1 ################################## ### TUNING NETWORK PERFORMANCE ### ################################## # For high-bandwidth low-latency networks, use 'bbr' congestion control (kernel > 4.9) # Only enabled in bionic (at least v4.15) # Do a 'sudo modprobe tcp_bbr' first net.ipv4.tcp_congestion_control = bbr net.ipv4.tcp_notsent_lowat = 16384 # Enable 'fq' queue management scheduler (kernel > 3.12) net.core.default_qdisc = fq # Turn on the tcp_window_scaling net.ipv4.tcp_window_scaling = 1 # Disabled (we have seen performance decreased when enabled) net.core.busy_read = 0 net.core.busy_poll = 0 # Maximum number of packets taken from all interfaces in one polling cycle (NAPI poll). net.core.netdev_budget = 425 # Seems like defaults are better for performance! # Increase the read-buffer space allocatable #net.ipv4.tcp_rmem = 4096 131072 6291456 #net.ipv4.udp_rmem_min = 4096 #net.core.rmem_default = 212992 #net.core.rmem_max = 212992 # Increase the write-buffer-space allocatable #net.ipv4.tcp_wmem = 4096 16384 4194304 #net.ipv4.udp_wmem_min = 4096 #net.core.wmem_default = 212992 #net.core.wmem_max = 212992 # Increase number of incoming connections net.core.somaxconn = 65535 # Increase number of incoming connections backlog net.core.netdev_max_backlog = 16384 net.core.dev_weight = 64 # Increase the maximum amount of option memory buffers net.core.optmem_max = 65535 # When mem allocated by TCP exceeds “pressure”, kernel will put pressure on TCP memory net.ipv4.tcp_mem=8388608 8388608 8388608 # Increase the tcp-time-wait buckets pool size to prevent simple DOS attacks net.ipv4.tcp_max_tw_buckets = 450000 # try to reuse time-wait connections, (recycle is deprecated) #net.ipv4.tcp_tw_recycle = 0 net.ipv4.tcp_tw_reuse = 1 # Limit number of orphans, each orphan can eat up to 16M (max wmem) of unswappable memory net.ipv4.tcp_max_orphans = 262144 net.ipv4.tcp_orphan_retries = 0 # Limit the maximum memory used to reassemble IP fragments (CVE-2018-5391) net.ipv4.ipfrag_low_thresh = 196608 net.ipv6.ip6frag_low_thresh = 196608 net.ipv4.ipfrag_high_thresh = 262144 net.ipv6.ip6frag_high_thresh = 262144 # don't cache ssthresh from previous connection net.ipv4.tcp_no_metrics_save = 1 net.ipv4.tcp_moderate_rcvbuf = 1 # Increase size of RPC datagram queue length net.unix.max_dgram_qlen = 512 # Prevent ARP issues net.ipv4.neigh.default.gc_thresh1 = 30000 net.ipv4.neigh.default.gc_thresh2 = 32000 net.ipv4.neigh.default.gc_thresh3 = 32768 net.ipv6.neigh.default.gc_thresh1 = 30000 net.ipv6.neigh.default.gc_thresh2 = 32000 net.ipv6.neigh.default.gc_thresh3 = 32768 # Adjust to arp table gc to clean-up more often net.ipv4.neigh.default.gc_interval = 30 # Increase TCP queue length net.ipv4.neigh.default.proxy_qlen = 96 net.ipv4.neigh.default.unres_qlen = 6 # Enable Explicit Congestion Notification (RFC 3168), disable it if it doesn't work for you net.ipv4.tcp_ecn = 1 net.ipv4.tcp_reordering = 3 # How many times to retry killing an alive TCP connection net.ipv4.tcp_retries2 = 15 net.ipv4.tcp_retries1 = 3 # Avoid falling back to slow start after a connection goes idle # keeps our cwnd large with the keep alive connections (kernel > 3.6) net.ipv4.tcp_slow_start_after_idle = 0 # Allow the TCP fastopen flag to be used, beware some firewalls do not like TFO! (kernel > 3.7) net.ipv4.tcp_fastopen = 3 # This will enusre that immediatly subsequent connections use the new values net.ipv4.route.flush = 1 net.ipv6.route.flush = 1