Subject: localtime and chroot issues
To: None <tech-kern@NetBSD.org>
From: Ian Zagorskih <ianzag@megasignal.com>
List: current-users
Date: 05/04/2004 18:14:46
bash-2.05b$ uname -a
NetBSD NBSD1 2.0_BETA NetBSD 2.0_BETA (NBSD1) #4: Tue Apr 27 23:37:21 NOVST
2004  toor@NBSD1:/sys/arch/i386/compile/NBSD1 i386

Doing some transfers with TFTP and debugging some dummy 3d party TFTP client
i fould quite an "odd" syslog behaviour: all tftpd records in syslog were in
GMT rather in system's localtime (GMT+7). After a little research i found,
that tftpd daemon runs as chroot-ed process in default /tftproot dir so of
course it couldn't access /etc/localtime to get the proper timezone
information. Ok, i made a copy of localtime in tftpd's sandbox so it feels
happy now.

Just two comments:

1. AFAIU syslog entry is completely formed on client's side in syslog.c
including timestamp information. So a bad client can fabricate this info
just sending an invalid entry data. Sure there are obvious problems with
modifying/breaking existing syslogd's protocol but maybe some
workarounds/fixes are possibly ?

2. Such trick when i have to make mirrowing of localtime [and others] file
system variables can lead to the problem when i have a lot of chroot boxes.
During server's re-configuration i can easily forget to update for example
localtime of some chrooted client. On the other hand, such thing as time
zone information is system wide so maybe it would be reasonable to move it
in sysctl like "kern.localtime" so i could setup this info in sysctl.conf
and have it accessible system wide regadrless to the current root path ?

// wbr