mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-02-03 05:53:24 +00:00
os_asl_log_files_*_configure are completely broken #120
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nihil-admirari on GitHub.
Originally assigned to: @brodjieski on GitHub.
os_asl_log_files_owner_group_configureandos_asl_log_files_permissions_configureboth use the following code to collect the names of log files:According to man asl.conf:
>configure output options for files or directories to be referenced later by query rules.os_asl_log_files_permissions_configuresets 640 regardless, making directories non-listable.fileanddirectory(store_diris used de facto even though it is not mentioned in theman) configured inline. Above code completely ignores files configured inline.root:adminby default, but can be configured directly within configuration files by settinguid=0 gid=0, and similar for permissionsmode=0640(ormode 0750for directories). Provided fixes do not modify configuration files themselves, which means that newly created log files won't have correct group and mode set.man asl.confthere is an additional parameterroot:admin(0:80). I've no idea whether it should be hardened toroot:wheel.Examples
On my machine (Sonoma 14.2.1):
produces
are directories and should have 750 permissions, not 640.
/etc/asl.confhas? [= Facility com.apple.alf.logging] file appfirewall.log file_max=5M all_max=50M, butappfirewall.logis not mentioned in the output at all./etc/asl/com.apple.MessageTracerhas* store_dir /var/log/DiagnosticMessaged ttl=30, which is also missed.There are other missing log files beyond these two.
system.logwas mentioned in/etc/asl.conf, which means it's actually/var/log/system.logon disc.cdscheduler.logwas mentioned in/etc/asl/com.apple.cdscheduler, which means it's actually/var/log//module/com.apple.cdscheduler/cdscheduler.logon disc./var/log/asl/Logs/aslmanagerhasstyle=lcl-band is actually stored as/var/log/asl/Logs/aslmanager.%Y%m%dT%H%M%S%zon disc.statdoesn't glob potential suffixes:Suggestions for filesystem checks
Log filenames collection:
Checking for ownership.
Notes:
awk 'END { print NR }'doesn't requirexargsto remove spaces compared towc -l.Fixing ownership:
Checking for permissions:
Fixing permissions:
Suggestions for configuration file checks
All code below assumes that:
file,directory, orstore_diris actually possible.uid=0 gid=0 mode=0640to the very end is correct and actually affects thefilein question (rather than breaking the configuration file completely).>then a reference to it from?or*doesn't need to be configured again (unless inline overrides foruid,gidormodeare present).Checking
uidandgidin configuration files:Fixing
uidandgidin configuration files:Checking
modein configuration files (cannot really know whether the file is a directory, assumes that directory already have execute permissions set):Fixing
modein configuration files:Changes these configuration file fixes make can be inspected by running: