Bug 619528

Summary: SELinux powstrzymuje demona HTTP przed odczytywaniem katalogów domowych użytkowników.
Product: [Fedora] Fedora Reporter: Marek Zdunek <mzdunek>
Component: selinux-policyAssignee: Daniel Walsh <dwalsh>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: deep.shah9, dwalsh, eingorn777, hobbes1069, joamorim, kwpolska, mbooth, mgrepl, pislogan, tcfxfzoi, vwfoxguru
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:7e530e5bcc83a024fff993905180e3f360a8f33a7840285476fc94dff1d938fe
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-07-29 18:52:07 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 Marek Zdunek 2010-07-29 18:18:48 UTC
Podsumowanie:

SELinux powstrzymuje demona HTTP przed odczytywaniem katalogów domowych
użytkowników.

Szczegółowy opis:

[httpd posiada typ zezwalania (httpd_t). Ten dostęp nie został odmówiony.]

SELinux odmówił demonowi HTTP dostęp do katalogów domowych użytkowników.
Ktoś próbuje uzyskać dostęp do katalogów domowych przez demona HTTP. Jeśli
nie ustawiono httpd tak, aby współdzielił katalogi domowe, prawdopodobnie
wskazuje to prób

Zezwalanie na dostęp:

Aby pozwolić demonowi HTTP na współdzielenie katalogów domowych, należy
włączyć zmienną logiczną httpd_enable_homedirs: "setsebool -P
httpd_enable_homedirs=1" Należy także nadać etykietę zawartości, która ma
zostać współdzielona. Strona podręcznika httpd_selinux dostarcza dalszych
informacji. "man

Polecenie naprawy:

setsebool -P httpd_enable_homedirs=1

Dodatkowe informacje:

Kontekst źródłowy          unconfined_u:system_r:httpd_t:s0
Kontekst docelowy             unconfined_u:object_r:user_home_dir_t:s0
Obiekty docelowe              /home/marek [ dir ]
Źródło                     httpd
Ścieżka źródłowa         /usr/sbin/httpd
Port                          <Nieznane>
Komputer                      (usunięto)
Źródłowe pakiety RPM       httpd-2.2.15-1.fc13
Docelowe pakiety RPM          
Pakiet RPM polityki           selinux-policy-3.7.19-39.fc13
SELinux jest włączony       True
Typ polityki                  targeted
Tryb wymuszania               Enforcing
Nazwa wtyczki                 httpd_enable_homedirs
Nazwa komputera               (usunięto)
Platforma                     Linux amd64 2.6.33.6-147.fc13.x86_64 #1 SMP Tue
                              Jul 6 22:32:17 UTC 2010 x86_64 x86_64
Liczba alarmów               21
Po raz pierwszy               czw, 29 lip 2010, 19:09:12
Po raz ostatni                czw, 29 lip 2010, 19:34:26
Lokalny identyfikator         1e231989-a1ef-458e-8908-60a4049c5fd8
Liczba wierszy                

Surowe komunikaty audytu      

node=amd64 type=AVC msg=audit(1280424866.82:198): avc:  denied  { search } for  pid=8669 comm="httpd" name="marek" dev=sda6 ino=1703937 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_dir_t:s0 tclass=dir

node=amd64 type=SYSCALL msg=audit(1280424866.82:198): arch=c000003e syscall=4 success=yes exit=4294967424 a0=7f3d6bc9a2d8 a1=7fff09e3d2f0 a2=7fff09e3d2f0 a3=1999999999999999 items=0 ppid=8660 pid=8669 auid=500 uid=48 gid=487 euid=48 suid=48 fsuid=48 egid=487 sgid=487 fsgid=487 tty=(none) ses=1 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)



Hash String generated from  httpd_enable_homedirs,httpd,httpd_t,user_home_dir_t,dir,search
audit2allow suggests:

#============= httpd_t ==============
#!!!! This avc is allowed in the current policy

allow httpd_t user_home_dir_t:dir search;

Comment 1 Daniel Walsh 2010-07-29 18:52:07 UTC
#============= httpd_t ==============
#!!!! This avc is allowed in the current policy

allow httpd_t user_home_dir_t:dir search;

Comment 2 winhater 2010-09-22 10:52:36 UTC
It is strange, but in my case all lines which were previously referencing
subdirectories in my home directory, were STRICTLY commented out in httpd.conf
and conf.d. So, why httpd daemon tries to read my home directory again and again?

Comment 3 Daniel Walsh 2010-09-22 15:44:21 UTC
Do you have a separate file system mounted there?  httpd might be doing a search of all mounted file systems.

Comment 4 winhater 2010-09-23 01:19:18 UTC
I have separate filesystem /home:
Partial content of fstab:
$cat /etc/fstab
<SKIP>
/                       ext3    defaults        1 1
/home                   ext3    defaults        1 2
/var                    ext3    defaults        1 2
/tmp                    ext3    defaults        1 2
/usr                    ext3    defaults        1 2
/usr/local              ext3    defaults        1 2
/boot                   ext3    defaults        1 2
<SKIP>

$uname -r
2.6.34.7-56.fc13.i686

Why httpd is searching for SUBdirectories in /home?
(I have apache for development purposes, so port 80 is firewall protected.
So, it's obviously local apache "is playing pranks".
And what's more, this SELinux alert (though harmless, but annoying)
springs up only once at system start.)

Comment 5 Daniel Walsh 2010-09-23 13:19:38 UTC
How are you starting httpd?

If you use the service httpd start script, you should not see this avc.  If you execute /etc/init.d/httpd start from your home dir you would.