Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 45 lines (34 sloc) 1.18 KB
#!/usr/bin/env python
Jamf Pro extension attribute to return a list of login authorization mechanisms
used in macOS login window authentication process.
Useful for reporting on authorization database modifications like when using
NoMAD Login/Jamf Connect.
import subprocess
import plistlib
def get_login_authdb(format="string"):
"""Gets the specified authorization right from plist format."""
cmd = ["/usr/bin/security", "authorizationdb", "read", "system.login.console"]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, _ = proc.communicate()
if stdout:
return plistlib.readPlistFromString(stdout)
except (IOError, OSError):
def main():
# Get list of authorization mechanisms
authdb = get_login_authdb()
authdb_mechs = authdb["mechanisms"]
# Loop through mechs and format for EA. None if mech list is empty
if authdb_mechs:
results = "\n".join(authdb_mechs)
results = None
except (TypeError, KeyError):
results = None
print("<result>%s</result>" % results)
if __name__ == "__main__":
You can’t perform that action at this time.