Bug 845073 - rlFileBackup function causes incorrect selinux context in /etc and /var
rlFileBackup function causes incorrect selinux context in /etc and /var
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: beakerlib (Show other bugs)
17
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Petr Muller
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-01 12:24 EDT by Aleš Mareček
Modified: 2016-09-19 22:09 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-02 05:24:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Aleš Mareček 2012-08-01 12:24:14 EDT
Description of problem:
rlFileBackup function causes incorrect selinux context in /etc and /var that causes system malfunction.

Version-Release number of selected component (if applicable):
beakerlib-1.6-1.el6eso.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create simple Beaker test using rlFileBackup function and make sure that SELinux is on (setenforce 1)
2. Put following line into your crontab (crontab -e -u root)
* * * * * /root/my-simple-test/runtest.sh >/tmp/bah 2>&1
3. Wait a minute
4. grep "selinuxenabled" /tmp/bah
5. passwd

Actual results:
ad 4) /usr/share/beakerlib//plugins/try-check-final.sh: line 571: selinuxenabled: command not found
ad 5) 
Changing password for user root.
passwd: Authentication token manipulation error

Expected results:
Work snoothly

Additional info:
The passwd command fails because of incorect selinux context of /etc (selinux context of /var is garbled also)
Comment 1 Petr Muller 2012-08-02 04:15:32 EDT
(In reply to comment #0)
> Actual results:
> ad 4) /usr/share/beakerlib//plugins/try-check-final.sh: line 571:
> selinuxenabled: command not found
> ad 5) 
> Changing password for user root.
> passwd: Authentication token manipulation error
> 
> Expected results:
> Work snoothly
> 
> Additional info:
> The passwd command fails because of incorect selinux context of /etc
> (selinux context of /var is garbled also)

1) Does this occur even without the 'try-check-final.sh' plugin (whatever that is, it's not part of beakerlib)?

2) 'selinuxenabled: command not found' suggests the box is broken, as this is a binary which should be installed by default on any RHEL6 box (the appropriate package depends on anaconda, which means it would need to be explicitly removed from the system).
Comment 2 Petr Muller 2012-08-02 05:24:37 EDT
# cat trivial.sh 
#!/bin/bash

echo "PATH: [$PATH]"
[root@nec-em29 ~]# crontab -l
* * * * * /root/trivial.sh >/tmp/bah 2>&1
[root@nec-em29 ~]# cat /tmp/bah 
PATH: [/usr/bin:/bin]

So it seems things run as cron jobs do not have {,/usr}/sbin paths in them. I do not know whether that is intentional or not, but it's not a bug in beakerlib.
Comment 3 Petr Muller 2012-08-02 05:25:26 EDT
> So it seems things run as cron jobs do not have {,/usr}/sbin paths in them.

That should say ... in their $PATH
Comment 4 Aleš Mareček 2012-08-02 09:38:35 EDT
Petr, you're absolutely right. I haven't found any "bug" for this case in beakerlib code and setting the PATH variable in cron to use *sbin* works.
I wonder why root's PATH doesn't have *sbin* set.
Thanks!

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