I read about flow of matches in wiki to understand how the inheritance works. I have following configuration in test user role:
- Code: Select all
role testuser u
role_allow_ip 0.0.0.0/0
subject / {
/
/home r
/home/testuser r
/home/testuser/.viminfo rwcda
/home/testuser/.viminfo.tmp rwcda
/lib64 rx
/tmp rwcda
/usr r
/usr/bin rx
/usr/lib64 rx
/var r
-CAP_ALL
bind disabled
connect 0.0.0.0/0:0-65535 stream tcp
connect 0.0.0.0/0:0-65535 dgram udp
sock_allow_family all
}
subject /usr/bin/vim {
bind disabled
connect disabled
}
When i do just "vim" and immediately quit it, i receive permission denied:
(testuser:U:/usr/bin/vim) denied create of /home/testuser/.viminfo for writing by /usr/bin/vim
From what I read, if there is no such object in /usr/bin/vim subject, next most specific object permissions should be applied. As there is no 'o' flag for vim subject, it should inherit all object permissions from /usr/bin, then /usr subject (do not exist in the user policy) and last, from / subject
According to /, ".viminfo" file has rwcda permissions, so when inherited from /, vim should be able to create and write to this file.
When I delete .viminfo object from / subject and add it to vim subject, all works ok. Same as when i delete vim subject completely (so / subject will apply). So it looks like the subject did not inherit the permissions. Why did this happen?