Easy to read, non one-liner, version of all the audit
and fix
commands used by mOSL.
Checks if user default com.apple.SoftwareUpdate.plist
is set to AutomaticallyInstallMacOSUpdates
.
if ! defaults read "/Library/Preferences/com.apple.SoftwareUpdate.plist" "AutomaticallyInstallMacOSUpdates" >/dev/null 2>&1; then
exit 1
# This key isnt present if the user has not manually interacted with System Preferences > Software Update before
fi
defaults read "/Library/Preferences/com.apple.SoftwareUpdate.plist" "AutomaticallyInstallMacOSUpdates" | grep -q "1"
declare -a keys
keys=(AutomaticCheckEnabled AutomaticDownload AutomaticallyInstallMacOSUpdates ConfigDataInstall CriticalUpdateInstall)
for key in "${keys[@]}"; do
defaults write "/Library/Preferences/com.apple.SoftwareUpdate.plist" "${key}" -bool true
done
if ! defaults read "/Library/Preferences/com.apple.commerce.plist" "AutoUpdate" >/dev/null 2>&1; then
exit 1
fi
defaults read "/Library/Preferences/com.apple.commerce.plist" "AutoUpdate" >/dev/null 2>&1 | grep -q '0';
defaults write "/Library/Preferences/com.apple.commerce.plist" "AutoUpdate" -bool true
Checks if the output of spctl --status
contains assessments enabled
.
spctl --status | grep -q "assessments enabled"
sudo spctl --master-enable
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate | grep -q 'enabled'
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
security -q authorizationdb read system.preferences | grep -A1 'shared' | grep -q 'false'
security -q authorizationdb read system.preferences > /tmp/system.preferences.plist
/usr/libexec/PlistBuddy -c 'Set :shared false' /tmp/system.preferences.plist
sudo security -q authorizationdb write system.preferences < /tmp/system.preferences.plist
rm '/tmp/system.preferences.plist'
defaults read com.apple.Terminal SecureKeyboardEntry | grep -q '1'
defaults write com.apple.Terminal SecureKeyboardEntry -bool true
csrutil status | grep -q 'enabled'
sudo csrutil clear
fdesetup status | grep -q 'On'
sudo fdesetup enable -user $USER > $HOME/FileVault_recovery_key.txt
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getallowsigned | grep 'built-in' | grep -q 'DISABLED'
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setallowsigned off
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getallowsigned | grep 'downloaded' | grep -q 'DISABLED'
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setallowsignedapp off
Lists all network devices via networksetup -listallnetworkservices
($i
) then calls networksetup -getinfo
on each device ($i
) which lists the DHCP configuration of each device.
while IFS= read -r i; do
if ! networksetup -getinfo "${i}" | grep "IPv6: Off"; then
exit 1
fi
done <<< $(networksetup -listallnetworkservices | tail -n $(( $(networksetup -listallnetworkservices | wc -l) - 1 )))
while read -r i; do
sudo networksetup -setv6off "${i}"
done <<< "$(networksetup -listallnetworkservices | tail -n $(( $(networksetup -listallnetworkservices | wc -l) - 1 )))"
defaults read com.apple.mail-shared DisableURLLoading | grep -q '1'
defaults write com.apple.mail-shared DisableURLLoading -bool true
sudo systemsetup -getremoteappleevents | grep -q 'Remote Apple Events: Off'
sudo systemsetup -setremoteappleevents off
sudo systemsetup -getremotelogin | grep -q 'Remote Login: Off'
sudo systemsetup -f -setremotelogin off
defaults read com.apple.Safari AutoOpenSafeDownloads | grep -q '0'
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
if defaults read com.apple.sharingd DiscoverableMode | grep -q 'Contacts Only'; then
exit 0
elif defaults read com.apple.sharingd DiscoverableMode | grep -q 'Off'; then
exit 0
else
exit 1
fi
defaults write com.apple.sharingd DiscoverableMode -string 'Contacts Only'
sudo killall -HUP sharingd
defaults read com.apple.SoftwareUpdate ScheduleFrequency | grep -q '1'
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
sudo firmwarepasswd -check | grep -q 'Yes'
sudo firmwarepasswd -setpasswd
spctl kext-consent status | grep -q 'ENABLED'
n/a
/usr/libexec/firmwarecheckers/eficheck/eficheck --integrity-check
n/a
groups | grep -qv 'admin'
n/a