Skip to content

Instantly share code, notes, and snippets.

@kitzy
Created June 20, 2015 01:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitzy/ea76a02d09cc93e95c7a to your computer and use it in GitHub Desktop.
Save kitzy/ea76a02d09cc93e95c7a to your computer and use it in GitHub Desktop.
This script will call a policy from the JSS to issue a new recovery key if it detects that the recovery key has been used to log in.
#!/bin/bash
# Automatic FV2 Individual Recovery Key re-issue script
# written by John Kitzmiller - www.johnkitzmiller.com
#
# This script will call a policy from the JSS to issue a new recovery key
# if it detects that the recovery key has been used to log in
#
### Functions ###
function jssCheck()
{
# Checking to make sure the JSS is available before proceeding
jamf checkJSSConnection -retry 0
until [ $? = 0 ]
do
sleep 5
jamf checkJSSConnection -retry 0
done
}
## Main Program ###
# Check to see if recovery key was used to log in
recoveryKeyUsed=$(fdesetup usingrecoverykey)
if [ "${recoveryKeyUsed}" == "true" ]
then
jssCheck
# Call JSS policy to issue new recovery key
jamf policy -event issueNewRecoveryKey
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment