Skip to content

Instantly share code, notes, and snippets.

@AndrewWCarson
Last active April 25, 2019 18:11
Show Gist options
  • Save AndrewWCarson/0025d862725dd223e7efd0e533f60bf9 to your computer and use it in GitHub Desktop.
Save AndrewWCarson/0025d862725dd223e7efd0e533f60bf9 to your computer and use it in GitHub Desktop.
Snippet for checking kernel extension whitelisting.
KEXT_TEAM_ID="ABCDEFG"
majorVersion=$(sw_vers -productVersion | awk -F. '{print $2}')
minorVersion=$(sw_vers -productVersion | awk -F. '{print $3}')
echo "Major macOS version: $majorVersion"
echo "Minor macOS version: $minorVersion"
if (( majorVersion > 13 )) || (( majorVersion == 13 && minorVersion > 2 )); then
if ! /usr/bin/sqlite3 /var/db/SystemPolicyConfiguration/KextPolicy "SELECT team_id FROM kext_policy_mdm;" | /usr/bin/grep "$KEXT_TEAM_ID"; then
echo 'Kernel extension not whitelisted.'
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment