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 1547013 - adcli refuses to add service principals
Summary: adcli refuses to add service principals
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: adcli
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Sumit Bose
QA Contact: Petr Čech
URL:
Whiteboard:
Depends On:
Blocks: 1550132
TreeView+ depends on / blocked
 
Reported: 2018-02-20 11:00 UTC by Ondrej
Modified: 2021-12-10 15:41 UTC (History)
7 users (show)

Fixed In Version: adcli-0.8.1-5.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 11:24:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:3223 0 None None None 2018-10-30 11:25:23 UTC

Description Ondrej 2018-02-20 11:00:17 UTC
Description of problem:
Running
adcli update --service-name=NFS --domain=<my domain>
has no effect. Kerberos keytab remains unchanged, also SPN in AD is not updated.
No error message is printed.

Version-Release number of selected component (if applicable):
adcli-0.8.1-3.el7.x86_64

How reproducible:
always

Expected results:
I would expect this command to do both, update Kerberos keytab and machine account SPN in AD


Additional info:

Comment 2 Sumit Bose 2018-02-26 15:56:52 UTC
If you want to set SPNs even for a system which is already joined you can use

    adcli join --service-name=NFS --domain=<my domain>

But there is one pitfall, the --service-name option does not keep existing names, so you have to check either in the keytab or in the AD entry which names already exist. E.g. by default adcli uses 'host' and 'RestrictedKrbHost', to _add_ NFS you have to call

    adcli join --service-name=host --service-name=RestrictedKrbHost --service-name=NFS --domain=<my domain>


I agree that this is cumbersome and error-prone and I'll try to fix this together with the other ticket you opened (https://bugzilla.redhat.com/show_bug.cgi?id=1547014).

Comment 3 Ondrej 2018-02-27 07:23:49 UTC
Well, this is cumbersome and does not reflect the man page either.
Man page suggests it should be possible to set SPN to an already joined system with "adcli update" (that what one would actually expect) - not adcli join.

So please fix this as well. "Adcli join" seems to me far too dangerous in this case - it looks and feels like it will actually overwrite an existing account.

Comment 9 Ondrej 2018-09-25 08:47:38 UTC
Can you release the updated package for me to test?

Comment 10 Ondrej 2018-09-25 09:26:11 UTC
Summary my problems (testing with adcli-0.8.1-3.el7, i.e. still the latest available):
1. "adcli --update --service-name=host/skynet18.mydomain.com --domain mydomain" does not work  - it appears to do nothing
2. adcli join mydomain.com does not populate the UPN and SPN attributes in AD in case the machine account already exists in AD. The error is:
 * Modifying computer account: userPrincipalName
 ! Couldn't set service principals on computer account CN=SKYNET18,OU=...,DC=com: 00002083: AtrErr: DSID-0315191D, #1:
	0: 00002083: DSID-0315191D, problem 1006 (ATT_OR_VALUE_EXISTS), data 0, Att 90303 (servicePrincipalName)
3. adcli join fills krb5.keytab only with host/`hostname -s`@REALM principals whereas "net ads join" also adds host/`hostname -f`@REALM principals
4. adcli join --service-name=host/myhost.mydomain.com does adds an incorrect principal in krb5.keytab in form "host/myhost.mydomain.com/myhost@REALM" which is not what I want

Is it realistic to expect all these 4 problems will be fixed in adcli-0.8.1-5.el7?

