From owner-freebsd-questions@FreeBSD.ORG Wed Mar 7 01:03:36 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CFDC616A401 for ; Wed, 7 Mar 2007 01:03:36 +0000 (UTC) (envelope-from martin@dc.cis.okstate.edu) Received: from dc.cis.okstate.edu (dc.cis.okstate.edu [139.78.100.219]) by mx1.freebsd.org (Postfix) with ESMTP id A5B3313C4AA for ; Wed, 7 Mar 2007 01:03:36 +0000 (UTC) (envelope-from martin@dc.cis.okstate.edu) Received: from dc.cis.okstate.edu (localhost.okstate.edu [127.0.0.1]) by dc.cis.okstate.edu (8.13.3/8.13.3) with ESMTP id l2713Zq1069879 for ; Tue, 6 Mar 2007 19:03:35 -0600 (CST) (envelope-from martin@dc.cis.okstate.edu) Message-Id: <200703070103.l2713Zq1069879@dc.cis.okstate.edu> To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <69877.1173229415.1@dc.cis.okstate.edu> Date: Tue, 06 Mar 2007 19:03:35 -0600 From: Martin McCormick Subject: DHCP Server V3.0.5 No BPF under chroot. Works normally otherwise. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2007 01:03:36 -0000 I found some cook-book instructions for running dhcpd in a chroot environment. The article is 4 years old and appears to be set up for FreeBSD5x, but it isn't far off for FreeBSD6.2 which is what I need dhcpd to run on. Dhcpd runs fine when started normally as in /usr/local/sbin/dhcpd. I haven't yet gotten it to launch as the chroot'ed version. When one starts it, here is what happens: chroot /usr/local/chroot/dhcpd /usr/local/sbin/dhcpd Internet Systems Consortium DHCP Server V3.0.5 Copyright 2004-2006 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/sw/dhcp/ WARNING: Host declarations are global. They are not limited to the scope you declared them in. Wrote 0 deleted host decls to leases file. Wrote 0 new dynamic host decls to leases file. Wrote 0 leases to leases file. No bpf devices. Please read the README section for your operating system. If I do a ls, everything looks identical: cd /usr/local/chroot/dhcpd/dev ls -l bpf* crw------- 1 root wheel 0, 96 Mar 6 11:44 bpf0 crw------- 1 root wheel 1, 97 Mar 6 11:44 bpf1 cd /dev ls -l bpf* crw------- 1 root wheel 0, 96 Mar 5 21:00 bpf0 crw------- 1 root wheel 0, 97 Mar 5 21:00 bpf1 The part of the script that makes those devices is as follows: BPF="`ls -l /dev/bpf0 | awk '{ print $6; }' | sed -e 's/,//g'`" export BPF BPF1="`ls -l /dev/bpf1 | awk '{ print $6; }' | sed -e 's/,//g'`" export BPF1 cd /usr/local/chroot/dhcpd/dev mknod bpf0 c 0 $BPF mknod bpf1 c 1 $BPF1 chmod 0600 bpf* I will post the script when it works since it appears to be about 90% good. It needs a little touch-up to make it work for FreeBSD6. My guess is that there is something else I need in the chroot environment since the bpf appears to work normally when dhcpd is run from root in the traditional way. My thanks and a lot of credit to the person who originally wrote this script which can be found at Linkname: Screaming Electron Forums - How to chroot your existing isc-dhcpd server on freebsd Martin McCormick WB5AGZ Stillwater, OK Systems Engineer OSU Information Technology Department Network Operations Group URL: http://screamingelectron.org/forum/archive/index.php/t-837.html