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 967008 - If joined via adcli, leave --remove doesn't work
Summary: If joined via adcli, leave --remove doesn't work
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: realmd
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: beta
: ---
Assignee: Stef Walter
QA Contact: Patrik Kis
URL:
Whiteboard:
Depends On: 961244
Blocks: 917637
TreeView+ depends on / blocked
 
Reported: 2013-05-24 13:55 UTC by Patrik Kis
Modified: 2016-08-22 11:39 UTC (History)
1 user (show)

Fixed In Version: realmd-0.14.3-1.el7 adcli-0.7.2.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 961244
Environment:
Last Closed: 2014-06-13 09:33:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Patrik Kis 2013-05-24 13:55:21 UTC
+++ This bug was initially created as a clone of Bug #961244 +++

If realm join was done via adcli, and not 'net ads join' then 'realm leave --remove' doesn't actually remove the computer account from the domain.

--- Additional comment from Stef Walter on 2013-05-09 04:35:17 EDT ---

[stef@stef ~]$ realm leave --verbose --remove borg.thewalter.lan
Password for Administrator: 
 * LANG=C LOGNAME=root /usr/bin/net -s /var/cache/realmd/realmd-smb-conf.1PNQWW -U Administrator ads leave
Enter Administrator's password:
Failed to leave domain: Unable to fetch domain sid: are we joined?
 ! Leaving the domain borg.thewalter.lan failed
 * Removing entries from keytab for realm
 * /usr/sbin/sss_cache --users --groups --netgroups --services --autofs-maps
 * Removing domain configuration from sssd.conf
 * /usr/bin/systemctl restart sssd.service
 * Successfully unenrolled machine from realm

Comment 1 Stef Walter 2013-07-22 14:01:17 UTC
Fix pushed to realmd and adcli git master.

Comment 2 Patrik Kis 2013-08-12 12:55:13 UTC
Hi Stef,
i'm afraid there is still a bug in this fix; it seems adcli command with leave --remove is not complete.

# rpm -q realmd
realmd-0.14.4-1.el7.x86_64
# 
# realm -v join --membership-software=adcli --user=Amy-admin security.baseos.qe
 * Resolving: _ldap._tcp.security.baseos.qe
 * Performing LDAP DSE lookup on: 10.34.36.170
 * Successfully discovered: security.baseos.qe
Password for Amy-admin: 
 * Required files: /usr/sbin/oddjobd, /usr/libexec/oddjob/mkhomedir, /usr/sbin/sssd, /usr/sbin/adcli
 * LANG=C /usr/sbin/adcli join --verbose --domain security.baseos.qe --domain-realm SECURITY.BASEOS.QE --login-type user --login-user Amy-admin --stdin-password
 * Using domain name: security.baseos.qe
 * Calculated computer account name from fqdn: X86-64-V08
 * Using domain realm: security.baseos.qe
 * Discovering domain controllers: _ldap._tcp.security.baseos.qe
 * Sending cldap pings to domain controller: dc.security.baseos.qe
 * Received NetLogon info from: DC.security.baseos.qe
 * Wrote out krb5.conf snippet to /var/cache/realmd/adcli-krb5-QpjECq/krb5.d/adcli-krb5-conf-qplNhJ
 * Authenticated as user: Amy-admin.QE
 * Looked up short domain name: SECURITY
 * Using fully qualified name: x86-64-v08.lab.eng.brq.redhat.com
 * Using domain name: security.baseos.qe
 * Using computer account name: X86-64-V08
 * Using domain realm: security.baseos.qe
 * Enrolling computer account name calculated from fqdn: X86-64-V08
 * Generated 120 character computer password
 * Using keytab: FILE:/etc/krb5.keytab
 * Using fully qualified name: x86-64-v08.lab.eng.brq.redhat.com
 * Using domain name: security.baseos.qe
 * Using computer account name: X86-64-V08
 * Using domain realm: security.baseos.qe
 * Looked up short domain name: SECURITY
 * Computer account for X86-64-V08$ does not exist
 * Found well known computer container at: CN=Computers,DC=security,DC=baseos,DC=qe
 * Calculated computer account: CN=X86-64-V08,CN=Computers,DC=security,DC=baseos,DC=qe
 * Created computer account: CN=X86-64-V08,CN=Computers,DC=security,DC=baseos,DC=qe
 * Set computer password
 * Retrieved kvno '2' for computer account in directory: CN=X86-64-V08,CN=Computers,DC=security,DC=baseos,DC=qe
 * Modifying computer account: dNSHostName
 * Modifying computer account: userAccountControl
 * Modifying computer account: operatingSystem, operatingSystemVersion, operatingSystemServicePack
 * Modifying computer account: userPrincipalName
 * Discovered which keytab salt to use
 * Added the entries to the keytab: X86-64-V08$@SECURITY.BASEOS.QE: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: HOST/X86-64-V08.QE: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: HOST/x86-64-v08.lab.eng.brq.redhat.com.QE: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: RestrictedKrbHost/X86-64-V08.QE: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: RestrictedKrbHost/x86-64-v08.lab.eng.brq.redhat.com.QE: FILE:/etc/krb5.keytab
 * /usr/bin/systemctl enable sssd.service
