Bug 714919 - ipa-client-install should configure hostname
Summary: ipa-client-install should configure hostname
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: ipa
Version: 6.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Rob Crittenden
QA Contact: Chandrasekar Kannan
URL:
Whiteboard:
Depends On:
Blocks: 748554
TreeView+ depends on / blocked
 
Reported: 2011-06-21 10:36 UTC by Marko Myllynen
Modified: 2015-01-04 23:49 UTC (History)
7 users (show)

Fixed In Version: ipa-2.1.3-1.el6
Doc Type: Bug Fix
Doc Text:
Cause: ipa-client-install should configure hostname in /etc/sysconfig/network. Consequence: If the --hostname value is passed to the client installer that name is used during enrollment but the system host name may not match the name of the machine. Fix: Update /etc/sysconfig/network and execute /bin/hostname with the host name of the machine. Result: The name used in enrollment matches the host name of the machine.
Clone Of:
Environment:
Last Closed: 2011-12-06 18:36:13 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:1533 normal SHIPPED_LIVE Moderate: ipa security and bug fix update 2011-12-06 01:23:31 UTC

Description Marko Myllynen 2011-06-21 10:36:17 UTC
Description of problem:
When enrolling a client which has been previously installed and set up to use DHCP, the client's hostname can be more or less anything. Using ipa-client-install --hostname sets the hostname for the client at the server but leaves the client's /etc/sysconfig/network unmodified which might cause the client to use a DHCP provided hostname which will be in conflict with the hostname configured on the master side.

ipa-client-install should at least optionally configure /etc/sysconfig/network to use the hostname specified with --hostname.

Version-Release number of selected component (if applicable):
RHEL 6.1

Comment 2 Dmitri Pal 2011-06-21 21:10:44 UTC
https://fedorahosted.org/freeipa/ticket/1368

Comment 3 Martin Kosek 2011-07-29 14:27:33 UTC
Fixed upstream:
master: https://fedorahosted.org/freeipa/changeset/a22d00234f94f825d5ff2b6af6e94ce11f98c753

Comment 6 Marko Myllynen 2011-09-22 05:58:14 UTC
In https://bugzilla.redhat.com/show_bug.cgi?id=734013#c8 there is a test run where --hostname is not used and /etc/sysconfig/network is left with HOSTNAME=localhost.localdomain.

What happens if the client's IP changes, will its hostname be changed then, too? I think ipa-client-install should have updated /etc/sysconfig/network also without --hostname.

Thanks.

Comment 7 Rob Crittenden 2011-09-22 12:24:47 UTC
Where would this hostname come from? If by definition HOSTNAME is locahost.localdomain and the network is DHCP where would the hostname come from?

Comment 8 Marko Myllynen 2011-09-22 12:34:24 UTC
That is a good question - if you have IP provided based on the MAC address then you should always get also the same hostname and there shouldn't be any issues.

However, if one is enrolling a client with dynamic hostname it will sooner or later boot up with a different hostname than it was registered with and this might lead to unexpected behaviour.

Perhaps ipa-client-install should at least print out a warning in case of enrolling with dynamic hostname and --hostname not used?

Comment 9 Alexander Bokovoy 2011-09-22 13:34:27 UTC
How can we identify that the hostname is a dynamic one?

1. HOSTNAME=localhost.localdomain in /etc/sysconfig/network + real hostname != localhost.localdomain would give us this assumption (NM or dhclient set the hostname)
2. HOSTNAME absent from /etc/sysconfig/network would not mean anything.
3. HOSTNAME != localhost.localdomain and not equal actual host's hostname does not mean DHCP neccessarily.

Comment 10 Marko Myllynen 2011-09-22 13:46:05 UTC
I'd say if in doubt, print a note. Better safe than sorry.

Comment 11 Marko Myllynen 2011-09-26 09:43:20 UTC
https://fedorahosted.org/freeipa/ticket/1871

Comment 12 Jenny Severance 2011-10-05 20:39:11 UTC
Pre ipa-client-install

