Skip to content

Commit eef2d8a

Browse files
authored
Merge pull request #244 from microsoft/fix-bootstrap-token-guards
Fix bootstrap token check and secure token status guard logic
2 parents fb88cf0 + 4f4c955 commit eef2d8a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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)