Skip to content

Commit 4f4c955

Browse files
Fix bootstrap token check and secure token status guard logic
- Fix bootstrap token escrow check to actually execute the command instead of echoing a literal string - Populate SECURE_TOKEN_STATUS variable so disabled/unknown user guards work correctly
1 parent dae2527 commit 4f4c955

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

macOS/Config/Bootstrap Token/fixBootstrapToken.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function print_status {
4141
}
4242

4343
# Check if the boostrap token was ever escrowed. If not, stop early as success.
44-
if echo "profiles status -type bootstraptoken" | grep -q "Bootstrap Token escrowed to server: NO"; then
44+
if profiles status -type bootstraptoken 2>&1 | grep -q "Bootstrap Token escrowed to server: NO"; then
4545
exit 0
4646
fi
4747

@@ -50,6 +50,9 @@ if cat "$logdir/checkBootstrapEscrow.log" | grep -q "Bootstrap Token validated."
5050
exit 0
5151
fi
5252

53+
# Check secure token status for the admin account
54+
SECURE_TOKEN_STATUS=$(sysadminctl -secureTokenStatus "$ADMIN_USERNAME" 2>&1)
55+
5356
# Fail early if the account provided does not have secure token enabled
5457
if echo "$SECURE_TOKEN_STATUS" | grep -q "Secure token is DISABLED"; then
5558
echo "$(date) | Secure token is disabled for $ADMIN_USERNAME. Not proceeding."

0 commit comments

Comments
 (0)