# hostname
nec-em24-3.rhts.eng.bos.redhat.com

# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=nec-em24-3.rhts.eng.bos.redhat.com

# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6


client install 

# ipa-client-install --hostname ipaclient.jgalipea.redhat.com
DNS domain 'jgalipea' is not configured for automatic KDC address lookup.
KDC address will be set to fixed value.

Discovery was successful!
Hostname: ipaclient.jgalipea.redhat.com
Realm: JGALIPEA
DNS Domain: jgalipea.redhat.com
IPA Server: ipaserver.jgalipea.redhat.com
BaseDN: dc=jgalipea


Continue to configure the system with these values? [no]: yes
Failed to set permissions for /etc/sysconfig/network (Command '/sbin/restorecon /etc/sysconfig/network' returned non-zero exit status 1).
User authorized to enroll computers: admin
Password for admin@JGALIPEA: 

Enrolled in IPA realm JGALIPEA
Created /etc/ipa/default.conf
Configured /etc/sssd/sssd.conf
Configured /etc/krb5.conf for IPA realm JGALIPEA
SSSD enabled
Kerberos 5 enabled
NTP enabled
Client configuration complete.


post ipa-client-install

# hostname
ipaserver.jgalipea.redhat.com

# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=ipaclient.jgalipea.redhat.com


# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6


version ::
ipa-server-2.1.1-4.el6.x86_64
ipa-client-2.1.1-4.el6.x86_64

Comment 13 Rob Crittenden 2011-10-12 15:33:51 UTC
Marko discovered that if HOSTNAME does not exist in /etc/sysconfig/network then the previous code would fail to add it.

Fixed upstream in 

master: 8badce286f9e50384b68e0f5e77e314fd48363db

ipa-2-1: b17dfe4a8623e8c3e88c424ddaf7ad664c97898b

Comment 14 Marko Myllynen 2011-10-13 10:08:20 UTC
I think for the time being the case described in comment 18 should at least be documented:

https://fedorahosted.org/freeipa/ticket/1967

Comment 15 Marko Myllynen 2011-10-13 10:09:18 UTC
(In reply to comment #14)
> I think for the time being the case described in comment 18

Meant comment 8 of course.

Comment 16 Rob Crittenden 2011-10-31 20:23:51 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: ipa-client-install should configure hostname in /etc/sysconfig/network.
Consequence: If the --hostname value is passed to the client installer that name is used during enrollment but the system host name may not match the name of the machine.
Fix: Update /etc/sysconfig/network and execute /bin/hostname with the host name of the machine.
Result: The name used in enrollment matches the host name of the machine.

Comment 17 Namita Soman 2011-11-04 16:14:45 UTC
verified using ipa-client-2.1.3-8.el6.x86_64

ran:
/etc/sysconfig/network does not have HOSTNAME before install:
[root@ipa-replica2 ~]# cat /etc/sysconfig/network
NETWORKING=yes


Installed client:
[root@ipa-replica2 ~]# ipa-client-install --hostname=ipa-client1.testrelm -p admin -w Secret123 --server=ipa-master.testrelm --domain=testrelm
Discovery was successful!
Hostname: ipa-client1.testrelm
Realm: TESTRELM
DNS Domain: testrelm
IPA Server: ipa-master.testrelm
BaseDN: dc=testrelm


Continue to configure the system with these values? [no]: y
Synchronizing time with KDC...

Enrolled in IPA realm TESTRELM
Created /etc/ipa/default.conf
Configured /etc/sssd/sssd.conf
Configured /etc/krb5.conf for IPA realm TESTRELM
Warning: Hostname (ipa-client1.testrelm) not found in DNS
DNS server record set to: ipa-client1.testrelm -> 10.16.18.91
SSSD enabled
NTP enabled
Client configuration complete.

After install, checked:
[root@ipa-replica2 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=ipa-client1.testrelm

[root@ipa-replica2 ~]# hostname
ipa-client1.testrelm

Comment 18 errata-xmlrpc 2011-12-06 18:36:13 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-2011-1533.html


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