RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1644311 - Improve handling of service principals
Summary: Improve handling of service principals
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: adcli
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Sumit Bose
QA Contact: ipa-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-10-30 12:50 UTC by Sumit Bose
Modified: 2022-03-13 15:54 UTC (History)
7 users (show)

Fixed In Version: adcli-0.8.1-8.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-06 13:11:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2019:2256 0 None None None 2019-08-06 13:11:10 UTC

Description Sumit Bose 2018-10-30 12:50:29 UTC
Description of problem:
The following issues reported by ondrej.valousek are still open:



Exact steps to reproduce:
1. use "net ads join" to join computer to domain
2. Clear the ServicePrincipalName value via ADUC Attribute Editor
3. Clear local keytab: echo -e "\0005\0002\c" > /etc/krb5.keytab
4a. # adcli -v join <domain_name> -U <admuser>
- receiving ATT_OR_VALUE_EXISTS error
- servicePrincipalName remains blank
4b. # adcli -v join <domain_name> -U <admuser> --service-name nfs
- receiving ATT_OR_VALUE_EXISTS error
- servicePrincipalName remains blank
- 'klist -k' shows the "nfs" service principal, but the "host" principal is gone. I think we should always insert "host" principal. Even the man page says "...Additional service name for kerberos...."

Comment 2 Chris 2018-10-30 20:28:33 UTC
Computer accounts in Active Directory have the "Validated write to service principal name" permission assigned to "SELF".  This allows domain joined systems to manage their own SPNs.  On a domain joined client with proper Samba configuration I can obtain a ticket for the computer account and add an SPN as follows:

kinit -k <COMPUTER>\$@<DOMAIN>
net ads keytab add <SPN> -k

I can also create a new keytab file containing only the new SPN like this:
KRB5_KTNAME=FILE:/etc/service.keytab net ads keytab add <SPN> -k


Expected results:
adcli join - Require either username/password or valid Kerberos ticket to (re-)join a client to a domain and populate the system keytab with the computer account and the host SPN.

adcli update - Do not require credentials, but rather use the existing computer account from system keytab to update the account password and/or create new SPNs.  SPNs would be added to the system keytab by default, or optionally to a specified keytab file for use by services running as non-root users.

