Thank you for the script.
return subprocess.run(["stat", "--format=%C", file],
capture_output=True, check=True). \
stdout.decode().strip()
I guess this could be replaced by pyxattr
:
import xattr
xattr.getxattr(file, 'security.selinux').rstrip(b'\0').decode()
This version finds 208 problematic cases.
It seems that those cases are result of automatic labelling for different directories: lib_t
for /usr/lib*
vs. usr_t
for the rest of /usr
, locale_t
for anything under /usr/share/locale
, etc. I expect that those changes in context would not cause AVCs⊠For example, programs generally need to be able to read files under /usr
, so theyâll be able to read locale files too.
But the problem could be that restorecon
could set the context one way or the other way depending on which hardlink it looks at, and then flip back-and-forth between them. Hmmm. I think weâd want a few different solutions here:
- for the
mingw
locale files, we could add a context path equivalency so that they get labelled withlocale_t
too. - same for the other locale files in strange locations (do those even work?)
- otherwise, we might need to not link files that cross the
/usr/share
â/usr/lib
âboundaryâ.
Iâm open to better ideas