documentation_complete: true


title: 'Verify permissions of log files'

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 {{{ full_name }}} must generate error messages that provide information
    necessary for corrective actions without revealing information that could
    be exploited by adversaries.

severity: medium

ocil_clause: 'not all log files have permission 640 or stricter'

ocil: |-
    Verify the operating system has all system log files except
    [bw]tmp ad lastlog under the <pre>/var/log</pre> directory
    with a permission set to 640, by using the following command:
    <pre>
    sudo find /var/log -perm /137 -type f ! -name '*[bw]tmp' ! -name '*lastlog' -exec stat -c "%n %a" {} \;
    </pre>

template:
    name: file_permissions
    vars:
        excluded_files@ubuntu2404: ['[bw]tmp', '[bw]tmp.*', '[bw]tmp-*', 'lastlog', 'lastlog.*']
        file_regex: '.*'
        filemode: '0640'
        filepath: /var/log/
        recursive@ubuntu2404: 'true'
