All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 0c6afb1a authored by Mike Hibler's avatar Mike Hibler

Quicky fixes to make sure a good ntp.conf file is installed in images.

parent 711a3a08
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2000-2013 University of Utah and the Flux Group. # Copyright (c) 2000-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -144,6 +144,20 @@ localize_image() { ...@@ -144,6 +144,20 @@ localize_image() {
} }
fi fi
fi fi
# Check the NTP configuration.
if [ -e /etc/ntp.conf ]; then
cmp -s /etc/ntp.conf $MNT/etc/ntp.conf
if [ $? -ne 0 ]; then
echo " updating /etc/ntp.conf"
cp -p /etc/ntp.conf $MNT/etc/ntp.conf || {
echo "Failed to create /etc/ntp.conf"
return 1
}
fi
fi
return 0 return 0
} }
......
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2000-2013 University of Utah and the Flux Group. # Copyright (c) 2000-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -277,6 +277,7 @@ dofreebsd() { ...@@ -277,6 +277,7 @@ dofreebsd() {
changehostkeys=0 changehostkeys=0
changerootkeys=0 changerootkeys=0
changezone=0 changezone=0
changentp=0
fixit=0 fixit=0
...@@ -475,6 +476,16 @@ dofreebsd() { ...@@ -475,6 +476,16 @@ dofreebsd() {
fixit=1 fixit=1
fi fi
fi fi
# Check the NTP config.
if [ -e /etc/ntp.conf ]; then
cmp -s /etc/ntp.conf /mnt/etc/ntp.conf
if [ $? -ne 0 ]; then
changentp=1
fixit=1
fi
fi
fi fi
if [ $fixit -eq 0 ]; then if [ $fixit -eq 0 ]; then
...@@ -768,6 +779,17 @@ EOF1 ...@@ -768,6 +779,17 @@ EOF1
} }
fi fi
# Copy in new NTP config
if [ $changentp -eq 1 ]; then
echo " updating /etc/ntp.conf"
cp -p /etc/ntp.conf /mnt/etc/ntp.conf || {
echo "Failed to create /etc/ntp.conf"
umount $rootdev
return 1
}
fi
# actually run any postconfig scripts if we're supposed to: # actually run any postconfig scripts if we're supposed to:
if [ $doosconfig -eq 1 -a -x $BINDIR/osconfig ]; then if [ $doosconfig -eq 1 -a -x $BINDIR/osconfig ]; then
$BINDIR/osconfig -m /mnt -D $rootdev -s FreeBSD postload $BINDIR/osconfig -m /mnt -D $rootdev -s FreeBSD postload
......
...@@ -954,6 +954,20 @@ sub localize ...@@ -954,6 +954,20 @@ sub localize
} }
} }
} }
# Check the NTP configuration.
if (-e "/etc/ntp.conf") {
system("cmp -s /etc/ntp.conf $imageroot/etc/ntp.conf >/dev/null 2>&1");
if ($?) {
print "Updating /etc/ntp.conf\n";
system("cp -p /etc/ntp.conf $imageroot/etc/ntp.conf");
if ($?) {
print STDERR "Failed to create /etc/ntp.conf\n";
return;
}
}
}
} }
sub hardwire_boss_node sub hardwire_boss_node
......
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2000-2013 University of Utah and the Flux Group. # Copyright (c) 2000-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -311,6 +311,7 @@ dofreebsd() { ...@@ -311,6 +311,7 @@ dofreebsd() {
changehostkeys=0 changehostkeys=0
changerootkeys=0 changerootkeys=0
changezone=0 changezone=0
changentp=0
fixit=0 fixit=0
...@@ -509,6 +510,16 @@ dofreebsd() { ...@@ -509,6 +510,16 @@ dofreebsd() {
fixit=1 fixit=1
fi fi
fi fi
# Check the NTP config.
if [ -e /etc/ntp.conf ]; then
cmp -s /etc/ntp.conf /mnt/etc/ntp.conf
if [ $? -ne 0 ]; then
changentp=1
fixit=1
fi
fi
fi fi
if [ $fixit -eq 0 ]; then if [ $fixit -eq 0 ]; then
...@@ -827,6 +838,17 @@ EOF1 ...@@ -827,6 +838,17 @@ EOF1
} }
fi fi
# Copy in new NTP config
if [ $changentp -eq 1 ]; then
echo " updating /etc/ntp.conf"
cp -p /etc/ntp.conf /mnt/etc/ntp.conf || {
echo "Failed to create /etc/ntp.conf"
umount $rootdev
return 1
}
fi
# actually run any postconfig scripts if we're supposed to: # actually run any postconfig scripts if we're supposed to:
if [ $doosconfig -eq 1 -a -x $BINDIR/osconfig ]; then if [ $doosconfig -eq 1 -a -x $BINDIR/osconfig ]; then
$BINDIR/osconfig -m /mnt -D $rootdev -s FreeBSD postload $BINDIR/osconfig -m /mnt -D $rootdev -s FreeBSD postload
......
...@@ -52,6 +52,7 @@ FS_FILE=ntp.conf-external ...@@ -52,6 +52,7 @@ FS_FILE=ntp.conf-external
endif endif
endif endif
endif endif
NODE_FILE=ntp.conf-node
# #
# Force dependencies to make sure configure regenerates if the .in file # Force dependencies to make sure configure regenerates if the .in file
...@@ -67,7 +68,7 @@ include $(TESTBED_SRCDIR)/GNUmakerules ...@@ -67,7 +68,7 @@ include $(TESTBED_SRCDIR)/GNUmakerules
# clobber the "real" version. # clobber the "real" version.
# #
ifeq ($(TBROOT),/usr/testbed) ifeq ($(TBROOT),/usr/testbed)
install: $(BOSS_FILE) install: $(BOSS_FILE) clientconfig
mv -f $(DESTDIR)/etc/ntp.conf $(DESTDIR)/etc/ntp.conf.bak mv -f $(DESTDIR)/etc/ntp.conf $(DESTDIR)/etc/ntp.conf.bak
$(INSTALL_DATA) $(BOSS_FILE) $(DESTDIR)/etc/ntp.conf $(INSTALL_DATA) $(BOSS_FILE) $(DESTDIR)/etc/ntp.conf
control-install: $(OPS_FILE) control-install: $(OPS_FILE)
...@@ -76,8 +77,10 @@ control-install: $(OPS_FILE) ...@@ -76,8 +77,10 @@ control-install: $(OPS_FILE)
fs-install: $(FS_FILE) fs-install: $(FS_FILE)
mv -f $(DESTDIR)/etc/ntp.conf $(DESTDIR)/etc/ntp.conf.bak mv -f $(DESTDIR)/etc/ntp.conf $(DESTDIR)/etc/ntp.conf.bak
$(INSTALL_DATA) $(FS_FILE) $(DESTDIR)/etc/ntp.conf $(INSTALL_DATA) $(FS_FILE) $(DESTDIR)/etc/ntp.conf
clientconfig: $(NODE_FILE)
$(INSTALL_DATA) $(NODE_FILE) $(TBROOT)/etc/image_ntp.conf
else else
install control-install fs-install: install control-install fs-install clientconfig:
@echo "Cannot install NTP config in dev tree" @echo "Cannot install NTP config in dev tree"
endif endif
......
#
# Generic Emulab NTP client configuration.
#
server ntp1 iburst
restrict default ignore
restrict ntp1 nomodify nopeer noquery notrap
restrict 127.0.0.1
# XXX not standard for anyone anymore, but it is the LCD
driftfile /etc/ntp.drift
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2010-2013 University of Utah and the Flux Group. # Copyright (c) 2010-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -86,6 +86,7 @@ my $MDCONFIG = "/sbin/mdconfig"; ...@@ -86,6 +86,7 @@ my $MDCONFIG = "/sbin/mdconfig";
my $AUTHKEYS = "/root/.ssh/authorized_keys"; my $AUTHKEYS = "/root/.ssh/authorized_keys";
my $ZONEINFO = "/usr/share/zoneinfo"; my $ZONEINFO = "/usr/share/zoneinfo";
my $IMAGEKEYS_DIR = "$ETCDIR/image_hostkeys"; my $IMAGEKEYS_DIR = "$ETCDIR/image_hostkeys";
my $NTPCONF = "$ETCDIR/image_ntp.conf";
# Protos # Protos
sub fatal($); sub fatal($);
...@@ -260,6 +261,9 @@ sub LocalizeBSD() ...@@ -260,6 +261,9 @@ sub LocalizeBSD()
# Copy boss timezone into the MFS. # Copy boss timezone into the MFS.
ExecQuiet("$CP -p $ZONEINFO/$OURTIMEZONE $mpoint/etc/localtime") ExecQuiet("$CP -p $ZONEINFO/$OURTIMEZONE $mpoint/etc/localtime")
== 0 or goto bad; == 0 or goto bad;
# Copy image version of ntp.conf into the MFS.
ExecQuiet("$CP -p $NTPCONF $mpoint/etc/ntp.conf")
== 0 or goto bad;
# Localize the root/toor password from the sitevar # Localize the root/toor password from the sitevar
ExecQuiet("echo '$passhash' | $PW -V $mpoint/etc usermod toor -H 0") ExecQuiet("echo '$passhash' | $PW -V $mpoint/etc usermod toor -H 0")
== 0 or goto bad; == 0 or goto bad;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment