NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/49380: ntpd_chrootdir does not work on NetBSD 7.0_BETA



>Number:         49380
>Category:       bin
>Synopsis:       ntpd_chrootdir does not work on NetBSD 7.0_BETA
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 11 11:35:00 +0000 2014
>Originator:     KAMADA Ken'ichi
>Release:        NetBSD 7.0_BETA
>Organization:
>Environment:
System: NetBSD host.example.org 7.0_BETA NetBSD 7.0_BETA (GENERIC) #21: Mon Oct 27 20:43:39 JST 2014 user%host.example.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
If ntpd_chrootdir is set in /etc/rc.conf, ntpd fails to resolve
host names and does not establish associations.  The new ntpd
imported in December 2013 seems to defer name resolution, and
it moves on to chroot() without waiting the completion.

>How-To-Repeat:
With the default /etc/ntp.conf, do the following.

# grep ntpd /etc/rc.conf
ntpd=YES
ntpd_chrootdir="/var/chroot/ntpd"

# ps ax | grep ntpd
 4606 ?     Ss   0:00.03 /usr/sbin/ntpd -u ntpd:ntpd -i /var/chroot/ntpd -p /va
27866 ?     S    0:00.00 /usr/sbin/ntpd -u ntpd:ntpd -i /var/chroot/ntpd -p /va

# ntpq -p
No association ID's returned

>Fix:
Index: distrib/sets/lists/base/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/base/mi,v
retrieving revision 1.1087
diff -u -r1.1087 mi
--- distrib/sets/lists/base/mi	10 Aug 2014 17:32:54 -0000	1.1087
+++ distrib/sets/lists/base/mi	10 Nov 2014 15:42:36 -0000
@@ -5670,6 +5670,7 @@
 ./var/chroot/named/var/tmp			base-bind-root
 ./var/chroot/ntpd				base-ntp-root
 ./var/chroot/ntpd/dev				base-ntp-root
+./var/chroot/ntpd/etc				base-ntp-root
 ./var/chroot/ntpd/var				base-ntp-root
 ./var/chroot/ntpd/var/db			base-ntp-root
 ./var/chroot/ntpd/var/run			base-ntp-root
Index: etc/mtree/NetBSD.dist.base
===================================================================
RCS file: /cvsroot/src/etc/mtree/NetBSD.dist.base,v
retrieving revision 1.139
diff -u -r1.139 NetBSD.dist.base
--- etc/mtree/NetBSD.dist.base	10 Aug 2014 17:32:54 -0000	1.139
+++ etc/mtree/NetBSD.dist.base	10 Nov 2014 15:42:36 -0000
@@ -1257,6 +1257,7 @@
 ./var/chroot/named/var/tmp	mode=01775 gname=named
 ./var/chroot/ntpd
 ./var/chroot/ntpd/dev
+./var/chroot/ntpd/etc
 ./var/chroot/ntpd/var
 ./var/chroot/ntpd/var/db	mode=0775 gname=ntpd
 ./var/chroot/ntpd/var/run	mode=0775 gname=ntpd
Index: etc/mtree/special
===================================================================
RCS file: /cvsroot/src/etc/mtree/special,v
retrieving revision 1.148
diff -u -r1.148 special
--- etc/mtree/special	5 Aug 2014 07:34:52 -0000	1.148
+++ etc/mtree/special	10 Nov 2014 15:42:36 -0000
@@ -391,6 +391,7 @@
 ./var/chroot/named/var/tmp	type=dir  mode=01775 gname=named
 ./var/chroot/ntpd		type=dir  mode=0755
 ./var/chroot/ntpd/dev		type=dir  mode=0755
+./var/chroot/ntpd/etc		type=dir  mode=0755
 ./var/chroot/ntpd/var		type=dir  mode=0755
 ./var/chroot/ntpd/var/db	type=dir  mode=0775 gname=ntpd
 ./var/chroot/ntpd/var/run	type=dir  mode=0775 gname=ntpd
Index: etc/rc.d/ntpd
===================================================================
RCS file: /cvsroot/src/etc/rc.d/ntpd,v
retrieving revision 1.14
diff -u -r1.14 ntpd
--- etc/rc.d/ntpd	4 Dec 2012 16:38:40 -0000	1.14
+++ etc/rc.d/ntpd	10 Nov 2014 15:42:36 -0000
@@ -49,6 +49,11 @@
 		( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" )
 	fi
 	ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
+	for f in resolv.conf services; do
+		if ! cmp -s /etc/$f "${ntpd_chrootdir}/etc/$f"; then
+			cp -p /etc/$f "${ntpd_chrootdir}/etc/$f"
+		fi
+	done
 
 	#	Change run_rc_commands()'s internal copy of $ntpd_flags
 	#



Home | Main Index | Thread Index | Old Index