Bug 737581

Summary: ipa host-add Allowed to add host - hostname trailing space
Product: Red Hat Enterprise Linux 6 Reporter: Jenny Severance <jgalipea>
Component: ipaAssignee: Rob Crittenden <rcritten>
Status: CLOSED ERRATA QA Contact: Chandrasekar Kannan <ckannan>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 6.1CC: benl, grajaiya, mkosek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-2.1.2-1.el6 Doc Type: Bug Fix
Doc Text:
Cause: A new Host is added to IPA server without proper validation Consequence: A Host with invalid hostname may be created. For example a hostname containing a white-space character Fix: Always check if the new Host has a valid hostname and return an error otherwise Result: Only Hosts with valid hostnames may be added.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 18:31:15 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 Jenny Severance 2011-09-12 15:45:54 UTC
Description of problem:

especially from the UI, since someone may mistype.

From the UI or from the CLI, add a host where the hostname has a trailing space ...

ipa host-add "myhost .testrelm"



Version-Release number of selected component (if applicable):
ipa-server-2.1.1-1.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. see description
2.
3.
  
Actual results:

host added successfully

Expected results:

ipa: ERROR: invalid 'hostname': Leading and trailing spaces are not allowed

Additional info:

Comment 2 Rob Crittenden 2011-09-12 17:08:36 UTC
https://fedorahosted.org/freeipa/ticket/1780

hostnames should be limited to a-z, 0-9 and -. 

The error message you will receive will be something like "invalid 'fqdn': may only include letters, numbers and -.

There is a maximum length of 255.

Comment 6 Martin Kosek 2011-11-01 11:57:34 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: A new Host is added to IPA server without proper validation
Consequence: A Host with invalid hostname may be created. For example a hostname containing a white-space character
Fix: Always check if the new Host has a valid hostname and return an error otherwise
Result: Only Hosts with valid hostnames may be added.

Comment 7 Gowrishankar Rajaiyan 2011-11-03 06:12:12 UTC
From cli:
[root@decepticons ~]# ipa host-add "myhost .testrelm"
ipa: ERROR: invalid 'hostname': may only include letters, numbers, and -
[root@decepticons ~]# 


From webui:
IPA Error 3009
invalid 'hostname': may only include letters, numbers, and -

error_log:
[Thu Nov 03 11:37:14 2011] [error] ipa: INFO: admin.PNQ.REDHAT.COM: host_add(u'my host.lab.eng.pnq.redhat.com', force=u'false', ip_address=u'10.10.10.10'): ValidationError

Verified in version:

Name        : ipa-server                   Relocations: (not relocatable)
Version     : 2.1.3                             Vendor: Red Hat, Inc.
Release     : 8.el6                         Build Date: Wed 02 Nov 2011 03:21:27 AM IST
Install Date: Thu 03 Nov 2011 10:13:53 AM IST      Build Host: x86-012.build.bos.redhat.com
Group       : System Environment/Base       Source RPM: ipa-2.1.3-8.el6.src.rpm
Size        : 3381421                          License: GPLv3+
Signature   : (none)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL         : http://www.freeipa.org/
Summary     : The IPA authentication server

Comment 8 errata-xmlrpc 2011-12-06 18:31:15 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