Ensure the Default C Shell Umask is Set Correctly
An XCCDF Rule
Description
To ensure the default umask for users of the C shell is set properly, add or correct theumask
setting in /etc/csh.cshrc
to read as follows:
umask
Rationale
The umask value influences the permissions assigned to files when they are created. A misconfigured umask value could result in files with excessive permissions that can be read or written to by unauthorized users.
- ID
- xccdf_org.ssgproject.content_rule_accounts_umask_etc_csh_cshrc
- Severity
- Medium
- References
- Updated
Remediation Templates
An Ansible Snippet
- name: XCCDF Value var_accounts_user_umask # promote to variable
set_fact:
var_accounts_user_umask: !!str <xccdf-1.2:sub xmlns:xccdf-1.2="http://checklists.nist.gov/xccdf/1.2" idref="xccdf_org.ssgproject.content_value_var_accounts_user_umask" use="legacy"/>
tags:
- always
- name: Check if umask in /etc/csh.cshrc is already set
A Shell Script
var_accounts_user_umask='<xccdf-1.2:sub xmlns:xccdf-1.2="http://checklists.nist.gov/xccdf/1.2" idref="xccdf_org.ssgproject.content_value_var_accounts_user_umask" use="legacy"/>'
grep -q "^\s*umask" /etc/csh.cshrc && \
sed -i -E -e "s/^(\s*umask).*/\1 $var_accounts_user_umask/g" /etc/csh.cshrc
if ! [ $? -eq 0 ]; then