packages: ntp/ntp-client.init, ntp/ntp-client.sysconfig, ntp/ntp.init, ntp/...

glen glen at pld-linux.org
Fri Jan 22 20:41:00 CET 2010


Author: glen                         Date: Fri Jan 22 19:40:59 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- run services under ntp (you may switch back to root in config)

---- Files affected:
packages/ntp:
   ntp-client.init (1.8 -> 1.9) , ntp-client.sysconfig (1.7 -> 1.8) , ntp.init (1.25 -> 1.26) , ntp.spec (1.118 -> 1.119) , ntp.sysconfig (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: packages/ntp/ntp-client.init
diff -u packages/ntp/ntp-client.init:1.8 packages/ntp/ntp-client.init:1.9
--- packages/ntp/ntp-client.init:1.8	Fri Jan 22 20:22:24 2010
+++ packages/ntp/ntp-client.init	Fri Jan 22 20:40:54 2010
@@ -11,6 +11,9 @@
 # Source networking configuration.
 . /etc/sysconfig/network
 
+# if not specified in config
+NTPDATE_USER="ntp"
+
 # Source ntp configuration
 . /etc/sysconfig/ntpdate
 
@@ -26,7 +29,7 @@
 
 start() {
 	show "Syncing time with ntpdate"
-	daemon /usr/sbin/ntpdate -s $NTPDATE_OPTIONS $NTPDATE_SERVERS
+	daemon /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS
 	RETVAL=$?
 	if [ $RETVAL -eq 0 ]; then
 	   	touch /var/lock/subsys/ntpdate
@@ -55,7 +58,7 @@
 	start
 	;;
 cronsettime)
-	is_yes "$NTPDATE_CRON" && /usr/sbin/ntpdate -s $NTPDATE_OPTIONS $NTPDATE_SERVERS > /dev/null 2>&1
+	is_yes "$NTPDATE_CRON" && /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS > /dev/null 2>&1
 	RETVAL=$?
 	;;
 *)

================================================================
Index: packages/ntp/ntp-client.sysconfig
diff -u packages/ntp/ntp-client.sysconfig:1.7 packages/ntp/ntp-client.sysconfig:1.8
--- packages/ntp/ntp-client.sysconfig:1.7	Fri Jan 22 20:22:24 2010
+++ packages/ntp/ntp-client.sysconfig	Fri Jan 22 20:40:54 2010
@@ -1,9 +1,12 @@
 # Sync time at startup
-NTPDATE_OPTIONS="-o 1 -u -U ntp"
+NTPDATE_OPTIONS="-o 1 -u"
 
 #NTPDATE_SERVERS="ntp.nasa.gov clock.isc.org"
 #NTPDATE_SERVERS="ntp.certum.pl vega.cbk.poznan.pl"
 NTPDATE_SERVERS="pool.ntp.org"
+
+# switch user to this user when running ntpdate(1)
+NTPDATE_USER="ntp"
 
 # Set to 'yes' to sync hw clock after successful ntpdate
 SYNC_HWCLOCK="no"

================================================================
Index: packages/ntp/ntp.init
diff -u packages/ntp/ntp.init:1.25 packages/ntp/ntp.init:1.26
--- packages/ntp/ntp.init:1.25	Sun Apr 27 02:47:44 2008
+++ packages/ntp/ntp.init	Fri Jan 22 20:40:54 2010
@@ -12,13 +12,16 @@
 # Source networking configuration.
 . /etc/sysconfig/network
 
+# default user if not overriden by config
+NTPD_USER="ntp"
+
 # Source ntp configuration
 . /etc/sysconfig/ntpd
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
 	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
-		msg_network_down ntpd
+		msg_network_down "ntpd"
 		exit 1
 	fi
 else
@@ -30,22 +33,22 @@
 start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/ntpd ]; then
-		msg_starting ntpd
-		daemon /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntpd.pid $NTPD_OPTIONS
+		msg_starting "ntpd"
+		daemon /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntpd.pid ${NTPD_USER:+-u $NTPD_USER} $NTPD_OPTIONS
 		RETVAL=$?
 		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
 	else
-		msg_already_running ntp
+		msg_already_running "ntpd"
 	fi
 }
 
 stop() {
 	if [ -f /var/lock/subsys/ntpd ]; then
-		msg_stopping ntpd
+		msg_stopping "ntpd"
 		killproc ntpd
 		rm -f /var/lock/subsys/ntpd
 	else
-		msg_not_running ntpd
+		msg_not_running "ntpd"
 	fi
 }
 
@@ -54,7 +57,7 @@
 		stop
 		start
 	else
-		msg_not_running ntpd
+		msg_not_running "ntpd"
 		RETVAL=$1
 	fi
 }

================================================================
Index: packages/ntp/ntp.spec
diff -u packages/ntp/ntp.spec:1.118 packages/ntp/ntp.spec:1.119
--- packages/ntp/ntp.spec:1.118	Fri Jan 22 20:22:24 2010
+++ packages/ntp/ntp.spec	Fri Jan 22 20:40:54 2010
@@ -1,6 +1,5 @@
 # $Revision$, $Date$
 # TODO
-# - see if ntpd can be droproot too as ntpdate is patched
 # - ntpd default config is too restrictive (ntpq -p should work locally)
 %include	/usr/lib/rpm/macros.perl
 Summary:	Network Time Protocol utilities
@@ -8,7 +7,7 @@
 Summary(pt_BR.UTF-8):	Network Time Protocol versão 4
 Name:		ntp
 Version:	4.2.4p8
-Release:	3.3
+Release:	3.4
 License:	distributable
 Group:		Daemons
 Source0:	http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz
@@ -347,6 +346,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.119  2010/01/22 19:40:54  glen
+- run services under ntp (you may switch back to root in config)
+
 Revision 1.118  2010/01/22 19:22:24  glen
 - run ntpdate under ntp uid, ntpdate service also can sync hwclock after service start
 

================================================================
Index: packages/ntp/ntp.sysconfig
diff -u packages/ntp/ntp.sysconfig:1.7 packages/ntp/ntp.sysconfig:1.8
--- packages/ntp/ntp.sysconfig:1.7	Wed Mar 26 17:18:26 2008
+++ packages/ntp/ntp.sysconfig	Fri Jan 22 20:40:54 2010
@@ -3,7 +3,9 @@
 # Define services nice level
 SERVICE_RUN_NICE_LEVEL="+1"
 
-
 # pass additional arguments (like -g)
-#NTPD_OPTIONS="-l /var/log/ntpd.log"	# this demands logrotate to avid problems
+#NTPD_OPTIONS="-l /var/log/ntpd.log" # this demands logrotate to avoid problems
 NTPD_OPTIONS=""
+
+# switch user to this user when running ntpd(1)
+NTPD_USER="ntp"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp-client.init?r1=1.8&r2=1.9&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp-client.sysconfig?r1=1.7&r2=1.8&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp.init?r1=1.25&r2=1.26&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp.spec?r1=1.118&r2=1.119&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp.sysconfig?r1=1.7&r2=1.8&f=u



More information about the pld-cvs-commit mailing list