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 1840752 - No longer able to delete computer from AD using adcli
Summary: No longer able to delete computer from AD using adcli
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: adcli
Version: 7.8
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Sumit Bose
QA Contact: sssd-qe
URL:
Whiteboard: sync-to-jira
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-27 14:39 UTC by sdaniele3
Modified: 2023-10-06 20:20 UTC (History)
8 users (show)

Fixed In Version: adcli-0.8.1-15.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-09-29 20:20:55 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SSSD-2399 0 None None None 2023-10-06 20:20:01 UTC
Red Hat Issue Tracker SSSD-2433 0 None None None 2023-10-06 20:20:10 UTC
Red Hat Product Errata RHBA-2020:3985 0 None None None 2020-09-29 20:21:02 UTC

Description sdaniele3 2020-05-27 14:39:02 UTC
adcli-0.8.1-13.el7.x86_64


Description of problem:

In our AD environment we've been using the following command to delete computer objects without issue.

$ adcli delete-computer --verbose --domain=ad.gatech.edu --login-ccache=FILE:/path/to/krb5cc HOST
 ! Couldn't enumerate keytab: (null): Permission denied
adcli: couldn't lookup domain info from keytab: Couldn't enumerate keytab: (null): Permission denied


When it was working the command would continue. Here is an example. I don't know what should be considered private so I just replaced the stuff specific to us with placeholders. The host I ran this command on was "math30192".


$ adcli delete-computer --verbose --domain=ad.gatech.edu --login-ccache=FILE:/path/to/krb5cc math-thisistest.math.gatech.edu
 ! Couldn't enumerate keytab: (null): Permission denied
 * Using domain name: ad.gatech.edu
 * Calculated computer account name from fqdn: MATH30192
 * Calculated domain realm from name: AD.GATECH.EDU
 * Discovering domain controllers: _ldap._tcp.ad.gatech.edu
 * Sending netlogon pings to domain controller: cldap://SOME_IP
 * Sending netlogon pings to domain controller: ldap://SOME_IP
 * Sending netlogon pings to domain controller: cldap://SOME_IP
 * Sending netlogon pings to domain controller: ldap://SOME_IP
 * Sending netlogon pings to domain controller: cldap://SOME_IP
 ! Couldn't perform discovery search: Can't contact LDAP server
 ! Couldn't perform discovery search: Can't contact LDAP server
 * Received NetLogon info from: SOME_AD_SERVER
 * Wrote out krb5.conf snippet to /tmp/adcli-krb5-I1U1w4/krb5.d/adcli-krb5-conf-uTTwzH
 * Looked up short domain name: AD
 * Looked up domain SID: SOME_SID
 * Using fully qualified name: math30192.math.gatech.edu
 * Using domain name: ad.gatech.edu
 * Using computer account name: MATH30192
 * Using domain realm: ad.gatech.edu
 * Using fully qualified name: math-thisistest.math.gatech.edu
 * Truncated computer account name from fqdn: MATH-THISISTEST
 * Computer account for MATH-THISISTEST$ does not exist
 ! No computer account for MATH-THISISTEST$ exists
adcli: deleting math-thisistest.math.gatech.edu in ad.gatech.edu domain failed: No computer account for MATH-THISISTEST$ exists


The most recent version of adcli (adcli-0.8.1-13.el7.x86_64) breaks this workflow. After some debugging of the source RPMs I've narrowed it down to the following patch files:


In both -9 and -13:
0001-delete-use-keytab-data-to-determine-realm-and-NetBIO.patch
0001-tools-remove-errx-from-computer-commands.patch

Only in -13:
0001-Fix-for-issues-found-by-Coverity.patch


The first patch attempts to do something and if it fails prints an error message. The second patch extends this to exiting the program if there is an error.

The third patch "fixes" the function that's called in the first patch (load_host_keytab called by adcli_enroll_load) so that it returns "res" rather than "ADCLI_SUCCESS" at the end. This is great and all, but it breaks the program. As we now exit when this fails, even though it doesn't need to "succeed" for the delete command to work properly.

Comment 2 Sumit Bose 2020-05-28 09:20:07 UTC
Hi,

thanks for the ticket and the detailed analysis. I can reproduce the issue and you are right that the failure of adcli_enroll_load() should not be fatal here. The call was added to determine the NetBIOS name of the host from the keytab, but this is only needed in cases where the NetBIOS name is different from the short hostname, so a fatal error is not justified. I will prepare a fix.

bye,
Sumit

Comment 3 Sumit Bose 2020-06-05 15:19:45 UTC
Upstream:
 - 40d3be22f6e518e4354aa7c3d0278291fcbed32f

Comment 9 Dan Lavu 2020-06-18 02:45:22 UTC
Verified against adcli-0.8.1-15.el7.x86_64

[root@test ~]# klist
Ticket cache: KEYRING:persistent:0:0
Default principal: Administrator

Valid starting       Expires              Service principal
06/17/2020 21:19:10  06/18/2020 07:19:10  krbtgt/T2SITE12R79.COM
	renew until 06/24/2020 21:19:08


[root@test ~]# adcli delete-computer --verbose --domain=t2site12r79.com --login-ccache  test
 * Found realm in keytab: T2SITE12R79.COM
 * Found computer name in keytab: TEST
 * Found service principal in keytab: host/TEST
 * Found service principal in keytab: host/test.t2site12r79.com
 * Found host qualified name in keytab: test.t2site12r79.com
 * Found service principal in keytab: RestrictedKrbHost/TEST
 * Found service principal in keytab: RestrictedKrbHost/test.t2site12r79.com
 * Found service principal in keytab: nfs/test.t2site12r79.com
 * Found service principal in keytab: nfs/TEST
 * Using domain name: t2site12r79.com
 * Calculated computer account name from fqdn: TEST
 * Using domain realm: t2site12r79.com
 * Discovering domain controllers: _ldap._tcp.t2site12r79.com
 * Sending NetLogon ping to domain controller: secad580.t2site12r79.com
 * Received NetLogon info from: secad580.t2site12r79.com
 * Wrote out krb5.conf snippet to /tmp/adcli-krb5-6HuI0y/krb5.d/adcli-krb5-conf-gpVWBH
 * Using GSS-SPNEGO for SASL bind
 * Looked up short domain name: T2SITE12R79
 * Looked up domain SID: S-1-5-21-462758026-4081404078-1474916236
 * Using fully qualified name: test.t2site12r79.com
 * Using domain name: t2site12r79.com
 * Using computer account name: TEST
 * Using domain realm: t2site12r79.com
 * Not setting fully qualified name
 * Enrolling computer name: test
 * Found computer account for test$ at: CN=TEST,OU=Linux,OU=Servers,DC=t2site12r79,DC=com
 * Deleted computer account at: CN=TEST,OU=Linux,OU=Servers,DC=t2site12r79,DC=com

Comment 14 errata-xmlrpc 2020-09-29 20:20:55 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 (adcli bug fix and enhancement update), 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/RHBA-2020:3985


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