Re: /run/systemd/inaccessible

Topi Miettinen <[email protected]>
Newsgroups org.kernel.vger.selinux-refpolicy
Message-ID <[email protected]>
On 27.2.2020 14.20, Dominick Grift wrote:
> Russell Coker <[email protected]> writes:
> 
>> allow systemd_logind_t init_var_run_t:chr_file write;
>>
>> audit2allow shows me that the above is attempted on Debian/Unstable.  What's
>> this inaccessible directory about anyway?
> 
> systemd-userruntimedir (245) now also creates it in /run/user/%{USERID}

The relevant code has this comment:

/* Set up inaccessible nodes now so they're available if we decide to 
use them with user namespaces. */

> probably used for InaccessiblePath= directive but I am not sure.

Yes, these are bind mounted over the path which is wanted inaccessible. 
Perhaps this could be improved by giving them a dedicated label and then 
some new TE rules could prevent anything other than PID1 from managing 
them. Now if a service has CAP_SYS_ADMIN and is not blocked by seccomp 
filters from using mount and umount system calls, it could dismantle the 
bind mount.

-Topi

>>
>> # ls -lZ /run/systemd/inaccessible
>> total 0
>> b---------. 1 root root system_u:object_r:init_var_run_t:s0 0, 0 Feb 27 13:36
>> blk
>> c---------. 1 root root system_u:object_r:init_var_run_t:s0 0, 0 Feb 27 13:36
>> chr
>> d---------. 2 root root system_u:object_r:init_var_run_t:s0   40 Feb 27 13:36
>> dir
>> p---------. 1 root root system_u:object_r:init_var_run_t:s0    0 Feb 27 13:36
>> fifo
>> ----------. 1 root root system_u:object_r:init_var_run_t:s0    0 Feb 27 13:36
>> reg
>> s---------. 1 root root system_u:object_r:init_var_run_t:s0    0 Feb 27 13:36
>> sock
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.