X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PlanetLabConf%2Fntp.conf.php;h=b687fde8db6ce9458466a0d931e2906b5401bd0d;hb=e82b6bdedbb13fee163845c8eaa97b0e385871f1;hp=4676c2372caa021352b4373bb5e18ebb2f26f38d;hpb=37a93603272c00a8b2389bbec0c1860382eb8569;p=nodeconfig.git diff --git a/PlanetLabConf/ntp.conf.php b/PlanetLabConf/ntp.conf.php index 4676c23..b687fde 100755 --- a/PlanetLabConf/ntp.conf.php +++ b/PlanetLabConf/ntp.conf.php @@ -5,8 +5,6 @@ // Marc Fiuczynski // Copyright (C) 2006 The Trustees of Princeton University // -// $Id$ -// // Get admin API handle require_once 'plc_api.php'; @@ -18,12 +16,9 @@ $default_name = "default"; $file_name = $config_directory . $file_prefix . $default_name; // Look up the node -$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); -if (!empty($nodenetworks)) { - $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id'])); - if (!empty($nodes)) { - $node = $nodes[0]; - } +$nodes = $adm->GetNodes(array('node_id' => (int)$_GET['node_id'])); +if (!empty($nodes)) { + $node = $nodes[0]; } if (!isset($node)) { @@ -31,6 +26,7 @@ if (!isset($node)) { exit(); } + $problem_models = array("Dell Precision 340", "Unknown"); $hostname= trim($node['hostname']); @@ -42,6 +38,10 @@ if (!empty($sites)) { $site_name= $sites[0]['name']; $mylat= $sites[0]['latitude']; $mylong= $sites[0]['longitude']; +} else { + $site_name= "Unknown"; + $mylat= 0; + $mylong= 0; } /* typical NTP settings */ @@ -49,6 +49,14 @@ if (!empty($sites)) { print( "# node $hostname site $site_name $mylat $mylong $model\n"); print( "driftfile /var/lib/ntp/ntp.drift\n" ); print( "statsdir /var/log/ntpstats/\n" ); +print( "disable monitor\n" ); +print( "# Permit time synchronization with our time source, but do not\n"); +print( "# permit the source to query or modify the service on this system.\n"); +print( "restrict default kod nomodify notrap nopeer noquery\n"); +print( "restrict -6 default kod nomodify notrap nopeer noquery\n"); +print( "restrict 127.0.0.1\n"); +print( "restrict -6 ::1\n"); + if (is_numeric(array_search($model, $problem_models))) { print( "tinker stepout 0\n" ); } @@ -95,4 +103,4 @@ else { readfile($file_name); } -?> \ No newline at end of file +?>