Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 817869

Summary: Clean keytabs before installing new keys into them
Product: Red Hat Enterprise Linux 6 Reporter: Dmitri Pal <dpal>
Component: ipaAssignee: Rob Crittenden <rcritten>
Status: CLOSED ERRATA QA Contact: Namita Soman <nsoman>
Severity: unspecified Docs Contact:
Priority: high    
Version: 6.3CC: jgalipea, ksiddiqu, mgregg, mkosek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-3.0.0-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 09:12:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dmitri Pal 2012-05-01 16:17:25 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/freeipa/ticket/2698

In ipa-client-install and perhaps the server/replica installation we should consider running ipa-rmkeytab -k <keytab> -r $REALM to be sure that there aren't any remnants from a previous install of IPA or another KDC altogether.

Comment 1 Martin Kosek 2012-06-11 12:46:00 UTC
Fixed upstream:
master: https://fedorahosted.org/freeipa/changeset/3e3ac0ebabb5db25f9179b16ca8b4967e98a82a6

ipa-client-install now removes any keys that belong to the same realm.

Comment 2 Jenny Severance 2012-06-11 16:55:42 UTC
Please add steps to verify that keys are removed.

Comment 3 Rob Crittenden 2012-06-11 17:26:54 UTC
klist -kt /etc/krb5.keytab

Should contain only current keys for the realm.

Comment 4 Martin Kosek 2012-06-12 06:29:15 UTC
To test this, you can:

1) Copy /etc/krb.keytab from master to client (it contains key for principal host/$MASTER_HOSTNAME@$REALM)
2) Run ipa-client-instal (realm is $REALM)
3) When the install is complete, "klist -kt /etc/krb5.keytab" should contain only keys for principal host/$CLIENT_HOSTNAME@$REALM

Comment 7 Kaleem 2012-11-27 10:00:06 UTC
Verified.

ipa-client version:
===================
[root@rhel64client1 ~]# rpm -q ipa-client
ipa-client-3.0.0-8.el6.x86_64
[root@rhel64client1 ~]#

Steps used to verify:
====================
(1)Copied MASTER's keytab which contains master's keys only

[root@rhel64client1 ~]# klist -kt /etc/krb5.keytab 
Keytab name: FILE:/etc/krb5.keytab
KVNO Timestamp         Principal
---- ----------------- --------------------------------------------------------
   2 11/27/12 03:48:21 host/rhel64master.testrelm.com
   2 11/27/12 03:48:21 host/rhel64master.testrelm.com
   2 11/27/12 03:48:21 host/rhel64master.testrelm.com
   2 11/27/12 03:48:21 host/rhel64master.testrelm.com
[root@rhel64client1 ~]#

(2)Performed ipa-client-install

[root@rhel64client1 ~]# ipa-client-install -p admin -w Secret123 --server=rhel64master.testrelm.com --domain=testrelm.com -U 
Hostname: rhel64client1.testrelm.com
Realm: TESTRELM.COM
DNS Domain: testrelm.com
IPA Server: rhel64master.testrelm.com
BaseDN: dc=testrelm,dc=com

Removed old keys for realm TESTRELM.COM from /etc/krb5.keytab
Synchronizing time with KDC...
Enrolled in IPA realm TESTRELM.COM
Created /etc/ipa/default.conf
Configured /etc/sssd/sssd.conf
Configured /etc/krb5.conf for IPA realm TESTRELM.COM
trying https://rhel64master.testrelm.com/ipa/xml
Hostname (rhel64client1.testrelm.com) not found in DNS
Failed to update DNS records.
Adding SSH public key from /etc/ssh/ssh_host_dsa_key.pub
Adding SSH public key from /etc/ssh/ssh_host_rsa_key.pub
Forwarding 'host_mod' to server u'http://rhel64master.testrelm.com/ipa/xml'
Could not update DNS SSHFP records.
SSSD enabled
Configured /etc/openldap/ldap.conf
Unable to find 'admin' user with 'getent passwd admin'!
Recognized configuration: SSSD
NTP enabled
Configured /etc/ssh/ssh_config
Configured /etc/ssh/sshd_config
Client configuration complete.
[root@rhel64client1 ~]# 

Following message shown while installation

"Removed old keys for realm TESTRELM.COM from /etc/krb5.keytab"

(3)Checked content of keytab file after ipa-client-install

[root@rhel64client1 ~]# klist -kt /etc/krb5.keytab 
Keytab name: FILE:/etc/krb5.keytab
KVNO Timestamp         Principal
---- ----------------- --------------------------------------------------------
   1 11/27/12 04:50:09 host/rhel64client1.testrelm.com
   1 11/27/12 04:50:09 host/rhel64client1.testrelm.com
   1 11/27/12 04:50:08 host/rhel64client1.testrelm.com
   1 11/27/12 04:50:09 host/rhel64client1.testrelm.com
[root@rhel64client1 ~]#

Keytab file does not contains keys other than client.

Comment 8 Michael Gregg 2012-12-14 03:12:39 UTC
verified with 

 
+###############################################################################################
+#  Bug 817869 - Clean keytabs before installing new keys into them
+###############################################################################################
+ipaclientinstall_dirty_keytab()
+{
+    rlPhaseStartTest "ipa-client-install-02- "
+        uninstall_fornexttest
+        #rlLog "EXECUTING: ipa-client-install --domain=$DOMAIN --realm=$RELM --ntp-server=$NTPSERVER -p $ADMINID -w $ADMINPW --unattended --server=$MASTER"
+        #rlRun "ipa-client-install --domain=$DOMAIN --realm=$RELM --ntp-server=$NTPSERVER -p $ADMINID -w $ADMINPW --unattended --server=$MASTER" 0 "Installing ipa client and configuring - with all params"
+        rlLog "EXECUTING: ipa-client-install --domain=$DOMAIN --realm=$RELM -p $ADMINID -w $ADMINPW --unattended --server=$MASTER"
+        rlRun "ipa-client-install --domain=$DOMAIN --realm=$RELM -p $ADMINID -w $ADMINPW --unattended --server=$MASTER" 0 "Installing ipa client and configuring - with all params"
+        verify_install true
+	# Backup keytab 
+	bkup="/dev/shm/ipa-client-backup-keytab"
+	ktab="/etc/krb5.keytab"
+	rm -f $bkup
+	cp -a $ktab $bkup
+	command="ipa-client-install --uninstall -U"
+	rlRun "$command" 0 "Uninstalling ipa client - after a force install"
+	if [ ! -f $ktab ]; then
+		cp -a $kbup $ktab
+	fi
+	klist -kt /etc/krb5.keytab
+        rlRun "ipa-client-install --domain=$DOMAIN --realm=$RELM -p $ADMINID -w $ADMINPW --unattended --server=$MASTER" 0 "Installing ipa client and configuring - with all params"
+        verify_install true
+
+	klist -kt /etc/krb5.keytab
+	diff $bkup $ktab
+
+    rlPhaseEnd
+}
+

Comment 10 errata-xmlrpc 2013-02-21 09:12:33 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.

http://rhn.redhat.com/errata/RHSA-2013-0528.html