From 0d32f4c1b02214634ff64e3cc28dbc03af3deb24 Mon Sep 17 00:00:00 2001 From: Haoji_Zhang Date: Wed, 26 Apr 2023 13:40:30 +0000 Subject: [PATCH] add benchmarks/system-configurations/4.71-ensure-nosuid-option-set-on-var-partition-Automated. Signed-off-by: Haoji_Zhang --- ...suid-option-set-on-var-partition-Automated | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 benchmarks/system-configurations/4.71-ensure-nosuid-option-set-on-var-partition-Automated diff --git a/benchmarks/system-configurations/4.71-ensure-nosuid-option-set-on-var-partition-Automated b/benchmarks/system-configurations/4.71-ensure-nosuid-option-set-on-var-partition-Automated new file mode 100644 index 0000000..1acd575 --- /dev/null +++ b/benchmarks/system-configurations/4.71-ensure-nosuid-option-set-on-var-partition-Automated @@ -0,0 +1,59 @@ +# 1.1.3.3 确保/var分区上设置nosuid选项 + +## 安全等级 + +- Level 1 + +## 描述 + +`nosuid`加载选项的让指定文件系统不包含`setuid`文件。 + +## 修复建议 + +目标:编辑`/etc/fstab`文件,在`/var`分区的第四个字段(加载选项)中添加`nosuid`。 + +1. 使用root权限打开`/etc/fstab`文件 + + `sudo nano /etc/fstab` + +2. 找到需要添加nosuid选项的文件系统所对应的那一步,通常包含设备、挂载点、文件系统类型和挂载选项等信息。 + +3. 在该行的挂载选项字符段中添加`nosuid`选项,用访问号隔开其他选项。 + + `/dev/sda1 /var ext4 defaults,rw,nosuid 0 2` + + 注意,如果字符段已经有其他选项,也需要用访问号屏蔽。 + +4. 保存并关闭文件。 + +5. 运行以下命令以使用配置的选项重新挂载 /var: + + `# mount -o remount /var` + +## 扫描检测 + +验证是否为 `/var` 安装设置了 `nosuid` 选项。 + +1. 使用以下命令来验证 `/var` 是否已经安装了 `nosuid` 选项: + + ```shell + # mount | grep '/var.*nosuid' + /var nosuid + ``` + + 如果输出中包含了 `/var` 并且有 `nosuid` 字段,则表示已经为 `/var` 挂载设置了 `nosuid` 选项。 + +2. 还可以使用以下命令来检查 `/etc/fstab` 文件是否包含了 `nosuid` 选项: + + ```shell + # grep '/var' /etc/fstab | grep -o nosuid + nosuid + ``` + + 如果输出中有 `nosuid` 字段,则表示已经为 /var 挂载设置了 `nosuid` 选项。 + + + +## 参考 + +- cis: [https://www.cisecurity.org/benchmark/aliyun_linux](https://gitee.com/link?target=https%3A%2F%2Fwww.cisecurity.org%2Fbenchmark%2Faliyun_linux) \ No newline at end of file -- Gitee