in lib/ec2macosinit/usermanagement.go [47:58]
func (c *UserManagementModule) isSecureTokenSet() (enabled bool, err error) {
// Fetch the text from the built-in tool sysadminctl
statusText, err := executeCommand([]string{"/usr/sbin/sysadminctl", "-secureTokenStatus", c.User}, "", []string{})
if err != nil {
return false, fmt.Errorf("ec2macosinit: unable to get Secure Token status for %s: %s", c.User, err)
}
// If the text has "ENABLED" then return true, otherwise return false
if strings.Contains(statusText.stdout, "Secure token is ENABLED") {
return true, nil
}
return false, nil
}