Verify ownership of log files (ubuntu2404)
이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다.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 24.04 must generate error messages that provide information
necessary for corrective actions without revealing information that could
be exploited by adversaries.
Shell script
The following script can be run on the host to remediate the issue.
#!/bin/bash
# default to root
group="root"
# see https://workbench.cisecurity.org/benchmarks/18959/tickets/23964
# regarding sssd and gdm exclusions
find -L /var/log/ -type f -regextype posix-extended \
! -group root ! -group adm \
! -name 'gdm' ! -name 'gdm3' \
! -name 'sssd' ! -name 'SSSD' \
! -name 'auth.log' \
! -name 'messages' \
! -name 'syslog' \
! -path '/var/log/apt/*' \
! -path '/var/log/gdm/*' \
! -path '/var/log/gdm3/*' \
! -path '/var/log/sssd/*' \
! -path '/var/log/[bw]tmp*' \
! -path '/var/log/cloud-init.log*' \
! -regex '.*\.journal[~]?' \
! -regex '.*/lastlog(\.[^\/]+)?$' \
! -regex '.*/localmessages(.*)' \
! -regex '.*/secure(.*)' \
! -regex '.*/waagent.log(.*)' \
-regex '.*' -exec chgrp $group {} \;