Bug 822174

Summary: hostname handling needs sanity improvement
Product: Red Hat Enterprise Linux 6 Reporter: David Kutálek <dkutalek>
Component: sosAssignee: Bryn M. Reeves <bmr>
Status: CLOSED ERRATA QA Contact: David Kutálek <dkutalek>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2CC: agk, bmr, gavin, prc
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sos-2.2-30.el6 Doc Type: Bug Fix
Doc Text:
Cause: Previous versions of sos did not sanitize the system hostname for forbidden characters when using the name in file system paths. Consequence: Inserting path separators and other special characters in the system hostname would cause sos to generate invalid file system paths and fail to generate a report. Fix: Invalid characters are now filtered out of the system hostname. Result: The sosreport command now works correctly on systems having characters disallowed in file system paths present in the hostname.
Story Points: ---
Clone Of:
: 976242 (view as bug list) Environment:
Last Closed: 2013-02-21 10:57:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 976242    

Description David Kutálek 2012-05-16 14:38:59 UTC
Description of problem:

When there is no rhn systemid and --name parameter was not used, hostname is used as a part of sosreport tarball name. sosreport should handle this hostname more carefully to handle wrong hostnames in a sane way. 

# hostname 'f/t_u-r:!§@#$%^&gt;._ha_*()=+"`;/\?~|}{][hěščÁŤďh hh'
# sosreport --batch -o general

sosreport (version 2.2)

This utility will collect some detailed  information about the
hardware and setup of your Red Hat Enterprise Linux system.
The information is collected and an archive is  packaged under
/tmp, which you can send to a support representative.
Red Hat Enterprise Linux will use this information for diagnostic purposes ONLY
and it will be considered confidential information.

This process may take a while to complete.
No changes will be made to your system.


  Running plugins. Please wait ...

  Completed [1/1] ...      /bin/sh: gt: command not found
/bin/sh: -2012051614411337172088: command not found
/bin/tar: t_u-r\:!§@#$%^: Cannot stat: No such file or directory
/bin/tar: Exiting with failure status due to previous errors
sh: gt: command not found
sh: -2012051614411337172088: command not found

Creating compressed archive...

Your sosreport has been generated and saved in:
  /tmp/f/sosreport-ftu-rgt-20120516144129-e888.tar.xz

The md5sum is: 8dc5aea5b03dff8595f096f9e368e888

Please send this file to your support representative.
---


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

sos-2.2-27.el6.noarch

How reproducible:

Always

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


Expected results:


Additional info:

Comment 1 RHEL Program Management 2012-07-10 08:46:47 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 2 RHEL Program Management 2012-07-11 01:58:35 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 3 Bryn M. Reeves 2012-10-15 19:12:04 UTC
While I think we're unlikely to come across it very often this is potentially a bit nasty - weird characters in the hostname can cause us to go wandering off around the file system in strange ways.

I've added a filter to the hostname to only accept alphanumeric, dots, dashes and underscores. That's more strict than it really needs to be but leaves less potential for trouble.

Comment 8 errata-xmlrpc 2013-02-21 10:57:25 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/RHBA-2013-0474.html