isc-dhcpd.sh rc script and jails

Christopher Cowart ccowart at rescomp.berkeley.edu
Fri Sep 8 00:57:18 PDT 2006


Hello,

The port for isc-dhcp3-server has config options for enabling FreeBSD
process jails. Basically, through a series of command line arguments
that are generated by the isc-dhcpd.sh script, the chroot is
auto-generated when you start the service and dhcpd makes the syscall to
jail itself. This is actually really nifty and makes the process of
running dhcpd in a thin jail brainless.

The problem happens when I run "isc-dhcpd.sh stop": 
dhcpd not running? (check /var/jails/dhcpd/var/run/dhcpd/dhcpd.pid).

Well, I know better. dhcpd is clearly running with the pid indicated in
the pid file. After investigating /etc/rc.subr, I've determined the
cause (where $JID is the jid of the running rc script and $_jid is the
jid of the process, determined by ps output):
  if [ "$JID" -eq "$_jid" ];

Therefore, I cannot run isc-dhcpd.sh stop on the host system. However,
given that I'm using a thin jail, I can't just log in to the jail to
call the rc script. Further, the rc script was written to be called from
the host machine.

My question is how do I get around this? I'd prefer not to hack rc.subr
unless it's a community-useable patch that can be incorporated back into
the official sources. One option would be to allow rc scripts to set
some sort of "CHECK_JAILS" variable and to implement the necessary logic
to handle it in rc.subr. Is there a better solution?

-- 
Chris Cowart
Unix Systems Administrator
Residential Computing, UC Berkeley
"May all your pushes be popped"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20060908/910972ce/attachment.pgp


More information about the freebsd-questions mailing list