Bug 1184402

Summary: imuxsock doesn't respect hostname parameter
Product: Red Hat Enterprise Linux 7 Reporter: Petr Lautrbach <plautrba>
Component: rsyslogAssignee: Tomas Heinrich <theinric>
Status: CLOSED ERRATA QA Contact: Stanislav Zidek <szidek>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: ksrot, mmarusic, pvrabec, szidek, theinric
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 14:30:12 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:

Description Petr Lautrbach 2015-01-21 10:07:23 UTC
Description of problem:

    # find /mnt/chroot/
    /mnt/chroot/
    /mnt/chroot/dev
    /mnt/chroot/dev/log
    /mnt/chroot/lib64
    /mnt/chroot/lib64/libdl.so.2
    /mnt/chroot/lib64/libc.so.6
    /mnt/chroot/lib64/ld-linux-x86-64.so.2
    /mnt/chroot/lib64/libtinfo.so.5
    /mnt/chroot/lib64/libselinux.so.1
    /mnt/chroot/lib64/libcap.so.2
    /mnt/chroot/lib64/libacl.so.1
    /mnt/chroot/lib64/libpcre.so.1
    /mnt/chroot/lib64/liblzma.so.5
    /mnt/chroot/lib64/libattr.so.1
    /mnt/chroot/lib64/libpthread.so.0
    /mnt/chroot/bin
    /mnt/chroot/bin/bash
    /mnt/chroot/bin/logger
    /mnt/chroot/bin/ls
     
    # grep /mnt/chroot/dev/log /etc/rsyslog.conf
    input(type="imuxsock" HostName="chroot" Socket="/mnt/chroot/dev/log" CreatePath="on")
     
    # systemctl restart rsyslog
     
    # chroot /mnt/chroot/
    bash-4.2# /bin/logger this is a chroot log test
    bash-4.2# exit
     
    # grep "this is a chroot log test" /var/log/messages
    Jan 21 10:57:08 plautrba-rhel-7 logger: this is a chroot log test

I believe there should be "chroot" instead of "plautrba-rhel-7" in the log line.

Version-Release number of selected component (if applicable):
rsyslog-7.4.7-7.el7_0.x86_64

How reproducible:
always

Comment 2 Tomas Heinrich 2015-01-21 13:50:04 UTC
Reproduced.

I've tried a variety of versions and the behavior is pretty inconsistent.
- rsyslog-5.8.10-10.el6_6
  old syntax - works as expected
- rsyslog7-7.4.10-3.el6_6
  old syntax - strange bug with mangled hostname
  new syntax - works as expected
- rsyslog-7.4.7-6.el7.x86_64
  old syntax - strange bug with mangled hostname
  new syntax - doesn't change hostname
- rsyslog-7.4.10-3.fc20.x86_64
  old syntax - doesn't change hostname
  new syntax - works as expected


@QE:
I guess it'd be good to test both syntaxes. Here are the respective configurations:

--- 8< ---
module(load="imuxsock" syssock.use="on" syssock.name="/tmp/rs.sock.sys")
input(type="imuxsock" hostname="chroot" socket="/tmp/rs.sock.chroot")
--- 8< ---
$Modload imuxsock
$SystemLogSocketName /tmp/rs.sock.sys
$InputUnixListenSocketHostName chroot
$AddUnixListenSocket /tmp/rs.sock.chroot
--- 8< ---

setenforce 0
systemctl restart rsyslog
logger -du /tmp/rs.sock.chroot harharhar
grep harharhar /var/log/messages

Comment 3 Tomas Heinrich 2015-04-12 08:28:03 UTC
- rsyslog-8.8.0-3.fc23.x86_64
  old syntax - strange bug with mangled hostname
  new syntax - works as expected

This version even crashes during shutdown with the old syntax.

We should fix this before it bites somebody.

Comment 8 errata-xmlrpc 2015-11-19 14:30:12 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.

https://rhn.redhat.com/errata/RHBA-2015-2173.html

Comment 9 Tomas Heinrich 2016-08-09 13:48:28 UTC
*** Bug 1237051 has been marked as a duplicate of this bug. ***