Bug 723443 - SELinux is preventing /bin/bash from 'read' accesses on the fichier /root/.bash_history.
Summary: SELinux is preventing /bin/bash from 'read' accesses on the fichier /root/.ba...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: rawhide
Hardware: i386
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:d7b7a1710fd...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-20 07:26 UTC by Sylvain Arth
Modified: 2011-07-20 11:58 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-20 11:58:06 UTC
Type: ---


Attachments (Terms of Use)

Description Sylvain Arth 2011-07-20 07:26:46 UTC
SELinux is preventing /bin/bash from 'read' accesses on the fichier /root/.bash_history.

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that bash should be allowed read access on the .bash_history file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep bash /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                root:staff_r:staff_t:s0
Target Context                system_u:object_r:admin_home_t:s0
Target Objects                /root/.bash_history [ file ]
Source                        bash
Source Path                   /bin/bash
Port                          <Inconnu>
Host                          (removed)
Source RPM Packages           bash-4.2.10-4.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-34.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 2.6.38.8-32.fc15.i686 #1
                              SMP Mon Jun 13 20:01:50 UTC 2011 i686 i686
Alert Count                   1
First Seen                    mer. 20 juil. 2011 09:15:36 CEST
Last Seen                     mer. 20 juil. 2011 09:15:36 CEST
Local ID                      f201ec49-89e5-4659-8adf-f866c608f977

Raw Audit Messages
type=AVC msg=audit(1311146136.945:189): avc:  denied  { read } for  pid=3261 comm="bash" name=".bash_history" dev=dm-0 ino=1573146 scontext=root:staff_r:staff_t:s0 tcontext=system_u:object_r:admin_home_t:s0 tclass=file


type=AVC msg=audit(1311146136.945:189): avc:  denied  { open } for  pid=3261 comm="bash" name=".bash_history" dev=dm-0 ino=1573146 scontext=root:staff_r:staff_t:s0 tcontext=system_u:object_r:admin_home_t:s0 tclass=file


type=SYSCALL msg=audit(1311146136.945:189): arch=i386 syscall=open success=yes exit=ESRCH a0=81da7a8 a1=8000 a2=0 a3=3e8 items=0 ppid=3251 pid=3261 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=1 comm=bash exe=/bin/bash subj=root:staff_r:staff_t:s0 key=(null)

Hash: bash,staff_t,admin_home_t,file,read

audit2allow

#============= staff_t ==============
allow staff_t admin_home_t:file { read open };

audit2allow -R

#============= staff_t ==============
allow staff_t admin_home_t:file { read open };

Comment 1 Miroslav Grepl 2011-07-20 11:58:06 UTC
You are not able switch to root user as staff SELinux user in enforcing mode. 

You can setup sudo for example

mgrepl ALL=(ALL) TYPE=unconfined_t ROLE=unconfined_r /bin/sh

which will cause if you run

# sudo sh

as staff_u:staff_r:staff_t

You will end up as unconfined_t.

Or

mgrepl ALL=(ALL) ROLE=sysadm_r TYPE=sysadm_t ALL
mgrepl ALL=(ALL) TYPE=unconfined_t ROLE=unconfined_r /bin/sh


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