使用 Lubuntu 18.10 宇宙墨鱼
大多数命令都会坚持下去。然而,Lynis 多次证明了四个 sysctl 参数在重新启动时不会保留。sysctl -p 在系统启动后成功应用它们。
fs.suid_dumpable=0 (still haven't figured this out)
net.ipv4.conf.all.rp_filter=1 (Wireguard VPN overruled this; see source 1 below)
net.ipv4.conf.all.log_martians=1 (/etc/ufw/sysctl.conf overruled this)
net.ipv4.conf.default.log_martians=1 (/etc/ufw/sysctl.conf overruled this)
Run Code Online (Sandbox Code Playgroud)
我最关心的是net.ipv4.conf.all.rp_filter
,它应该设置为 1,但设置为 0...使机器容易受到 ip 欺骗。如何确保这些在启动时设置正确?注意更新:此功能会被 Wireguard(可能是 openvpn/其他)等 VPN 自动禁用,因此不会丢弃合法数据包,有关详细信息,请参阅上面的源代码。禁用 Wireguard VPN sysctl boot 命令会导致 fp_filter=1 按预期工作,可能会导致 Wireguard 出现问题。Lynis 误报,我将禁用此功能。警告在启动后禁用 Wireguard 不会(到目前为止)将其恢复到安全设置。sysctl -p
必需的。
所有 sysctl.conf 文件的位置find / -name '*sysctl*.conf'
/usr/share/doc/procps/examples/sysctl.conf
/snap/core/6405/etc/sysctl.conf
/snap/core/6405/etc/sysctl.d/99-sysctl.conf
/snap/core18/719/etc/sysctl.d/99-sysctl.conf
/etc/sysctl.conf
/etc/ufw/sysctl.conf
/etc/sysctl.d/99-sysctl.conf
Run Code Online (Sandbox Code Playgroud)