System Security Services Daemon (SSSD): Difference between revisions

From Leo's Notes
This page was last edited on 19 October 2020, at 23:57.
mNo edit summary
Line 1: Line 1:
== Use Cases ==
==Use Cases==


=== Authentication without Joining a Domain ===
===Authentication without Joining a Domain===
This use case is to allow your system to authenticate against a Windows AD server via Kerberos using sssd. It does not require joining the Windows domain. The method outlined below also does not retrieve account information either as both <code>/etc/passwd</code> and <code>/etc/groups</code> are managed locally.
This use case is to allow your system to authenticate against a Windows AD server via Kerberos using sssd. It does not require joining the Windows domain. The method outlined below also does not retrieve account information either as both <code>/etc/passwd</code> and <code>/etc/groups</code> are managed locally.


Line 71: Line 71:


===Testing Authentication===
===Testing Authentication===
You can test whether your authentication works using sssd without needing to login to the system from another session using <code>sssctl user-checks</code>.  
You can test whether your authentication works using <code>sssd</code> without needing to login to the system from another session using <code>sssctl user-checks</code>. This tool is provided by the <code>sssd-tools</code> package.<br />
<br />
{{Highlight
{{Highlight
| code = $ sssctl user-checks -a=auth leo
| code = $ sssctl user-checks -a=auth leo
user: leo
action: auth
service: system-auth
SSSD nss user lookup result:
- user name: leo
- user id: 11163191
- group id: 11163191
- gecos:
- home directory: /home/leo
- shell: /bin/bash
SSSD InfoPipe user lookup result:
- name: leo
- uidNumber: 11163191
- gidNumber: 11163191
- gecos: not set
- homeDirectory: /home/leo
- loginShell: /bin/bash
testing pam_authenticate
Password:
pam_authenticate for user [leo]: Success
PAM Environment:
- KRB5CCNAME=FILE:/tmp/krb5cc_16311891_wZhhye
| lang = terminal
| lang = terminal
}}
}}

Revision as of 23:57, 19 October 2020

Use Cases

Authentication without Joining a Domain

This use case is to allow your system to authenticate against a Windows AD server via Kerberos using sssd. It does not require joining the Windows domain. The method outlined below also does not retrieve account information either as both /etc/passwd and /etc/groups are managed locally.

These steps have been tested on CentOS 8.

Install SSSD and the Kerberos workstation packages.

# yum install sssd sssd-krb5 krb5-workstation authselect-compat

Configure krb5.conf:

[logging]
 default = FILE:/var/log/krb5libs.log
 kdc = FILE:/var/log/krb5kdc.log
 admin_server = FILE:/var/log/kadmind.log

[libdefaults]
 default_realm = WIN.EXAMPLE.COM
 dns_lookup_realm = false
 dns_lookup_kdc = false
 ticket_lifetime = 24h
 renew_lifetime = 7d
 forwardable = true

[realms]
 WIN.EXAMPLE.COM = {
  kdc = itsodcsrv14.win.example.com
 }

[domain_realm]
 win.example.com = WIN.EXAMPLE.COM
 .win.example.com = WIN.EXAMPLE.COM

At this point, you should be able to successfully obtain a Kerberos ticket:

$ kinit username@WIN.EXAMPLE.COM         # case matters!
Password for username@WIN.EXAMPLE.COM:   # Enter your password

Configure sssd.conf:

[sssd]
config_file_version = 2
services = nss, pam, ifp
domains = win.example.com

[domain/win.example.com]
id_provider = files
debug_level = 5
auth_provider = krb5
chpass_provider = krb5

krb5_realm = WIN.EXAMPLE.COM
krb5_server = ITSODCSRV14.WIN.EXAMPLE.COM:88
krb5_validate = false

Run authconfig to enable sssd and to enable sssdauth. This will set up the required pam configuration and also inject sssd to /etc/nsswitch.conf as a provider. At the very minimum for authentication, sss should be the provider for shadow.

# authconfig --enablesssd --update
# authconfig --enablesssdauth --update

Start sssd with systemctl start sssd. You should now be able to authenticate as a user.

Troubleshooting

Testing Authentication

You can test whether your authentication works using sssd without needing to login to the system from another session using sssctl user-checks. This tool is provided by the sssd-tools package.

$ sssctl user-checks -a=auth leo
user: leo
action: auth
service: system-auth

SSSD nss user lookup result:
 - user name: leo
 - user id: 11163191
 - group id: 11163191
 - gecos:
 - home directory: /home/leo
 - shell: /bin/bash

SSSD InfoPipe user lookup result:
 - name: leo
 - uidNumber: 11163191
 - gidNumber: 11163191
 - gecos: not set
 - homeDirectory: /home/leo
 - loginShell: /bin/bash

testing pam_authenticate

Password:
pam_authenticate for user [leo]: Success

PAM Environment:
 - KRB5CCNAME=FILE:/tmp/krb5cc_16311891_wZhhye