Comment 11 Sumit Bose 2018-09-25 09:57:58 UTC
adcli-0.8.1-5.el7 is part of the RHEL-7.6 Beta (https://www.redhat.com/en/blog/red-hat-enterprise-linux-76-beta-now-available). Do you have access to the Beta release?

Please note a new option --add-service-principal was added to handle service principals more flexible.

Comment 12 Ondrej 2018-09-25 10:17:02 UTC
Ok tried that. Seems like the problems I described above persists.
Most notably:
1. it seems adcli has problems updating serviceprincipalName attribute in case computer object already exists (getting the same error message as I mentioned above). "net ads join" does not suffer from this problem.
2. I think "host/FQDN" principal should be added by default (i.e. the same way 'net ads join' does) as it seems to me sshd uses 'host/FQDN' principals to verify tickets.

What do you think?

Comment 13 Sumit Bose 2018-09-25 13:37:04 UTC
(In reply to Ondrej from comment #12)
> Ok tried that. Seems like the problems I described above persists.
> Most notably:
> 1. it seems adcli has problems updating serviceprincipalName attribute in
> case computer object already exists (getting the same error message as I
> mentioned above). "net ads join" does not suffer from this problem.

I guess you are using 'adcli update'. By default 'adcli update' uses the host credentials from the keytab and by default a host is not allowed to update its own attributes in AD. Please try to kinit as a user which is allowed to update host attributes and use the --login-ccache with 'adcli update'. If this still does not work please send the full command with the verbose output.

'net ads join' always asks for admin credentials so it will have sufficient permissions to update the attributes.


> 2. I think "host/FQDN" principal should be added by default (i.e. the same
> way 'net ads join' does) as it seems to me sshd uses 'host/FQDN' principals
> to verify tickets.
> 
> What do you think?

If the FQDN is set as the hostname, e.g. is the hostname command returns the FQDN, adcli will already use add the host/FQDN principal as well. There is https://bugzilla.redhat.com/show_bug.cgi?id=1595911 to handle the case where it doesn't.

HTH

bye,
Sumit

Comment 14 Ondrej 2018-09-25 13:56:07 UTC
(In reply to Sumit Bose from comment #13)
> I guess you are using 'adcli update'. By default 'adcli update' uses the
> host credentials from the keytab and by default a host is not allowed to
> update its own attributes in AD. Please try to kinit as a user which is
> allowed to update host attributes and use the --login-ccache with 'adcli
> update'. If this still does not work please send the full command with the
> verbose output.
no I am using 'adcli join -v -U <admuser>' and entering my passwd. It still refuses to populate SPN on the AD side.

> If the FQDN is set as the hostname, e.g. is the hostname command returns the
> FQDN, adcli will already use add the host/FQDN principal as well. There is
> https://bugzilla.redhat.com/show_bug.cgi?id=1595911 to handle the case where
> it doesn't.
Right, that's it, indeed.

Comment 15 Sumit Bose 2018-09-26 11:36:56 UTC
(In reply to Ondrej from comment #14)
> (In reply to Sumit Bose from comment #13)
> > I guess you are using 'adcli update'. By default 'adcli update' uses the
> > host credentials from the keytab and by default a host is not allowed to
> > update its own attributes in AD. Please try to kinit as a user which is
> > allowed to update host attributes and use the --login-ccache with 'adcli
> > update'. If this still does not work please send the full command with the
> > verbose output.
> no I am using 'adcli join -v -U <admuser>' and entering my passwd. It still
> refuses to populate SPN on the AD side.
> 

I tired to reproduce this an unfortunately I see an ATT_OR_VALUE_EXISTS error which is caused because adcli tries to add the servicePrincipalName value twice. Nevertheless I servicePrincipalName attributes on the AD DC with the --server-name values I gave on the command line.

Are you referring to the ATT_OR_VALUE_EXISTS error as well or do you see a different one?

Comment 16 Ondrej 2018-09-26 12:40:22 UTC
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...."

So I still see 2 major issues there.

Comment 18 Ondrej 2018-10-30 08:13:23 UTC
Question - what means Verified & release pending? To me the, the bug still does not seem to be fixed..

Comment 19 Sumit Bose 2018-10-30 09:24:45 UTC
(In reply to Ondrej from comment #18)
> Question - what means Verified & release pending? To me the, the bug still
> does not seem to be fixed..

I will open a new ticket with your steps from comment #16 to cover them in the next release.

Comment 20 errata-xmlrpc 2018-10-30 11:24:42 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-2018:3223

Comment 21 Sumit Bose 2018-10-30 12:53:04 UTC
(In reply to Sumit Bose from comment #19)
> (In reply to Ondrej from comment #18)
> > Question - what means Verified & release pending? To me the, the bug still
> > does not seem to be fixed..
> 
> I will open a new ticket with your steps from comment #16 to cover them in
> the next release.

the follow-up ticket is https://bugzilla.redhat.com/show_bug.cgi?id=1644311. I already added you to CC, I hope you don't mind.

Comment 22 Chris 2018-10-30 19:59:05 UTC
> I guess you are using 'adcli update'. By default 'adcli update' uses the
> host credentials from the keytab and by default a host is not allowed to
> update its own attributes in AD. Please try to kinit as a user which is
> allowed to update host attributes and use the --login-ccache with 'adcli
> update'. If this still does not work please send the full command with the
> verbose output.

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

I would agree with the original post that "adcli update --service-name=NFS" is appropriate for this and shouldn't require additional AD credentials on a domain joined host.

adcli join   - Requires credentials
adcli update - Uses machine credentials


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