SSH user not getting authenticated through kerberos
I have setup kerberos in my ubuntu machine and I am able to get tickets for users via kinit
from my other Fedora Linux client machine.
But getting below error in sshd debug logs, no idea what it means:
debug1: userauth-request for user user1 service ssh-connection method gssapi-with-mic [preauth]
debug1: attempt 1 failures 0 [preauth]
Postponed gssapi-with-mic for user1 from 10.87.198.85 port 55360 ssh2 [preauth]
debug1: Unspecified GSS failure. Minor code may provide more information
Request ticket server host/[email protected] found in keytab but does not match server principal host/sat.com@
debug1: Got no client credentials
debug1: userauth-request for user user1 service ssh-connection method gssapi-with-mic [preauth]
debug1: attempt 2 failures 1 [preauth]
My sshd and KDC are running in the same machine, with below config:
major components of krb5.conf:
[libdefaults]
default_realm = SAT.COM
[realms]
SAT.COM = {
kdc = kdc.sat.com
admin_server = kdc.sat.com
}
My /etc/hosts file:
127.0.0.1 localhost
10.125.222.30 kdc.sat.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Principals in my KDC are as below:
kadmin: listprincs
K/[email protected]
host/[email protected]
host/[email protected]
kadmin/[email protected]
kadmin/[email protected]
kadmin/[email protected]
kiprop/[email protected]
krbtgt/[email protected]
satyam/[email protected]
[email protected]
When I do initial kinit from my fedora client I get just one ticket as below:
[user1@satyam ~]$ kinit
Password for [email protected]:
[user1@satyam ~]$ klist
Ticket cache: KCM:1001
Default principal: [email protected]
Valid starting Expires Service principal
09/24/2019 19:32:46 09/25/2019 05:32:46 krbtgt/[email protected]
renew until 10/01/2019 19:32:41
But as soon as I do ssh to my sshd server which is same as KDC server my klist has more entries:
[user1@satyam ~]$ ssh kdc.sat.com
Ubuntu 16.04.1 LTS Satyam
[email protected]'s password:
[satyam@satyam ~]$ klist
Ticket cache: KCM:1000
Default principal: [email protected]
Valid starting Expires Service principal
09/24/2019 19:44:59 09/25/2019 05:41:14 host/kdc.sat.com@
renew until 10/01/2019 19:41:10
09/24/2019 19:41:14 09/25/2019 05:41:14 krbtgt/[email protected]
renew until 10/01/2019 19:41:10
09/24/2019 19:44:59 09/25/2019 05:41:14 host/[email protected]
renew until 10/01/2019 19:41:10
Also Principal host/[email protected] was not added earlier but then I got below error in sshd so I tried adding it but still no luck:
No key table entry found matching host/sat.com@
Any help regarding this will be very helpful.
I was doing lot of online googling and found below configuration parameter which somehow resolved the issue:
Param I used:
[libdefaults]
ignore_acceptor_hostname = true
https://stackoverflow.com/questions/14687245/apache-sends-wrong-server-principal-name-to-kerberos
In above SO thread although there is an explanation but still I didn't quite understand how it worked and what was the issue.
Please still if anyone can explain how this config param solved my issue that would be great.