Tif*_*ker 8 security linux kernel
我已经看到提到保护 /dev/shm 和 /proc ,我想知道你是如何做到这一点的,它包括做什么?我认为这涉及某种权利的 /etc/sysctl.conf 编辑。
像这些?
kernel.exec-shield = 1
kernel.randomize_va_space = 1
Run Code Online (Sandbox Code Playgroud)
eww*_*ite 11
我使用的过程基于CIS Linux 安全基准,是修改/etc/fstab
以限制设备创建、执行和/dev/shm
挂载上的 suid 权限。
shmfs /dev/shm tmpfs nodev,nosuid,noexec 0 0
Run Code Online (Sandbox Code Playgroud)
对于 sysctl 设置,只需添加其中一些即可/etc/sysctl.conf
。运行sysctl -p
激活。
# CIS benchmarks
fs.suid_dumpable = 0
kernel.exec-shield = 1
kernel.randomize_va_space = 2
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
Run Code Online (Sandbox Code Playgroud)
ewwhite 已经提到了 CIS Linux 安全基准的建议,我还想添加另一个值得一提的安全指南 - NSA对 Red Hat Enterprise Linux 5的安全配置指南。除了nodev,nosuid,noexec
为 /dev/shm添加选项外,第 2.5.1 节中提到了对影响网络的内核参数的建议 -
仅限主机
net.ipv4.ip forward = 0
net.ipv4.conf.all.send redirects = 0
net.ipv4.conf.default.send redirects = 0
Run Code Online (Sandbox Code Playgroud)
主机和路由器
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_messages = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
Run Code Online (Sandbox Code Playgroud)