SSSD in combination with IPA(+AD-Trust) recently, where only sometimes, a connection to one of the
IPA-Servers would fail with this error:
Jul 13 13:36:42 ipa02.archyslife.lan sshd[3478]: pam_sss(sshd:account): Access denied for user runner: 4 (System error)
Jul 13 13:36:42 ipa02.archyslife.lan sshd[3478]: fatal: Access denied for user runner by PAM account configuration [preauth]
In my case, it was only happening sometimes when running a basic system setup role using ansible on every host in the entire environment. This way, there was no consistent pattern besides being the same host every time if it failed.
First up, add the 'debug_level=X' to every section required in the /etc/sssd/sssd.conf where X
is a number from 1 to 10 with 10 being the most verbose. Afterward, restart sssd and check the
logs for any obvious problems.
1) If you are using local users, check the /etc/security/access.conf file for entries correlating to this.
Using my case, a line like this would work
[archy@ipa02 ~]$ sudo vim /etc/security/access.conf
+:runner:172.31.10.0/24
This would give the user 'runner' access to the host from every address in the 172.31.10.0/24 network.
2) If you are using IPA, this might be caused by hbac rules. You can quickly rule them out by testing using the
command line:
[archy@ipa02 ~]$ ipa hbactest --user 'runner' --host 'ipa02.archyslife.lan' --service 'sshd' | grep -viE 'not'
---------------------
Access granted: False
---------------------
If it turns out that hbac rules was the root cause, you can simply create a new rule allowing the required services
[archy@ipa02 ~]$ ipa hbacrule-add allow_runner_sshd
---------------------------------
Added HBAC rule "allow_runner_sshd"
---------------------------------
Rule name: allow_runner_sshd
Enabled: TRUE
[archy@ipa02 ~]$$ ipa hbacrule-add-host --hostgroups=hg_all allow_runner_sshd
Rule name: allow_runner_sshd
Enabled: TRUE
Host Groups: hg_all
-------------------------
Number of members added 1
-------------------------
[archy@ipa02 ~]$$ ipa hbacrule-add-service --hbacsvcs=sshd allow_runner_sshd
Rule name: allow_runner_sshd
Enabled: TRUE
Host Groups: hg_all
Services: sshd
-------------------------
Number of members added 1
-------------------------
[archy@ipa02 ~]$ ipa hbacrule-add-user --users=runner allow_runner_sshd
Rule name: allow_runner_sshd
Enabled: TRUE
Users: runner
Host Groups: hg_all
Services: sshd
-------------------------
Number of members added 1
-------------------------
Now, if we check the access again, we should get a different result
[archy@ipa02 ~]$ ipa hbactest --user 'runner' --host 'ipa02.archyslife.lan' --service 'sshd' | grep -viE 'not'
--------------------
Access granted: True
--------------------
Matched rules: allow_runner_sshd
If none of the above-mentioned possibilities worked, you can try reinstalling sssd on the affected server:
[archy@ipa02 ~]$ sudo yum -y reinstall sssd.x86_64 sssd-ad.x86_64 sssd-client.x86_64 sssd-common.x86_64 sssd-common-pac.x86_64 sssd-dbus.x86_64 sssd-ipa.x86_64 sssd-krb5.x86_64 sssd-krb5-common.x86_64 sssd-ldap.x86_64 sssd-proxy.x86_64
[archy@ipa02 ~]$ sudo sssctl cache-expire -E
[archy@ipa02 ~]$ sudo systemctl restart sssd.service
Feel free to comment and / or suggest any topics.
Comments
Post a Comment