Re: lnk_file read permission

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il 2020-07-31 19:09 Gionatan Danti ha scritto:
I did not know that systemd would, with specific settings, create a
private mysql data dir.
I would try the var_lib_t approach more widely.
Thanks.

Mmm, it seems labeling the link as var_lib_t is not always sufficient.
Doing a mongodb test relocation from /var/lib/mongodb to /zzz/mongodb the service does not start, even if I can see the link having var_lib_t label:

# ls -alZ /var/lib/
...
lrwxrwxrwx. root root unconfined_u:object_r:var_lib_t:s0 mongodb -> /zzz/mongodb

Indeed, I can see the following in /var/log/audit:

type=AVC msg=audit(1596222151.576:253): avc: denied { read } for pid=4313 comm="mongod" name="mongodb" dev="dm-0" ino=33673444 scontext=system_u:system_r:mongod_t:s0 tcontext=unconfined_u:object_r:var_lib_t:s0 tclass=lnk_file permissive=0

Relabeling the synlink with its "native" label via restorecon -RF produce the following:

# ls -alZ /var/lib/
...
lrwxrwxrwx. root root system_u:object_r:mongod_var_lib_t:s0 mongodb -> /zzz/mongodb

But the service again does not start, with the followin logs:

type=AVC msg=audit(1596222240.363:257): avc: denied { read } for pid=4344 comm="mongod" name="mongodb" dev="dm-0" ino=33673444 scontext=system_u:system_r:mongod_t:s0 tcontext=system_u:object_r:mongod_var_lib_t:s0 tclass=lnk_file permissive=0

What would be the best approach in this case? I know that one approach would be to use a bind mount, but I would like to avoid it because: a) it has bad filesystem discoverably (you had to search for bind mount explicitly, while a symlink is visible even with a simple ls) b) I need to setup a fcontext <<None>> for the actual dir which is bind-mounted (otherwise, a "restorecon -RF /zzz/" will cause issues, by relabeling any files with default_t)

I am open to suggestions...
Thanks.

--
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: g.danti@xxxxxxxxxx - info@xxxxxxxxxx
GPG public key ID: FF5F32A8



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux