Bug 967008 - If joined via adcli, leave --remove doesn't work
If joined via adcli, leave --remove doesn't work
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: realmd (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: beta
: ---
Assigned To: Stef Walter
Patrik Kis
:
Depends On: 961244
Blocks: 917637
  Show dependency treegraph
 
Reported: 2013-05-24 09:55 EDT by Patrik Kis
Modified: 2016-08-22 07:39 EDT (History)
1 user (show)

See Also:
Fixed In Version: realmd-0.14.3-1.el7 adcli-0.7.2.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 961244
Environment:
Last Closed: 2014-06-13 05:33:01 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Patrik Kis 2013-05-24 09:55:21 EDT
+++ 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 10:01:17 EDT
Fix pushed to realmd and adcli git master.
Comment 2 Patrik Kis 2013-08-12 08:55:13 EDT
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@SECURITY.BASEOS.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@SECURITY.BASEOS.QE: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: HOST/x86-64-v08.lab.eng.brq.redhat.com@SECURITY.BASEOS.QE: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: RestrictedKrbHost/X86-64-V08@SECURITY.BASEOS.QE: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: RestrictedKrbHost/x86-64-v08.lab.eng.brq.redhat.com@SECURITY.BASEOS.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@security.baseos.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@security.baseos.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@SECURITY.BASEOS.QE: 
 * Authenticated as user: Amy-admin@SECURITY.BASEOS.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@security.baseos.qe -b dc=security,dc=baseos,dc=qe -s sub '*' | grep -i `hostname -s`
#
Comment 3 Stef Walter 2013-08-12 09:00:56 EDT
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 11:05:21 EDT
(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 05:33:01 EDT
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.