'\" t .\" Title: sssd-sudo .\" Author: The SSSD upstream - https://github.com/SSSD/sssd/ .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 04/11/2023 .\" Manual: File Formats and Conventions .\" Source: SSSD .\" Language: English .\" .TH "SSSD\-SUDO" "5" "04/11/2023" "SSSD" "File Formats and Conventions" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" sssd-sudo \- Configuring sudo with the SSSD back end .SH "DESCRIPTION" .PP This manual page describes how to configure \fBsudo\fR(8) to work with \fBsssd\fR(8) and how SSSD caches sudo rules\&. .SH "CONFIGURING SUDO TO COOPERATE WITH SSSD" .PP To enable SSSD as a source for sudo rules, add \fIsss\fR to the \fIsudoers\fR entry in \fBnsswitch.conf\fR(5)\&. .PP For example, to configure sudo to first lookup rules in the standard \fBsudoers\fR(5) file (which should contain rules that apply to local users) and then in SSSD, the nsswitch\&.conf file should contain the following line: .PP .if n \{\ .RS 4 .\} .nf sudoers: files sss .fi .if n \{\ .RE .\} .PP More information about configuring the sudoers search order from the nsswitch\&.conf file as well as information about the LDAP schema that is used to store sudo rules in the directory can be found in \fBsudoers.ldap\fR(5)\&. .PP \fINote\fR: in order to use netgroups or IPA hostgroups in sudo rules, you also need to correctly set \fBnisdomainname\fR(1) to your NIS domain name (which equals to IPA domain name when using hostgroups)\&. .SH "CONFIGURING SSSD TO FETCH SUDO RULES" .PP All configuration that is needed on SSSD side is to extend the list of \fIservices\fR with "sudo" in [sssd] section of \fBsssd.conf\fR(5)\&. To speed up the LDAP lookups, you can also set search base for sudo rules using \fIldap_sudo_search_base\fR option\&. .PP The following example shows how to configure SSSD to download sudo rules from an LDAP server\&. .PP .if n \{\ .RS 4 .\} .nf [sssd] config_file_version = 2 services = nss, pam, sudo domains = EXAMPLE [domain/EXAMPLE] id_provider = ldap sudo_provider = ldap ldap_uri = ldap://example\&.com ldap_sudo_search_base = ou=sudoers,dc=example,dc=com .fi .if n \{\ .RE .\} .sp It\*(Aqs important to note that on platforms where systemd is supported there\*(Aqs no need to add the "sudo" provider to the list of services, as it became optional\&. However, sssd\-sudo\&.socket must be enabled instead\&. .PP When SSSD is configured to use IPA as the ID provider, the sudo provider is automatically enabled\&. The sudo search base is configured to use the IPA native LDAP tree (cn=sudo,$SUFFIX)\&. If any other search base is defined in sssd\&.conf, this value will be used instead\&. The compat tree (ou=sudoers,$SUFFIX) is no longer required for IPA sudo functionality\&. .SH "THE SUDO RULE CACHING MECHANISM" .PP The biggest challenge, when developing sudo support in SSSD, was to ensure that running sudo with SSSD as the data source provides the same user experience and is as fast as sudo but keeps providing the most current set of rules as possible\&. To satisfy these requirements, SSSD uses three kinds of updates\&. They are referred to as full refresh, smart refresh and rules refresh\&. .PP The \fIsmart refresh\fR periodically downloads rules that are new or were modified after the last update\&. Its primary goal is to keep the database growing by fetching only small increments that do not generate large amounts of network traffic\&. .PP The \fIfull refresh\fR simply deletes all sudo rules stored in the cache and replaces them with all rules that are stored on the server\&. This is used to keep the cache consistent by removing every rule which was deleted from the server\&. However, full refresh may produce a lot of traffic and thus it should be run only occasionally depending on the size and stability of the sudo rules\&. .PP The \fIrules refresh\fR ensures that we do not grant the user more permission than defined\&. It is triggered each time the user runs sudo\&. Rules refresh will find all rules that apply to this user, check their expiration time and redownload them if expired\&. In the case that any of these rules are missing on the server, the SSSD will do an out of band full refresh because more rules (that apply to other users) may have been deleted\&. .PP If enabled, SSSD will store only rules that can be applied to this machine\&. This means rules that contain one of the following values in \fIsudoHost\fR attribute: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} keyword ALL .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} wildcard .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} netgroup (in the form "+netgroup") .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} hostname or fully qualified domain name of this machine .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} one of the IP addresses of this machine .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} one of the IP addresses of the network (in the form "address/mask") .RE .PP There are many configuration options that can be used to adjust the behavior\&. Please refer to "ldap_sudo_*" in \fBsssd-ldap\fR(5) and "sudo_*" in \fBsssd.conf\fR(5)\&. .SH "TUNING THE PERFORMANCE" .PP SSSD uses different kinds of mechanisms with more or less complex LDAP filters to keep the cached sudo rules up to date\&. The default configuration is set to values that should satisfy most of our users, but the following paragraphs contain few tips on how to fine\- tune the configuration to your requirements\&. .PP 1\&. \fIIndex LDAP attributes\fR\&. Make sure that following LDAP attributes are indexed: objectClass, cn, entryUSN or modifyTimestamp\&. .PP 2\&. \fISet ldap_sudo_search_base\fR\&. Set the search base to the container that holds the sudo rules to limit the scope of the lookup\&. .PP 3\&. \fISet full and smart refresh interval\fR\&. If your sudo rules do not change often and you do not require quick update of cached rules on your clients, you may consider increasing the \fIldap_sudo_full_refresh_interval\fR and \fIldap_sudo_smart_refresh_interval\fR\&. You may also consider disabling the smart refresh by setting \fIldap_sudo_smart_refresh_interval = 0\fR\&. .PP 4\&. If you have large number of clients, you may consider increasing the value of \fIldap_sudo_random_offset\fR to distribute the load on the server better\&. .SH "SEE ALSO" .PP \fBsssd\fR(8), \fBsssd.conf\fR(5), \fBsssd-ldap\fR(5), \fBsssd-krb5\fR(5), \fBsssd-simple\fR(5), \fBsssd-ipa\fR(5), \fBsssd-ad\fR(5), \fBsssd-files\fR(5), \fBsssd-sudo\fR(5), \fBsssd-session-recording\fR(5), \fBsss_cache\fR(8), \fBsss_debuglevel\fR(8), \fBsss_obfuscate\fR(8), \fBsss_seed\fR(8), \fBsssd_krb5_locator_plugin\fR(8), \fBsss_ssh_authorizedkeys\fR(8), \fBsss_ssh_knownhostsproxy\fR(8), \fBsssd-ifp\fR(5), \fBpam_sss\fR(8)\&. \fBsss_rpcidmapd\fR(5) \fBsssd-systemtap\fR(5) .SH "AUTHORS" .PP \fBThe SSSD upstream \- https://github\&.com/SSSD/sssd/\fR