Verify permissions of log files
An XCCDF Rule
Description
Any operating system providing too much information in error messages risks compromising the data and security of the structure, and content of error messages needs to be carefully considered by the organization. Organizations carefully consider the structure/content of error messages. The extent to which information systems are able to identify and handle error conditions is guided by organizational policy and operational requirements. Information that could be exploited by adversaries includes, for example, erroneous logon attempts with passwords entered by mistake as the username, mission/business information that can be derived from (if not stated explicitly by) information recorded, and personal information, such as account numbers, social security numbers, and credit card numbers.
Rationale
The Ubuntu 22.04 must generate error messages that provide information necessary for corrective actions without revealing information that could be exploited by adversaries.
- ID
- xccdf_org.ssgproject.content_rule_permissions_local_var_log
- Severity
- Medium
- References
- Updated
Remediation - Ansible
- name: Find /var/log/ file(s) recursively
command: find -H /var/log/ -perm /u+xs,g+xws,o+xwrt ! -name "history.log" ! -name
"eipp.log.xz" ! -name "*[bw]tmp" ! -name "*lastlog" -type f -regex ".*"
register: files_found
changed_when: false
failed_when: false
Remediation - Shell Script
find -H /var/log/ -perm /u+xs,g+xws,o+xwrt ! -name 'history.log' ! -name 'eipp.log.xz' ! -name '*[bw]tmp' ! -name '*lastlog' -type f -regex '.*' -exec chmod u-xs,g-xws,o-xwrt {} \;