TMA-FREEBSD-4.5.2.2
Ensure root user umask is configured
Description
The user file-creation mode mask (umask) is used to determine the file permission for newly created directories and files. In FreeBSD, the default permissions for any newly created directory is 0755 (rwxr-xr-x), and for any newly created file it is 0644 (rw-r-- r--). The umask modifies the default FreeBSD permissions by restricting (masking) these permissions. Audit: automated read-only check derived from the CIS audit procedure; it prints "compliant" when the control is met.
How it is checked
Audit method: Shell command
command -v grep >/dev/null 2>&1 || exit 1; out=$( { grep -Esi -- "^[[:space:]]*umask[[:space:]]+(([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)|(u=[rwx]{1,3},)?(((g=[rx]?[rx]?w[rx]?[rx]?\b)(,o=[rwx]{1,3})?)|((g=[wrx]{1,3},)?o=[wrx]{1,3}\b)))" /root/.profile /root/.shrc ; } 2>/dev/null ); [ -z "$out" ] && echo compliant || printf '%s\n' "$out" | head -n 20- Expected output
compliant
How it is fixed
Fix method: Guidance or infrastructure patch
Edit /root/.profile and /root/.shrc and remove, comment out, or update any line with umask to be 0027 or more restrictive.
Properties
- Operating systems
- Any
- Tags
- freebsdaccounts
- Reference
- CIS FreeBSD 14 Benchmark v1.0.1 - 4.5.2.2 Ensure root user umask is configured
Check this host
Run this on a machine you are allowed to audit. The scan is read-only.
tmaegis scan --target freebsd