Container-Optimized OS
TMA-COS-5.3.4
Ensure default user umask is 027 or more restrictive
說明
The default umask determines the permissions of files created by users. The user creating the file has the discretion of making their files and directories readable by others via the chmod command. Users who wish to allow their files and directories to be readable by others by default may choose a different default umask by inserting the umask command into the standard shell configuration files ( .profile , .bashrc , etc.) in their home directories. Setting a very secure default value for umask ensures that users make a conscious choice about their file permissions. A default umask setting of 077 causes files and directories created by users to not be readable by any other user on the system. A umask of 027 would make files and directories readable by users in the same Unix group, while a umask of 022 would make files readable by every user on the system.
檢查方式
稽核方法: Shell 指令
ok=0; grep -Eiq "^\s*UMASK\s+(0[0-7][2-7]7|[0-7][2-7]7)\b" /etc/login.defs 2>/dev/null && ok=1; grep -REiq "^\s*umask\s+(0[0-7][2-7]7|[0-7][2-7]7)\b" /etc/profile /etc/profile.d /etc/bashrc 2>/dev/null && ok=1; bad=$(grep -RPih "(^|^[^#]*)\s*umask\s+([0-7][0-7][01][0-7]\b|[0-7][0-7][0-7][0-6]\b|[0-7][01][0-7]\b|[0-7][0-7][0-6]\b)" /etc/login.defs /etc/profile /etc/profile.d /etc/bashrc 2>/dev/null); [ $ok -eq 1 ] && [ -z "$bad" ] && echo compliant || echo noncompliant- 預期輸出
compliant
修補方式
修補方法: 操作指南或基礎設施修補檔
Edit the /etc/bash/bashrc, /etc/profile and /etc/profile.d/*.sh files (and the appropriate files for any other shell supported on your system) and add or edit any umask parameters as follows: umask 027
屬性
- 作業系統
- 不限
- 標籤
- container-optimized-oscos
- 參考資料
- CIS Google Container-Optimized OS Benchmark v1.2.0 - 5.3.4 Ensure default user umask is 027 or more restrictive
檢查此主機
請在您有權稽核的機器上執行此指令。掃描為唯讀操作。
tmaegis scan --target cos --level 2