I have some questions about rule writing.
Take ie rule for dnsmasq:
----------------------
role admin sA
subject / rvka
/ rwcdmlxi
role default
subject / {
/ h
-CAP_ALL
connect disabled
bind disabled
}
role nobody u
subject / {
/ h
-CAP_ALL
bind disabled
connect disabled
}
subject /usr/sbin/dnsmasq o {
/ h
/etc/localtime r
/etc/resolv.conf r
-CAP_ALL
bind 0.0.0.0/32:0-65535 dgram ip udp
connect 0.0.0.0/0:1024-65535 dgram udp
connect 0.0.0.0/0:53 dgram udp
}
----------------------
first subject denies everything for user nobody, but second subject with flag "o" should override that inheritance, and give access to two files, binding and connecting for /usr/sbin/dnsmasq but it does not. With that config I still have in logs something like this:
Sep 3 13:43:13 proxy grsec: (default:D:/) denied access to hidden file /etc/resolv.conf by /usr/sbin/dnsmasq[dnsmasq:4841] uid/euid:65534/65534 gid/egid:65534/65534, parent /sbin/init[init:1] uid/euid:0/0 gid/egid:0/0
Sep 3 13:43:15 proxy grsec: (default:D:/) denied connect() to 192.168.xxx.yyy port 1025 sock type dgram protocol udp by /usr/sbin/dnsmasq[dnsmasq:4841] uid/euid:65534/65534 gid/egid:65534/65534, parent /sbin/init[init:1] uid/euid:0/0 gid/egid:0/0
First at all it hits role default. But when I have something like this:
----------------------
role default
subject / {
/ h
-CAP_ALL
connect disabled
bind disabled
}
role nobody u
subject / {
/ h
/etc/localtime r
/etc/resolv.conf r
-CAP_ALL
bind 0.0.0.0/32:0-65535 dgram ip udp
connect 0.0.0.0/0:1024-65535 dgram udp
connect 0.0.0.0/0:53 dgram udp
}
subject /usr/sbin/dnsmasq o {
/ h
-CAP_ALL
}
--------------------------
it works fine for me.
My system is hardened gentoo, kernel 2.6.28-hardened-r9 (grsec-2.1.13-2.6.28.10-200905241817.patch)