I have the following definition for the "daemon" class in /etc/login.conf:
I've compiled it with [CMD=""]cap_mkdb[/CMD], and when I restart (FreeBSD 9.1 amd64), all of the services have a process MAC label of "biba/high(low-high),mls/low(low-high),partition/0" (that's the same label that init has, and it doesn't correspond to any label in /etc/login.conf.) In contrast, I have labels in the other login classes, which are set properly when users log in (both normal users and root.) Obviously, the problem is either that /etc/rc doesn't try to change the login class, it can't change the login class, or the the label is inherited from the calling process rather than being taken from /etc/login.conf.
Has anyone else had a similar problem? Is it possible that I'm missing a setting somewhere?
It's also worth noting that su seems to ignore the "label" spec in the login class, e.g. the command [CMD=""]sudo su -c daemon `id -un` -c getpmac[/CMD] (set the login class to "daemon" and show the new process' MAC label) shows the same MAC label as the current shell. I can also see that /etc/rc.subr (subroutines used by /etc/rc) uses su, but it doesn't set the login class.
Thanks!
Kevin Barry
edit: I looked at the source for /sbin/init and it looks like it only sets the priority and the resource limits when calling /etc/rc. I tried a few hacks, (added flags to the setusercontext call, changed that call to setclasscontext) which didn't change the outcome.
edit2: the "-s" option for su will enforce the user's MAC label, which I didn't know until I looked at the source for su.
Code:
daemon:\
:label=biba/[B][U]equal[/U][/B](low-high),mls/low(low-[B][U]low[/U][/B]),partition/[B][U]1[/U][/B]:\
:tc=default:
Has anyone else had a similar problem? Is it possible that I'm missing a setting somewhere?
It's also worth noting that su seems to ignore the "label" spec in the login class, e.g. the command [CMD=""]sudo su -c daemon `id -un` -c getpmac[/CMD] (set the login class to "daemon" and show the new process' MAC label) shows the same MAC label as the current shell. I can also see that /etc/rc.subr (subroutines used by /etc/rc) uses su, but it doesn't set the login class.
Thanks!
Kevin Barry
edit: I looked at the source for /sbin/init and it looks like it only sets the priority and the resource limits when calling /etc/rc. I tried a few hacks, (added flags to the setusercontext call, changed that call to setclasscontext) which didn't change the outcome.
edit2: the "-s" option for su will enforce the user's MAC label, which I didn't know until I looked at the source for su.