syslogs altlog_proglist and isc-dhcpd logging for FreeBSD

Harald Schmalzbauer h.schmalzbauer at omnilan.de
Sun Jul 11 19:46:06 UTC 2010


Hello,

since isc-dhcpd-4.1.1 promised ipv6, I wanted to replace my existing 
DHCP servers with this new version.
I'm running chrooted. My problem was with logging.

dhcpd is very noisy and setting "log-facility local1" in dhcpd.conf 
doesn't work out of the box (*) because of the chrooted environment.

But some good guys already coded everything which is needed to have 
dhcpd logging with chrooted.
- syslogd has the -l switch which enables to place an additional log 
socket into the chrooted enivronment.
- /etc/rc.d/syslogd already knows about this and has the variable 
altlog_proglist, which checks for possible chrooted daemons

The problems are:
- /etc/rc.d/syslogd has the altlog_proglist hard coded
- /etc/rc.d/syslogd checks for daemons in rc.conf which have flags 
any_chrootdir, but rc.d/isc-dhcpd uses dhcpd_rootdir.

So here's the view simple lines that make dhcpd logging working with 
individula log-facility configs:

--- etc/rc.d/syslogd	2009-09-06 02:47:31.000000000 +0200
+++ etc/rc.d/syslogd	2010-07-11 21:27:46.477366986 +0200
@@ -1,6 +1,6 @@
  #!/bin/sh
  #
-# $FreeBSD: src/etc/rc.d/syslogd,v 1.13.2.1 2009/08/03 08:13:06 
kensmith Exp $
+# $FreeBSD: src/etc/rc.d/syslogd,v 1.13.2.1.4.1 2010/06/14 02:09:06 
kensmith Exp $
  #

  # PROVIDE: syslogd
@@ -19,7 +19,9 @@

  sockfile="/var/run/syslogd.sockets"
  evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\""
-altlog_proglist="named"
+
+load_rc_config $name
+altlog_proglist=${syslogd_altlog_proglist:-"named"}

  syslogd_precmd()
  {
--- etc/defaults/rc.conf	2009-11-01 15:08:40.000000000 +0100
+++ etc/defaults/rc.conf	2010-07-11 21:30:04.373974162 +0200
@@ -255,6 +255,7 @@
  syslogd_enable="YES"		# Run syslog daemon (or NO).
  syslogd_program="/usr/sbin/syslogd" # path to syslogd, if you want a 
different one.
  syslogd_flags="-s"		# Flags to syslogd (if enabled).
+syslogd_altlog_proglist="named" # Check vor chrooted daemons and place 
additional socket
  inetd_enable="NO"		# Run the network daemon dispatcher (YES/NO).
  inetd_program="/usr/sbin/inetd"	# path to inetd, if you want a 
different one.
  inetd_flags="-wW -C 60"		# Optional flags to inetd



--- etc/rc.d/isc-dhcpd.orig	2010-07-08 13:03:45.000000000 +0200
+++ etc/rc.d/isc-dhcpd	2010-07-11 20:41:36.000000000 +0200
@@ -32,7 +32,7 @@

  dhcpd_chroot_enable=${dhcpd_chroot_enable:-"NO"}	# runs chrooted?
  dhcpd_devfs_enable=${dhcpd_devfs_enable:-"YES"}		# devfs if available?
-dhcpd_rootdir=${dhcpd_rootdir:-/var/db/${name}}		# directory to run in
+dhcpd_rootdir=${dhcpd_chrootdir:-/var/db/${name}}		# directory to run in
  # dhcpd_includedir=""			# directory for included config files

  safe_run ()	# rc command [args...]

Is it possible to get these changes into base system?
@wxs Any objections changing dhacpd_rootdir into dhcpd_chrootdir variable?

Shall I file a PR?

Thanks,

-Harry

P.S.: For the records, here another possibility to make dhcpd use 
different syslog facility in chrooted environmen:
(*)
Chaging the syslog facility of dhcpd with "log-facility local7;" in 
dhcpd.conf doesn't work for chrooted dhcpd.
At startup, it uses the local datagram syslogd socket /dev/log 
(/var/run/syslog.sockets).
The syslog facility change is done after changeroot took place, so in 
the chrooted environment there is no syslogd reachable.
To change the default syslog facility from LOG_DAEMON to LOG_LOCAL7 add 
the following to the ports Makefile:
CONFIGURE_ENV=  CPPFLAGS="-DDHCPD_LOG_FACILITY=LOG_LOCAL7 ...... *snip*

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20100711/5c595923/signature.pgp


More information about the freebsd-stable mailing list