Comment 3 Sumit Bose 2019-03-19 10:30:44 UTC
(In reply to Chris from comment #2)
> Computer accounts in Active Directory have the "Validated write to service
> principal name" permission assigned to "SELF".  This allows domain joined
> systems to manage their own SPNs.  On a domain joined client with proper
> Samba configuration I can obtain a ticket for the computer account and add
> an SPN as follows:
> 
> kinit -k <COMPUTER>\$@<DOMAIN>
> net ads keytab add <SPN> -k
> 
> I can also create a new keytab file containing only the new SPN like this:
> KRB5_KTNAME=FILE:/etc/service.keytab net ads keytab add <SPN> -k
> 
> 
> Expected results:
> adcli join - Require either username/password or valid Kerberos ticket to
> (re-)join a client to a domain and populate the system keytab with the
> computer account and the host SPN.
> 
> adcli update - Do not require credentials, but rather use the existing
> computer account from system keytab to update the account password and/or
> create new SPNs.  SPNs would be added to the system keytab by default, or
> optionally to a specified keytab file for use by services running as
> non-root users.

A similar sequence like the one you showed for net should already work:

    kinit -k <COMPUTER>\$@<DOMAIN>
    adcli update --login-ccache --service-name=xyz

Does this solve the issue for you?

bye,
Sumit

Comment 4 Sumit Bose 2019-03-19 10:37:14 UTC
(In reply to Sumit Bose from comment #0)
> Description of problem:
> The following issues reported by ondrej.valousek are still open:
> 
> 
> 
> Exact steps to reproduce:
> 1. use "net ads join" to join computer to domain
> 2. Clear the ServicePrincipalName value via ADUC Attribute Editor
> 3. Clear local keytab: echo -e "\0005\0002\c" > /etc/krb5.keytab
> 4a. # adcli -v join <domain_name> -U <admuser>
> - receiving ATT_OR_VALUE_EXISTS error
> - servicePrincipalName remains blank
> 4b. # adcli -v join <domain_name> -U <admuser> --service-name nfs
> - receiving ATT_OR_VALUE_EXISTS error
> - servicePrincipalName remains blank
> - 'klist -k' shows the "nfs" service principal, but the "host" principal is
> gone. I think we should always insert "host" principal. Even the man page
> says "...Additional service name for kerberos...."

I think the ATT_OR_VALUE_EXISTS and the resulting empty servicePrincipalName attribute is a consequence of a short hostname and should be fixed by adcli-0.8.1-6.el7_6.1 (https://access.redhat.com/errata/RHBA-2019:0200). Can you verify this?

This would leave to always add host/... during join even with --service-name given.

bye,
Sumit

Comment 5 Ondrej 2019-03-19 11:07:42 UTC
> A similar sequence like the one you showed for net should already work:
> 
>     kinit -k <COMPUTER>\$@<DOMAIN>
>     adcli update --login-ccache --service-name=xyz
> 
> Does this solve the issue for you?

Well it probably would, but I still think the cleaner solution would be if adcli performs the "kinit" automatically here and do not rely on user (relatively deep) knowledge of AD internals.

Comment 6 Sumit Bose 2019-03-19 11:53:46 UTC
(In reply to Ondrej from comment #5)
> > A similar sequence like the one you showed for net should already work:
> > 
> >     kinit -k <COMPUTER>\$@<DOMAIN>
> >     adcli update --login-ccache --service-name=xyz
> > 
> > Does this solve the issue for you?
> 
> Well it probably would, but I still think the cleaner solution would be if
> adcli performs the "kinit" automatically here and do not rely on user
> (relatively deep) knowledge of AD internals.

Of course

    adcli update --service-name=xyz

would work as well since adcli in update mode will by default use the keytab to authenticate. I just got the impression that Chris was asking about using an existing credential cache.

bye,
Sumit

Comment 7 Corey Brown 2019-03-19 16:01:05 UTC
Hi all,

Both of the cases attached to this bug have been closed due to customer inactivity. I will provide the suggested use of adcli to both cases, but at this time I think this Bug can be closed.

Thank you for your help on this issue.

Corey Brown

Comment 8 Ondrej 2019-03-19 19:22:03 UTC
Hi,
Not sure where is my activity needed/requested? Must have missed that...
Otherwise I am happy to test if it got fixed already.
Ondrej

Comment 9 Sumit Bose 2019-03-19 19:32:36 UTC
(In reply to Ondrej from comment #8)
> Hi,
> Not sure where is my activity needed/requested? Must have missed that...
> Otherwise I am happy to test if it got fixed already.
> Ondrej

Hi,

please see comment #4. I'm pretty sure the ATT_OR_VALUE_EXISTS issue is fixed by the latest z-stream release but it would be nice if you can confirm this. But as said I will use this ticket to make sure host/... is always added during join.

bye,
Sumit

Comment 11 Ondrej 2019-03-20 09:13:20 UTC
Not sure what z-stream actually means. Yum offers me version 0.8.1-6.el7_6.1.
Is that one sufficient?

Comment 12 Sumit Bose 2019-03-20 09:18:19 UTC
(In reply to Ondrej from comment #11)
> Not sure what z-stream actually means. Yum offers me version 0.8.1-6.el7_6.1.
> Is that one sufficient?

Yes, this version should contain the fix for ATT_OR_VALUE_EXISTS.

bye,
Sumit

Comment 13 Ondrej 2019-03-20 09:40:14 UTC
Ok just tried with 0.8.1-6.el7_6.1 and can confirm the ATT_OR_VALUE_EXISTS does not appear any more.
This leaves us with 3 issues still open:

1. adcli join --service-name=xyz omits the host principal(s)
2. adcli update --service-name=xyz does not work
3. adcli should actually add two versions of host/ principal (much like the `net ads join` does), one for `hostname -s` and second for `hostname -f` (which is currently missing). The lack of the long version means sshd can not validate TGT for incoming gssapi authentication for example so ssh asks for a password.

Ondrej

Comment 14 Sumit Bose 2019-03-20 10:43:48 UTC
(In reply to Ondrej from comment #13)
> Ok just tried with 0.8.1-6.el7_6.1 and can confirm the ATT_OR_VALUE_EXISTS
> does not appear any more.

Thank you for testing.

> This leaves us with 3 issues still open:
> 
> 1. adcli join --service-name=xyz omits the host principal(s)

yes, this will be handled by this ticket.

> 2. adcli update --service-name=xyz does not work

What does not work? Can you send the verbose output of adcli? I just tried and the xzy service principal was added to the keytab and to the AD LDAP object.

> 3. adcli should actually add two versions of host/ principal (much like the
> `net ads join` does), one for `hostname -s` and second for `hostname -f`
> (which is currently missing). The lack of the long version means sshd can
> not validate TGT for incoming gssapi authentication for example so ssh asks
> for a password.

This it handled by https://bugzilla.redhat.com/show_bug.cgi?id=1595911.

bye,
Sumit

> 
> Ondrej

Comment 15 Ondrej 2019-03-20 11:10:27 UTC
> What does not work? Can you send the verbose output of adcli? I just tried
> and the xzy service principal was added to the keytab and to the AD LDAP
> object.

Well it looks and feels it works:
[root@skynet18 ~]# adcli update -D <domain> -v --service-name=nfs
...
 * Enrolling computer name: SKYNET18
 * Generated 120 character computer password
 * Using keytab: FILE:/etc/krb5.keytab
 * Found computer account for SKYNET18$ at: <...>
 * Retrieved kvno '12' for computer account in directory: <...>
 * Password not too old, no change needed
 * Sending netlogon pings to domain controller: cldap://x.y.z.
 * Received NetLogon info from: XXXX
 * Added the entries to the keytab: SKYNET18$@<domain>: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: host/SKYNET18@<domain>: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: RestrictedKrbHost/SKYNET18@<domain>: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: nfs/SKYNET18@<domain>: FILE:/etc/krb5.keytab

but klist -k does not show any nfs principal in my keytab, only entries with older kvno (11).

Comment 16 Sumit Bose 2019-03-20 11:46:04 UTC
(In reply to Ondrej from comment #15)
> > What does not work? Can you send the verbose output of adcli? I just tried
> > and the xzy service principal was added to the keytab and to the AD LDAP
> > object.
> 
> Well it looks and feels it works:
> [root@skynet18 ~]# adcli update -D <domain> -v --service-name=nfs
> ...
>  * Enrolling computer name: SKYNET18
>  * Generated 120 character computer password
>  * Using keytab: FILE:/etc/krb5.keytab
>  * Found computer account for SKYNET18$ at: <...>
>  * Retrieved kvno '12' for computer account in directory: <...>
>  * Password not too old, no change needed
>  * Sending netlogon pings to domain controller: cldap://x.y.z.
>  * Received NetLogon info from: XXXX
>  * Added the entries to the keytab: SKYNET18$@<domain>: FILE:/etc/krb5.keytab
>  * Added the entries to the keytab: host/SKYNET18@<domain>:
> FILE:/etc/krb5.keytab
>  * Added the entries to the keytab: RestrictedKrbHost/SKYNET18@<domain>:
> FILE:/etc/krb5.keytab
>  * Added the entries to the keytab: nfs/SKYNET18@<domain>:
> FILE:/etc/krb5.keytab
> 
> but klist -k does not show any nfs principal in my keytab, only entries with
> older kvno (11).

Sorry, can you be more specific? Feel free to send me the klist -k output directly instead of answering the questions below.

Do you mean there is none nfs entry at all or only nfs entries with kvno 11 while the current one is 12?

Does the keytab contain only entries with kvno 11 and none with 12? In this case a previous password update might have failed, i.e. updated the password on AD but didn't update the keytab.

bye,
Sumit

Comment 17 Ondrej 2019-03-20 11:52:52 UTC
Sorry, yes. /etc/krb5.keytab remains intact - i.e. no nfs entries, all entries with kvno 11.
I can send you the output directly - but seems to me adcli is not doing what it is saying it is doing.
Ondrej

Comment 18 Sumit Bose 2019-03-20 12:45:16 UTC
(In reply to Ondrej from comment #17)
> Sorry, yes. /etc/krb5.keytab remains intact - i.e. no nfs entries, all
> entries with kvno 11.
> I can send you the output directly - but seems to me adcli is not doing what
> it is saying it is doing.

I think I do not need the output. If there are only knvo 11 entries in the keytab the behavior can be explained. Since AD said the current kvno is 12 adcli is looking for an entry with kvno 12 in the keytab to copy the keys fir the new nfs entry. Since there is no entry with kvno 12 no new entry can be created. 'Added the entries to the keytab: nfs/SKYNET18@<domain>: FILE:/etc/krb5.keytab' message is wrongly displayed because an error condition was not propagated correctly. I will fix this.

I'm a bit puzzled why adcli can still authenticate with your keytab although the different kvnos indicate different keys. Did you by chance call 'adcli update' once with user credentials by using the -C/--login-ccache option? In that case you might have hit https://bugzilla.redhat.com/show_bug.cgi?id=1642546 "adcli exports kerberos ticket with old kvno" (sorry, private ticket). If that's the case can you sync AD and keytab by doing an adcli join again and then try to add the the nfs service again?

bye,
Sumit

> Ondrej

Comment 19 Ondrej 2019-03-20 13:11:14 UTC
I was running the adcli update immediately after adcli join which I ran on a machine which was joined to domain with "net ads join", but I then cleared keytab (so technically "adcli join" was only used to repopulate keytab).
Also, running "adcli update -v update --service-name=nfs -C" (with my admin user creds) makes no difference (adcli says it is adding entry to keytab but reality is different).
Ondrej

Comment 20 Sumit Bose 2019-03-20 13:44:40 UTC
(In reply to Ondrej from comment #19)
> I was running the adcli update immediately after adcli join which I ran on a
> machine which was joined to domain with "net ads join", but I then cleared
> keytab (so technically "adcli join" was only used to repopulate keytab).
> Also, running "adcli update -v update --service-name=nfs -C" (with my admin
> user creds) makes no difference (adcli says it is adding entry to keytab but
> reality is different).

Sorry, I meant if you have some time ago called adcli update with the -C/--login-ccache  at a time where the password was older than 30 days and adcli would have renewed it. In this case adcli would have written the news keys but with the old kvno into the keytab.

If you now call

    adcli update -D <domain> -v --computer-password-lifetime=0

(_no_ -C option) this would force an update of the computer password and update the keytab and the AD entry so that both will have the same kvno again. After that

    adcli update -D <domain> -v --service-name=nfs
 
should hopefully add the nfs entry.

bye,
Sumit


> Ondrej

Comment 21 Ondrej 2019-03-20 14:00:21 UTC
right, yes.
running update --computer-password-lifetime=0 and then update --service-name=nfs does result in nfs principal in the krb5.keytab.
Does it mean I am hitting the internal bug you mentioned?
If so, will you keep us informed when is this resolved?
Thx,

Ondrej

Comment 22 Sumit Bose 2019-03-20 14:12:31 UTC
(In reply to Ondrej from comment #21)
> right, yes.
> running update --computer-password-lifetime=0 and then update
> --service-name=nfs does result in nfs principal in the krb5.keytab.

Thank you for testing and confirming the behavior.

> Does it mean I am hitting the internal bug you mentioned?

yes

> If so, will you keep us informed when is this resolved?

It will be fixed in the next RHEL7 release.


So this ticket will be used to track:

> 1. adcli join --service-name=xyz omits the host principal(s)

bye,
Sumit

Comment 25 Paul Bransford 2019-06-04 14:44:22 UTC
I'm digging into an issue that's been giving me problems for a while, and I'm uncertain if this bug covers this case. Reading through the comments, I'm still uncertain. The issue I've observed: if a short name is returned during hostname lookup, it is expanded to the FQDN - however while doing so, the servicePrincipalName is added again spuriously, causing an ATT_OR_VALUE_EXISTS error.

Does this (#1644311) issue intersect with this upstream issue? https://gitlab.freedesktop.org/realmd/adcli/issues/1

If it's unrelated and not already taken in from upstream, I'd be happy to file a new bug. (The referenced upstream bug there was closed with two merges approximately two months back.)

Comment 26 Sumit Bose 2019-06-04 19:00:31 UTC
(In reply to Paul Bransford from comment #25)
> I'm digging into an issue that's been giving me problems for a while, and
> I'm uncertain if this bug covers this case. Reading through the comments,
> I'm still uncertain. The issue I've observed: if a short name is returned
> during hostname lookup, it is expanded to the FQDN - however while doing so,
> the servicePrincipalName is added again spuriously, causing an
> ATT_OR_VALUE_EXISTS error.
> 
> Does this (#1644311) issue intersect with this upstream issue?
> https://gitlab.freedesktop.org/realmd/adcli/issues/1
> 
> If it's unrelated and not already taken in from upstream, I'd be happy to
> file a new bug. (The referenced upstream bug there was closed with two
> merges approximately two months back.)

Not related to this ticket, I think what you are looking for is https://bugzilla.redhat.com/show_bug.cgi?id=1595911.

HTH

bye,
Sumit

Comment 29 errata-xmlrpc 2019-08-06 13:11:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2019:2256


Note You need to log in before you can comment on or make changes to this bug.