ln -s '/usr/lib/systemd/system/sssd.service' '/etc/systemd/system/multi-user.target.wants/sssd.service'
 * /usr/bin/systemctl restart sssd.service
 * /usr/bin/sh -c /usr/sbin/authconfig --update --enablesssd --enablesssdauth --enablemkhomedir --nostart && /usr/bin/systemctl enable oddjobd.service
 * Successfully enrolled machine in realm
# 
# ldapsearch -x -LLL -H ldap://10.34.36.170 -w 'Pass2012!' -D Amy-admin.qe -b dc=security,dc=baseos,dc=qe -s sub '*' | grep -i `hostname -s`
dn: CN=X86-64-V08,CN=Computers,DC=security,DC=baseos,DC=qe
cn: X86-64-V08
distinguishedName: CN=X86-64-V08,CN=Computers,DC=security,DC=baseos,DC=qe
name: X86-64-V08
sAMAccountName: X86-64-V08$
dNSHostName: x86-64-v08.lab.eng.brq.redhat.com
servicePrincipalName: RestrictedKrbHost/x86-64-v08.lab.eng.brq.redhat.com
servicePrincipalName: RestrictedKrbHost/X86-64-V08
servicePrincipalName: HOST/x86-64-v08.lab.eng.brq.redhat.com
servicePrincipalName: HOST/X86-64-V08
# 
# realm -v leave --user=Amy-admin --remove security.baseos.qe
Password for Amy-admin: 
 * LANG=C /usr/sbin/adcli delete-computer --verbose --domain security.baseos.qe --domain-realm SECURITY.BASEOS.QE --login-user Amy-admin --stdin-password
adcli: specify one host name of computer account to delete
 ! Failed to join the domain
 * Removing entries from keytab for realm
 * /usr/sbin/sss_cache --users --groups --netgroups --services --autofs-maps
 * Removing domain configuration from sssd.conf
 * /usr/sbin/authconfig --update --disablesssdauth --nostart
 * /usr/bin/systemctl disable sssd.service
rm '/etc/systemd/system/multi-user.target.wants/sssd.service'
 * /usr/bin/systemctl stop sssd.service
 * Successfully unenrolled machine from realm
# 
# ldapsearch -x -LLL -H ldap://10.34.36.170 -w 'Pass2012!' -D Amy-admin.qe -b dc=security,dc=baseos,dc=qe -s sub '*' | grep -i `hostname -s`
dn: CN=X86-64-V08,CN=Computers,DC=security,DC=baseos,DC=qe
cn: X86-64-V08
distinguishedName: CN=X86-64-V08,CN=Computers,DC=security,DC=baseos,DC=qe
name: X86-64-V08
sAMAccountName: X86-64-V08$
dNSHostName: x86-64-v08.lab.eng.brq.redhat.com
servicePrincipalName: RestrictedKrbHost/x86-64-v08.lab.eng.brq.redhat.com
servicePrincipalName: RestrictedKrbHost/X86-64-V08
servicePrincipalName: HOST/x86-64-v08.lab.eng.brq.redhat.com
servicePrincipalName: HOST/X86-64-V08
# 
# adcli delete-computer --verbose --domain security.baseos.qe --domain-realm SECURITY.BASEOS.QE --login-user Amy-admin `hostname`
 * Using domain name: security.baseos.qe
 * Calculated computer account name from fqdn: X86-64-V08
 * Using domain realm: security.baseos.qe
 * Discovering domain controllers: _ldap._tcp.security.baseos.qe
 * Sending cldap pings to domain controller: dc.security.baseos.qe
 * Received NetLogon info from: DC.security.baseos.qe
 * Wrote out krb5.conf snippet to /tmp/adcli-krb5-YQ0pgP/krb5.d/adcli-krb5-conf-VHOOFU
Password for Amy-admin.QE: 
 * Authenticated as user: Amy-admin.QE
 * Looked up short domain name: SECURITY
 * Using fully qualified name: x86-64-v08.lab.eng.brq.redhat.com
 * Using domain name: security.baseos.qe
 * Using computer account name: X86-64-V08
 * Using domain realm: security.baseos.qe
 * Using fully qualified name: x86-64-v08.lab.eng.brq.redhat.com
 * Enrolling computer account name calculated from fqdn: X86-64-V08
 * Found computer account for X86-64-V08$ at: CN=X86-64-V08,CN=Computers,DC=security,DC=baseos,DC=qe
 * Deleted computer account at: CN=X86-64-V08,CN=Computers,DC=security,DC=baseos,DC=qe
# ldapsearch -x -LLL -H ldap://10.34.36.170 -w 'Pass2012!' -D Amy-admin.qe -b dc=security,dc=baseos,dc=qe -s sub '*' | grep -i `hostname -s`
#

Comment 3 Stef Walter 2013-08-12 13:00:56 UTC
Hmmm. I think you need to use adcli 0.7.2 or later. I released these two together. Did adcli 0.7.2 not make it into RHEL 7.0?

Comment 4 Patrik Kis 2013-08-12 15:05:21 UTC
(In reply to Stef Walter from comment #3)
> Hmmm. I think you need to use adcli 0.7.2 or later. I released these two
> together. Did adcli 0.7.2 not make it into RHEL 7.0?

Oh, yes, I should have tried that, it just looked like pure realmd problem.
I'll check with the newest adcli.

Comment 6 Ludek Smid 2014-06-13 09:33:01 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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