Red Hat Bugzilla – Bug 1370457
Make sure samba membership-software can use manually set NetBIOS name during 'realm leave --remove'
Last modified: 2018-10-30 07:02:11 EDT
Description of problem: Currently when using the Samba membership software (default with RHEL) a manually set computer name (NetBIOS name) which differs from the first part of the DNS hostname must be added to /etc/realmd.conf to be able to remove the host entry properly in AD while leaving the domain. See comments #10 and #11 in https://bugzilla.redhat.com/show_bug.cgi?id=1293390 for details. It would be nice if realmd can determine the right name by parsing /etc/krb5.keytab and providing it to the Samba mebership software.
Tested on Red Hat Enterprise Linux Client release 7.6 Beta (Maipo) using realmd-0.16.1-11.el7.x86_64 and Windows 2016 AD enviornment. ====Scenario1 (hostname with more than 15 characters==== [root@ipaclientfin03454 #]hostname ipaclientfin03454.ipaad2016.test [root@ipaclientfin03454 log]# realm -v join --user=administrator --client-software=sssd --membership-software=samba idm-qe-ipa-ci1.ipaad2016.test * Resolving: _ldap._tcp.idm-qe-ipa-ci1.ipaad2016.test * Resolving: idm-qe-ipa-ci1.ipaad2016.test * Performing LDAP DSE lookup on: * Successfully discovered: ipaad2016.test Password for administrator: * Required files: /usr/sbin/oddjobd, /usr/libexec/oddjob/mkhomedir, /usr/sbin/sssd, /usr/bin/net * Joining using a truncated netbios name: IPACLIENTFIN034 * LANG=C LOGNAME=root /usr/bin/net -s /var/cache/realmd/realmd-smb-conf.4AFPOZ -S idm-qe-ipa-ci1.ipaad2016.test -U administrator ads join ipaad2016.test Enter administrator's password: DNS update failed: NT_STATUS_INVALID_PARAMETER Using short domain name -- IPAAD2016 Joined 'IPACLIENTFIN034' to dns domain 'ipaad2016.test' No DNS domain configured for ipaclientfin034. Unable to perform DNS Update. * LANG=C LOGNAME=root /usr/bin/net -s /var/cache/realmd/realmd-smb-conf.4AFPOZ -S idm-qe-ipa-ci1.ipaad2016.test -U administrator ads keytab create Enter administrator's password:Secret123 * /usr/bin/systemctl enable sssd.service Created symlink from /etc/systemd/system/multi-user.target.wants/sssd.service to /usr/lib/systemd/system/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 && /usr/bin/systemctl start oddjobd.service * Successfully enrolled machine in realm [root@ipaclientfin03454 log]# ldapsearch -x -LLL -H ldap://idm-qe.ipaad2016.test -w '***' -D administrator@ipaad2016.test -b CN=ipaclientfin034,CN=Computers,dc=ipaad2016,dc=test -s sub '*' dn: CN=IPACLIENTFIN034,CN=Computers,DC=ipaad2016,DC=test objectClass: top objectClass: person objectClass: organizationalPerson objectClass: user objectClass: computer cn: IPACLIENTFIN034 distinguishedName: CN=IPACLIENTFIN034,CN=Computers,DC=ipaad2016,DC=test instanceType: 4 whenCreated: 20180903122842.0Z whenChanged: 20180903122853.0Z uSNCreated: 406778 uSNChanged: 406784 name: IPACLIENTFIN034 objectGUID:: AdbnXpi+wkirzjAN0nRtoA== userAccountControl: 69632 badPwdCount: 0 codePage: 0 countryCode: 0 badPasswordTime: 0 lastLogoff: 0 lastLogon: 131804513677918269 localPolicyFlags: 0 pwdLastSet: 131804513243582646 primaryGroupID: 515 objectSid:: AQUAAAAAAAUVAAAANxZ3MMMmdt5x1jFfBSMAAA== accountExpires: 9223372036854775807 logonCount: 3 sAMAccountName: IPACLIENTFIN034$ sAMAccountType: 805306369 dNSHostName: ipaclientfin034.ipaad2016.test servicePrincipalName: HOST/ipaclientfin034.ipaad2016.test servicePrincipalName: HOST/IPACLIENTFIN034 objectCategory: CN=Computer,CN=Schema,CN=Configuration,DC=ipaad2016,DC=test isCriticalSystemObject: FALSE dSCorePropagationData: 16010101000000.0Z lastLogonTimestamp: 131804513334025471 msDS-SupportedEncryptionTypes: 31 [root@ipaclientfin03454 log]# realm -v leave --remove --user=administrator Password for administrator: * LANG=C LOGNAME=root /usr/bin/net -s /var/cache/realmd/realmd-smb-conf.SC6EOZ -S idm-qe-ipa-ci1.ipaad2016.test -U administrator ads leave Enter administrator's password:*** Deleted account for 'IPACLIENTFIN034' in realm 'IPAAD2016.TEST' * Removing entries from keytab for realm * /usr/sbin/sss_cache --users --groups --netgroups --services --autofs-maps No cache object matched the specified search ! Flushing the sssd cache failed * Removing domain configuration from sssd.conf * /usr/sbin/authconfig --update --disablesssdauth --nostart * /usr/bin/systemctl disable sssd.service Removed symlink /etc/systemd/system/multi-user.target.wants/sssd.service. * /usr/bin/systemctl stop sssd.service * Successfully unenrolled machine from realm [root@ipaclientfin03454 log]# ldapsearch -x -LLL -H ldap://idm-qe.ipaad2016.test -w '***' -D administrator@ipaad2016.test -b CN=ipaclientfin03454,CN=Computers,dc=ad,dc=ipaad2016,dc=test -s sub '*' No such object (32) Matched DN: DC=ipaad2016,DC=test Additional information: 0000208D: NameErr: DSID-03100241, problem 2001 (NO_OBJECT), data 0, best match of: 'DC=ipaad2016,DC=test' [root@ipaclientfin03454 log]# ldapsearch -x -LLL -H ldap://idm-qe.ipaad2016.test -w '***' -D administrator@ipaad2016.test -b CN=ipaclientfin034,CN=Computers,dc=ipaad2016,dc=test -s sub '*' No such object (32) Matched DN: CN=Computers,DC=ipaad2016,DC=test Additional information: 0000208D: NameErr: DSID-03100241, problem 2001 (NO_OBJECT), data 0, best match of: 'CN=Computers,DC=ipaad2016,DC=test' ==== Scenario2 using computer-name option === [root@ipaclientfin03454 ~]# realm -v join --user=administrator --client-software=sssd --membership-software=samba --computer-name=bz1370457 idm-qe-ipa-ci1.ipaad2016.test * Resolving: _ldap._tcp.idm-qe-ipa-ci1.ipaad2016.test * Resolving: idm-qe-ipa-ci1.ipaad2016.test * Performing LDAP DSE lookup on: * Successfully discovered: ipaad2016.test Password for administrator: * Required files: /usr/sbin/oddjobd, /usr/libexec/oddjob/mkhomedir, /usr/sbin/sssd, /usr/bin/net * Joining using a manual netbios name: bz1370457 * LANG=C LOGNAME=root /usr/bin/net -s /var/cache/realmd/realmd-smb-conf.PFGKOZ -S idm-qe-ipa-ci1.ipaad2016.test -U administrator ads join ipaad2016.test Enter administrator's password: DNS update failed: NT_STATUS_INVALID_PARAMETER Using short domain name -- IPAAD2016 Joined 'BZ1370457' to dns domain 'ipaad2016.test' No DNS domain configured for bz1370457. Unable to perform DNS Update. * LANG=C LOGNAME=root /usr/bin/net -s /var/cache/realmd/realmd-smb-conf.PFGKOZ -S idm-qe-ipa-ci1.ipaad2016.test -U administrator ads keytab create Enter administrator's password: * /usr/bin/systemctl enable sssd.service Created symlink from /etc/systemd/system/multi-user.target.wants/sssd.service to /usr/lib/systemd/system/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 && /usr/bin/systemctl start oddjobd.service * Successfully enrolled machine in realm [root@ipaclientfin03454 ~]# ldapsearch -x -LLL -H ldap://idm-qe.ipaad2016.test -w '***' -D administrator@ipaad2016.test -b CN=bz1370457,CN=Computers,dc=ipaad2016,dc=test -s sub '*' dn: CN=BZ1370457,CN=Computers,DC=ipaad2016,DC=test objectClass: top objectClass: person objectClass: organizationalPerson objectClass: user objectClass: computer cn: BZ1370457 distinguishedName: CN=BZ1370457,CN=Computers,DC=ipaad2016,DC=test instanceType: 4 whenCreated: 20180903140130.0Z whenChanged: 20180903140145.0Z uSNCreated: 407280 uSNChanged: 407286 name: BZ1370457 objectGUID:: va0OlMKNyECZlJIFUCVACg== userAccountControl: 69632 badPwdCount: 0 codePage: 0 countryCode: 0 badPasswordTime: 0 lastLogoff: 0 lastLogon: 131804569406673518 localPolicyFlags: 0 pwdLastSet: 131804568920262681 primaryGroupID: 515 objectSid:: AQUAAAAAAAUVAAAANxZ3MMMmdt5x1jFfGiMAAA== accountExpires: 9223372036854775807 logonCount: 3 sAMAccountName: BZ1370457$ sAMAccountType: 805306369 dNSHostName: bz1370457.ipaad2016.test servicePrincipalName: HOST/bz1370457.ipaad2016.test servicePrincipalName: HOST/BZ1370457 objectCategory: CN=Computer,CN=Schema,CN=Configuration,DC=ipaad2016,DC=test isCriticalSystemObject: FALSE dSCorePropagationData: 16010101000000.0Z lastLogonTimestamp: 131804569058866207 msDS-SupportedEncryptionTypes: 31 [root@ipaclientfin03454 ~]# realm -v leave --remove --user=administrator Password for administrator: * LANG=C LOGNAME=root /usr/bin/net -s /var/cache/realmd/realmd-smb-conf.XYMBOZ -S idm-qe-ipa-ci1.ipaad2016.test -U administrator ads leave Enter administrator's password: Deleted account for 'BZ1370457' in realm 'IPAAD2016.TEST' * Removing entries from keytab for realm * /usr/sbin/sss_cache --users --groups --netgroups --services --autofs-maps No cache object matched the specified search ! Flushing the sssd cache failed * Removing domain configuration from sssd.conf * /usr/sbin/authconfig --update --disablesssdauth --nostart * /usr/bin/systemctl disable sssd.service Removed symlink /etc/systemd/system/multi-user.target.wants/sssd.service. * /usr/bin/systemctl stop sssd.service * Successfully unenrolled machine from realm [root@ipaclientfin03454 ~]# ldapsearch -x -LLL -H ldap://idm-qe.ipaad2016.test -w '***' -D administrator@ipaad2016.test -b CN=bz1370457,CN=Computers,dc=ipaad2016,dc=test -s sub '*' No such object (32) Matched DN: CN=Computers,DC=ipaad2016,DC=test Additional information: 0000208D: NameErr: DSID-03100241, problem 2001 (NO_OBJECT), data 0, best match of: 'CN=Computers,DC=ipaad2016,DC=test'
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/RHBA-2018:3190