SELinux and PAM
With all the information about SELinux users and roles, we have not touched upon how exactly applications or services create and assign an SELinux context to a user. As mentioned earlier on, this is coordinated through the use of Linux's PAM services.
Assigning contexts through PAM
End users log in to a Linux system through either a login process (triggered through a getty
process), a networked service (for example, the OpenSSH daemon), or through a graphical login manager (xdm
, kdm
, gdm
, slim
, and so on).
These services are responsible for switching our effective user ID (upon successful authentication, of course) so that we are not active on the system as the root
user. For SELinux systems, these processes also need to switch the SELinux user (and role) accordingly, as otherwise, the context will be inherited from the service, which is obviously wrong for any interactive session.
In theory, all these applications can be made fully SELinux aware, linking...