Skip to content

Commit a648382

Browse files
authored
Merge pull request #418 from joubbi/documentation2
Improve Documentation for sysctl defaults
2 parents 2076990 + 97c55d6 commit a648382

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

roles/os_hardening/defaults/main.yml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,27 @@ sysctl_config:
137137
# kernel.yama.ptrace_scope = 1
138138
kernel.yama.ptrace_scope: 1
139139

140-
# Disable IPv4 traffic forwarding. | sysctl-01
140+
# Disable traffic forwarding.
141+
# Setting the flag to 0 ensures that a system with multiple interfaces (for example, a hard
142+
# proxy), will never be able to forward packets, and therefore, never serve as a router.
143+
# | sysctl-01 | sysctl-19
141144
net.ipv4.ip_forward: 0
145+
net.ipv6.conf.all.forwarding: 0
142146

143-
# Enable RFC-recommended source validation feature. | sysctl-02
147+
# Enable RFC-recommended source validation feature.
148+
# If the return packet does not go out the same interface that the corresponding
149+
# source packet came from, the packet is dropped (and logged if log_martians is set).
150+
# | sysctl-02
144151
net.ipv4.conf.all.rp_filter: 1
145152
net.ipv4.conf.default.rp_filter: 1
146153

147154
# Reduce the surface on SMURF attacks. | sysctl-04
148155
# Make sure to ignore ECHO broadcasts, which are only required in broad network analysis.
149156
net.ipv4.icmp_echo_ignore_broadcasts: 1
150157

151-
# There is no reason to accept bogus error responses from ICMP, so ignore them instead. | sysctl-03
158+
# Some routers (and some attackers) will send responses that violate RFC-1122 and attempt
159+
# to fill up a log file system with many useless error messages.
160+
# | sysctl-03
152161
net.ipv4.icmp_ignore_bogus_error_responses: 1
153162

154163
# Limit the amount of traffic the system uses for ICMP. | sysctl-05
@@ -158,7 +167,7 @@ sysctl_config:
158167
# source quench, ime exceed, param problem, timestamp reply, information reply | sysctl-06
159168
net.ipv4.icmp_ratemask: 88089
160169

161-
# Protect against wrapping sequence numbers at gigabit speeds | sysctl-07
170+
# Disable TCP timestamps in order to not reveal system uptime. | sysctl-07
162171
net.ipv4.tcp_timestamps: 0
163172

164173
# Define restriction level for announcing the local source IP | sysctl-08
@@ -188,16 +197,30 @@ sysctl_config:
188197
net.ipv4.conf.all.accept_source_route: 0
189198
net.ipv4.conf.default.accept_source_route: 0
190199

191-
# For non-routers: don't send redirects, these settings are 0 | sysctl-16
200+
# For non-routers: don't send redirects.
201+
# An attacker could use a compromised host to send invalid ICMP redirects to other
202+
# router devices in an attempt to corrupt routing and have users access a system
203+
# set up by the attacker as opposed to a valid system.
204+
# | sysctl-16
192205
net.ipv4.conf.all.send_redirects: 0
193206
net.ipv4.conf.default.send_redirects: 0
194207

195-
# log martian packets | sysctl-17
208+
# log martian packets
209+
# This feature logs packets with un-routable source addresses to the kernel log.
210+
# Enabling this feature and logging these packets allows an administrator to investigate
211+
# the possibility that an attacker is sending spoofed packets to their system.
212+
# | sysctl-17
196213
net.ipv4.conf.all.log_martians: 1
197214
net.ipv4.conf.default.log_martians: 1
198215

199216
# Accepting redirects can lead to malicious networking behavior, so disable
200-
# it if not needed. | sysctl-13 | sysctl-14 | sysctl-15 | sysctl-20
217+
# it if not needed.
218+
# Attackers could use bogus ICMP redirect messages to maliciously alter the system
219+
# routing tables and get them to send packets to incorrect networks and allow
220+
# your system packets to be captured.
221+
# Setting net.ipv4.conf.all.secure_redirects to 0 protects the system from
222+
# routing table updates by possibly compromised known gateways.
223+
# | sysctl-13 | sysctl-14 | sysctl-15 | sysctl-20
201224
net.ipv4.conf.default.accept_redirects: 0
202225
net.ipv4.conf.all.accept_redirects: 0
203226
net.ipv4.conf.all.secure_redirects: 0
@@ -208,9 +231,6 @@ sysctl_config:
208231
# Disable IPv6 | sysctl-18
209232
net.ipv6.conf.all.disable_ipv6: 1
210233

211-
# Disable IPv6 traffic forwarding. | sysctl-19
212-
net.ipv6.conf.all.forwarding: 0
213-
214234
# ignore RAs on Ipv6. | sysctl-25
215235
net.ipv6.conf.all.accept_ra: 0
216236
net.ipv6.conf.default.accept_ra: 0

0 commit comments

Comments
 (0)