Background
I'm trying to glean a better understanding of the OS X login process, in order to decide the best way for achieving VPN Single Sign On.
Please do correct me if I'm wrong, but I believe that—
launchd(8)
callsgettyent(3)
and thus determines fromttys(5)
to executeloginwindow.app
for/dev/console
.loginwindow.app
attempts to acquire thesystem.login.console
authorization right, for which the authorization database specifies the following mechanisms (listed together with my understanding of their function); those that are privileged run within theauthd
process (as root), whilst those that are not privileged run within theSecurityAgent
process (as _securityagent):builtin:policy-banner
(displays Login Window banner, if set).loginwindow:login
(prompts for credentials).builtin:login-begin
builtin:reset-password,privileged
(performs password reset using Apple ID).builtin:forward-login,privileged
(forwards credentials from EFI on boot).builtin:auto-login,privileged
(applies auto-login credentials on boot).builtin:authenticate,privileged
(invokespam_authenticate(3)
forauthorization
service; sets "uid" context value).PKINITMechanism:auth,privileged
(initialises Kerberos by obtaining a TGT).builtin:login-success
loginwindow:success
(secures the login session from unauthorized remote access; records the login in the system’s utmp and utmpx databases; sets the owner and permissions for the console terminal).HomeDirMechanism:login,privileged
(mounts the user's home directory).HomeDirMechanism:status
(displays progress of home directory mounting).MCXMechanism:login
(applies configuration profiles).loginwindow:done
(resets the user’s preferences to include global system defaults; configures the mouse, keyboard, and system sound using the user’s preferences; sets the user’s group permissions; retrieves the user record from Directory Services and applies that information to the session; loads the user’s computing environment—including preferences, environment variables, device and file permissions, keychain access, and so on; launches the Dock, Finder, and SystemUIServer; launches the login items for the user).
Questions
I would very much like to confirm my understanding of each mechanism's function:
Is their source code available openly? I know that the non-
builtin
mechanisms are defined by plugins that can be found under/System/Library/CoreServices/SecurityAgentPlugins
, but I cannot find the source from which they were built. Nor can I find where thebuiltin
mechanisms are defined.If the source is not available, are the mechanisms documented anywhere?
Observations
How can
loginwindow:login
prompt for credentials if it is invoked beforebuiltin:forward-login
andbuiltin:auto-login
, either of which cause the GUI to be bypassed? Does it inspect the context for such credentials and skip itself if they are present? Seems strange.Furthermore, as described in Apple's 802.1X Authentication technical white paper:
When Login Window Mode is configured and a user types in an user name and password at the login window, two things will happen. First, the login window will authenticate the computer via 802.1X to the network using the user name and password the user entered. After the 802.1X authentication is successful, login window will authenticate the same user name and password to the external directory.
Since the second stage of that authentication is handled by the
pam_opendirectory.so
module and is dependent on the network being present, the first stage (authenticating via 802.1X to the network) must necessarily occur prior to that. That is, it must occur before thebuiltin:authenticate
mechanism.From a casual inspection of the
loginwindow
plugin binary, it seems that it handles such 802.1X authentication—but the only mechanism invoked within that plugin prior tobuiltin:authenticate
isloginwindow:login
. Am I correct in thinking that this mechanism not only displays the login prompt, but then also attempts 802.1X authentication? (If so, that not only seems a little sloppy IMHO but also suggests that credentials from EFI/auto-login cannot be used for 802.1X login window authentication.)