https://github.com/SSSD/sssd
https://sssd.io/contrib/building-sssd.html
Arch
Simply put, the main SSSD purpose is to store data from the remote database in a local cache and then serve this data to the target user (application). Keeping the cache up to date and valid is a difficult task and to do that SSSD consists of multiple components (processes and libraries) that talk to each other through various inter-process communication techniques. The following diagram gives you a basic understanding about the components and their relations. The components are described in more detail below the diagram.
Simply put
The System Security Services Daemon (SSSD) is a software package that provides a set of daemons to manage access to remote directories and authentication mechanisms. It is commonly used on Linux systems to authenticate users against remote directories such as LDAP or Active Directory. SSSD also provides caching and offline authentication capabilities to improve performance and reliability. Overall, SSSD is an important component of system security on Linux systems.
说明
System Security Services Daemon(简称SSSD)是一种用于Linux和Unix系统的系统服务,它提供了身份验证、身份管理和访问控制等安全功能,可以将多个身份源(如本地LDAP、Active Directory等)整合到一个单一的身份信息库中,简化系统管理员的身份管理任务。
SSSD的主要功能包括:
身份验证:SSSD可用于本地用户和密码的验证,也可以将外部身份源(如LDAP、Kerberos、Active Directory等)整合并进行验证。
身份管理:SSSD提供了用户和组的管理功能,可以从多个身份源中集中管理用户和组信息,同时支持动态组成员身份管理。
访问控制:SSSD可以对用户或组进行访问控制,防止未授权用户访问敏感数据。
缓存管理:SSSD会缓存身份验证和授权信息,以提高系统性能。
PLUGGABLE-AUTHENTICATION-MODULES(PAM):SSSD支持PAM,可以使用PAM模块集成到许多应用程序中。
SSSD的配置文件位于/etc/sssd/sssd.conf,管理员可在此文件中配置SSSD的参数。
大致实现过程
SSSD 是一个守护进程,一般在启动时被 systemd 自动启动。在启动时,SSSD 会创建一个监听器,它会监听来自 PAM 和 NSS 的请求。
当用户进行身份认证时,PAM(Pluggable Authentication Module,可插入身份认证模块)将会向 SSSD 发送请求,并等待 SSSD 的处理结果。SSSD 接收到请求后,会查找本地缓存并尝试从远端身份认证资源(如 LDAP)中获取用户的身份认证信息,如用户名、密码等。
如果 SSSD 找到了符合条件的用户信息,它会将该信息写入到本地用户缓存中,并将认证结果返回给 PAM。PAM 最终会将认证结果返回给应用程序。
当应用程序需要访问用户身份信息时,会向 NSS (Name Service Switch) 发送请求。NSS 会将请求转发给 SSSD,并等待 SSSD 的响应。
SSSD 接受到 NSS 的请求后,会查找本地缓存并尝试从远端身份认证资源(如 LDAP)中获取用户的身份信息,比如用户ID、组ID 等。
如果 SSSD 找到了符合条件的用户信息,它会将该信息写入到本地缓存中,并将查询结果返回给 NSS。NSS 最终会将查询结果返回给应用程序。
需要注意的是,SSSD 的实现过程可能因不同的身份认证方案、工具链和系统环境而有所不同。以上是一个大致的过程,其实际实现细节可以在 SSSD 源码中查看。