Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jul 2010 21:45:54 +0200
From:      Harald Schmalzbauer <h.schmalzbauer@omnilan.de>
To:        FreeBSD Stable <freebsd-stable@freebsd.org>, wxs@freebsd.org, mtm@freebsd.org
Subject:   syslogs altlog_proglist and isc-dhcpd logging for FreeBSD
Message-ID:  <4C3A1F72.2040303@omnilan.de>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigB2ED1EE57AEA2B702AC55986
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: quoted-printable

Hello,

since isc-dhcpd-4.1.1 promised ipv6, I wanted to replace my existing=20
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=20
doesn't work out of the box (*) because of the chrooted environment.

But some good guys already coded everything which is needed to have=20
dhcpd logging with chrooted.
- syslogd has the -l switch which enables to place an additional log=20
socket into the chrooted enivronment.
- /etc/rc.d/syslogd already knows about this and has the variable=20
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=20
any_chrootdir, but rc.d/isc-dhcpd uses dhcpd_rootdir.

So here's the view simple lines that make dhcpd logging working with=20
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=20
kensmith Exp $
+# $FreeBSD: src/etc/rc.d/syslogd,v 1.13.2.1.4.1 2010/06/14 02:09:06=20
kensmith Exp $
  #

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

  sockfile=3D"/var/run/syslogd.sockets"
  evalargs=3D"rc_flags=3D\"\`set_socketlist\` \$rc_flags\""
-altlog_proglist=3D"named"
+
+load_rc_config $name
+altlog_proglist=3D${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=3D"YES"		# Run syslog daemon (or NO).
  syslogd_program=3D"/usr/sbin/syslogd" # path to syslogd, if you want a =

different one.
  syslogd_flags=3D"-s"		# Flags to syslogd (if enabled).
+syslogd_altlog_proglist=3D"named" # Check vor chrooted daemons and place=
=20
additional socket
  inetd_enable=3D"NO"		# Run the network daemon dispatcher (YES/NO).
  inetd_program=3D"/usr/sbin/inetd"	# path to inetd, if you want a=20
different one.
  inetd_flags=3D"-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=3D${dhcpd_chroot_enable:-"NO"}	# runs chrooted?
  dhcpd_devfs_enable=3D${dhcpd_devfs_enable:-"YES"}		# devfs if available=
?
-dhcpd_rootdir=3D${dhcpd_rootdir:-/var/db/${name}}		# directory to run in=

+dhcpd_rootdir=3D${dhcpd_chrootdir:-/var/db/${name}}		# directory to run =
in
  # dhcpd_includedir=3D""			# 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=20
different syslog facility in chrooted environmen:
(*)
Chaging the syslog facility of dhcpd with "log-facility local7;" in=20
dhcpd.conf doesn't work for chrooted dhcpd.
At startup, it uses the local datagram syslogd socket /dev/log=20
(/var/run/syslog.sockets).
The syslog facility change is done after changeroot took place, so in=20
the chrooted environment there is no syslogd reachable.
To change the default syslog facility from LOG_DAEMON to LOG_LOCAL7 add=20
the following to the ports Makefile:
CONFIGURE_ENV=3D  CPPFLAGS=3D"-DDHCPD_LOG_FACILITY=3DLOG_LOCAL7 ...... *s=
nip*


--------------enigB2ED1EE57AEA2B702AC55986
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (FreeBSD)

iEYEARECAAYFAkw6H3sACgkQLDqVQ9VXb8iubwCeIiq+oH7zVIoVXWKVfCDgNOpo
l2oAn2NTWQplEjHBTT9JFmoW6l94Ef4E
=OWsE
-----END PGP SIGNATURE-----

--------------enigB2ED1EE57AEA2B702AC55986--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C3A1F72.2040303>