klist not showing tgt after reboot

Bug #1988144 reported by Hajo Locke
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
krb5 (Ubuntu)
New
Undecided
Sergio Durigan Junior

Bug Description

Hello,

iam not sure if this is a bug, but iam noticed a different behaviour of kinit/klist between Ubuntu 18.04 and 22.04
I already talked to sam hartman who is maintainer of krb5 packages at debian and he told that basically there is no difference between different version of kinit/klist and one should dig in Ubuntu environment.
Let me decribe the notice:

We use kinit/klist/krb5 keytab as base for sssd and ssh access controlled by AD.

In Ubuntu 18.04 LTS i could do:
"kinit myprincipal" and created a valid tgt. This tgt was stable and survived a reboot which can be viewed by "klist".
I log in as unprivileged user, doing "sudo -i" and see:

myhost: # klist
Ticket cache: FILE:/tmp/krb5cc_27465975_uqBiyq

File /tmp/krb5cc_27465975_uqBiyq is existent and owned by my unprivileged username and group domainusers.
Ubuntu 18.04 LTS is using 1.16-2ubuntu0.2 of krb5-user. i have to say, that first login as unprivileged user is done by using ssh-keypair, so no sssd is involved. But by using "sudo -i" sssd is used and worked like expected.

Now we switched to Ubuntu 22.04 LTS, Version of krb5-user is 1.19.2-2
Doing kinit myprincipal on 22.04 leads to:
myhost: # klist
Ticket cache: FILE:/tmp/krb5cc_0

File /tmp/krb5cc_0 is owned by root:root

After reboot i can still login successful as unprivileged user make "sudo -i" and klist says:

myhost: # klist
klist: No credentials cache found (filename: /tmp/krb5cc_0

File /tmp/krb5cc_0 is gone (deleted from unknown), but i see a file /tmp/krb5cc_27465975_nGySkP which is owned by my unprivileged username and group is domainusers.
 is this expected? It seems that newer klist always wants to use the default name /tmp/krb5cc_0. It creates tgt with this name and tries to read this filename. but after reboot file is recreated with different name and default klist command fails. First login as unprivilged user was done with ssh-keypair without sssd, but "sudo -i" uses sssd agin. Whole thing only works like in 18.04 if you dont use ssh-keypairs and do all logins by hand with manually login, so sssd is forced to use in every step.

What do you think? Is this a bug or wrong use? Behaviour of 18.04 was absolutely satisfying.

Thanks,
Hans

Tags: jammy
Hajo Locke (hajo-locke)
description: updated
Paul White (paulw2u)
affects: ubuntu → krb5 (Ubuntu)
tags: added: jammy
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for taking the time to report a bug and make Ubuntu better.

I tried reproducing the problem here but it seems there's something I'm missing. I have a Samba AD DC setup (running Focal, but that shouldn't matter) and I setup a Bionic client. I then obtained a ticket using "kinit", verified that the ticket is listed using "klist", and then reboot the VM. When it came back online, the ticket was gone. The same behaviour happens if I setup a Focal client, BTW.

I may be wrong, but looking at the ticket you got on the Bionic machine it seems to me that there's some extra configuration in your /etc/krb5.conf that may be causing this behaviour.

Would it be possible for you to come up with a step-by-step reproducer for this problem, please?

Thanks in advance.

Changed in krb5 (Ubuntu):
status: New → Incomplete
Revision history for this message
Hajo Locke (hajo-locke) wrote :

Hello Sergio,

thanks for your help.

I can do that. I will explain a step by step procedure for my setup. Also i attach a file with anonymised krb5.conf, realmd.conf and sssd.conf

We have a ActiveDirectory Domain which is controlled by multiple Domaincontrollers. We attach some of our Linuxserver to AD to control by AD-Group who can access and sudo on this linuxmachines. In my conf files the domain is simple called domain.de|DOMAIN.DE

- starting point is a fresh installed Ubuntu 18.04 or 22.04 LTS with a lokal admin. this lokal admin is used to initiate the AD Connection. Basically i followed this tutorial: https://schroeffu.ch/2019/09/linux-active-directory-ldap-ssh-login-mit-sssd-und-realmd/

- Installation:
apt install realmd sssd sssd-tools samba-common krb5-user packagekit samba-common-bin samba-libs adcli

- please see attached krb5.conf, realmd.conf

- now i get a tgt with kinit using my AD-Domainadmincredentials
kinit <email address hidden>

- joining Domain
realm --verbose join DOMAIN.DE -U <email address hidden>

- at this point we are part of domain and after domainsync every user in group LinuxAdmins can login by ssh. making sudo is allowed by a config in /etc/sudoers.d/ which contains
%LinuxAdmins ALL=(ALL:ALL) ALL

Now i use a unprivileged domainuser which is part of AD-group LinuxAdmins
For fast login i use a key-pair for this user to login as unprivileged user. So i log in by ssh-keys and do a "sudo -i" to stay permanent root. Now sssd works and checks my AD-Data/Passwort. iam allowed to do sudo and now iam root user. klist now shows a valid tgt and klist -ekt shows valid KVNO, Timestamp and Principal

Now i do the same on Ubuntu 22, all steps/configs identical except a line in sssd.conf (see comment in first section) because services use other startup.
On ubuntu 22 i use my unprivilged user to login by ssh-keys then doing "sudo -i" and klist says:
klist: No credentials cache found (filename: /tmp/krb5cc_0)
a file /tmp/krb5cc_0 is not existent but i see a file /tmp/krb5cc_27465975_nGySkP which is owned by my unprivilged username but not used by klist. May be the problem is in the sudo environment.

In Ubuntu 22 i see a valid tgt by klist only if i do every login by hand and dont use a ssh key. but this was working in ubuntu 18 and i liked the way, because i hop on a lot of servers every day and first login by ssh-key is very comfy.
May be this is only a small bug in this particular case, but i want to make sure that my services still work after some time, because the existing keytab can used for other purposes like authentication by apache-webserver too and i dont want them to be harmed by this issue.

Thanks for your help,
Hans

Revision history for this message
Hajo Locke (hajo-locke) wrote :

realmd.conf

Revision history for this message
Hajo Locke (hajo-locke) wrote :

sssd.conf

Revision history for this message
Hajo Locke (hajo-locke) wrote :

Hello Sergio,

do you have conceived an opinion on this issue?

Thanks,
Hajo

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Hi Hajo,

Sorry for the delay; I've been traveling and in work meetings for the past weeks. I will take a closer look at the information you provided and try to reproduce the problem. I'll get back to you when I have more results.

Thanks.

Changed in krb5 (Ubuntu):
status: Incomplete → New
assignee: nobody → Sergio Durigan Junior (sergiodj)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.