mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-02-03 05:53:24 +00:00
os_install_log_retention_configure #208
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 @cipineda on GitHub.
Summary
When running the aslmanager binary the code used to detect if ttl = 365 is returning "TTL not configured" when it fact it is configured.
Steps to reproduce
Run the command
/usr/sbin/aslmanager -dd 2>&1 | /usr/bin/awk '/\/var\/log\/install.log/ {count++} /Processing module com.apple.install/,/Finished/'This returns the following on my test machine:
Dec 1 08:14:49: Processing module com.apple.install Dec 1 08:14:49: Checking file /var/log/install.log Dec 1 08:14:49: - Rename, move to destination directory, and compress as required Dec 1 08:14:49: ignore src file install.log since it is internal and syslogd will checkpoint it when it needs to be renamed Dec 1 08:14:49: no src files Dec 1 08:14:49: - Check for expired files - TTL = 365 days Dec 1 08:14:49: no dst files Dec 1 08:14:49: Finished processing module com.apple.installAs you can see the TTL is set to 365 (which means that is remediated).
Looking at the contents of file
/etc/asl/com.apple.installreturns the following:
`# install messages get saved only in /var/log/install.log
? [= Facility install] claim only
Running your existing code returns in "TTL not configured"
`result_value=$(/usr/sbin/aslmanager -dd 2>&1 | /usr/bin/awk '//var/log/install.log/ {count++} /Processing module com.apple.install/,/Finished/ { for (i=1;i<=NR;i++) { if ($i == "TTL" && $(i+2) >= 365) { ttl="True" }; if ($i == "MAX") {max="True"}} } END{if (count > 1) { print "Multiple config files for /var/log/install, manually remove"} else if (ttl != "True") { print "TTL not configured"} else if (max == "True") { print "Max Size is configured, must be removed" } else { print "Yes" }}')
if ; then
echo "$(date -u)" " Compliance os_install_log_retention_configure: FAILED"
fi
echo $result_value`
Operating System version
ProductName: macOS
ProductVersion: 13.0.1
BuildVersion: 22A400
Tested also on
ProductName: macOS
ProductVersion: 13.1
BuildVersion: 22C5050e
Intel or Apple Silicon
Intel and Silicon
What is the current bug behavior?
(What actually happens)
The validation script should return a "Yes"
(What you should see instead)
The validation script returns "TTL not configured"
Output of checks
shown above in steps to reproduce section
Possible fixes
@jmahlman commented on GitHub:
Are you running the command with sudo?
@cipineda commented on GitHub:
my bad, it works with root, I guess I got confused as I thought I had seen this as well in the EA in JAMF.
Closing this ticket.