From: Thierry Parmentelat Date: Wed, 26 Mar 2008 13:14:41 +0000 (+0000) Subject: cross module change X-Git-Tag: nodeconfig-4.2-2~4 X-Git-Url: http://git.onelab.eu/?p=nodeconfig.git;a=commitdiff_plain;h=37a93603272c00a8b2389bbec0c1860382eb8569 cross module change taking /var/www/html/{boot,PLCAPI} out of PLCWWW and into nodeconfig files formerly right under nodeconfig/trunk move one step down into PlanetLabConf/ removed corresponding obsolete files in PLCWWW/branches/onelab --- diff --git a/RPM-GPG-KEY-fedora b/PlanetLabConf/RPM-GPG-KEY-fedora similarity index 100% rename from RPM-GPG-KEY-fedora rename to PlanetLabConf/RPM-GPG-KEY-fedora diff --git a/RootResources/pl_conf.py b/PlanetLabConf/RootResources/pl_conf.py similarity index 100% rename from RootResources/pl_conf.py rename to PlanetLabConf/RootResources/pl_conf.py diff --git a/RootResources/pl_netflow.py b/PlanetLabConf/RootResources/pl_netflow.py similarity index 100% rename from RootResources/pl_netflow.py rename to PlanetLabConf/RootResources/pl_netflow.py diff --git a/RootResources/plc_slice_pool.php b/PlanetLabConf/RootResources/plc_slice_pool.php similarity index 100% rename from RootResources/plc_slice_pool.php rename to PlanetLabConf/RootResources/plc_slice_pool.php diff --git a/blacklist.php b/PlanetLabConf/blacklist.php similarity index 100% rename from blacklist.php rename to PlanetLabConf/blacklist.php diff --git a/bwlimit.php b/PlanetLabConf/bwlimit.php similarity index 100% rename from bwlimit.php rename to PlanetLabConf/bwlimit.php diff --git a/delete-rpm-list-production b/PlanetLabConf/delete-rpm-list-production similarity index 100% rename from delete-rpm-list-production rename to PlanetLabConf/delete-rpm-list-production diff --git a/get_gpg_key.php b/PlanetLabConf/get_gpg_key.php similarity index 100% rename from get_gpg_key.php rename to PlanetLabConf/get_gpg_key.php diff --git a/get_plc_config.php b/PlanetLabConf/get_plc_config.php similarity index 100% rename from get_plc_config.php rename to PlanetLabConf/get_plc_config.php diff --git a/getupdatesxml.php b/PlanetLabConf/getupdatesxml.php similarity index 100% rename from getupdatesxml.php rename to PlanetLabConf/getupdatesxml.php diff --git a/ipod.conf.php b/PlanetLabConf/ipod.conf.php similarity index 100% rename from ipod.conf.php rename to PlanetLabConf/ipod.conf.php diff --git a/iptables b/PlanetLabConf/iptables similarity index 100% rename from iptables rename to PlanetLabConf/iptables diff --git a/issue.php b/PlanetLabConf/issue.php similarity index 100% rename from issue.php rename to PlanetLabConf/issue.php diff --git a/keys.php b/PlanetLabConf/keys.php similarity index 100% rename from keys.php rename to PlanetLabConf/keys.php diff --git a/logrotate.conf b/PlanetLabConf/logrotate.conf similarity index 100% rename from logrotate.conf rename to PlanetLabConf/logrotate.conf diff --git a/ntp.conf.php b/PlanetLabConf/ntp.conf.php similarity index 100% rename from ntp.conf.php rename to PlanetLabConf/ntp.conf.php diff --git a/ntp/host/ntp.conf.grouse.hpl.hp.com b/PlanetLabConf/ntp/host/ntp.conf.grouse.hpl.hp.com similarity index 100% rename from ntp/host/ntp.conf.grouse.hpl.hp.com rename to PlanetLabConf/ntp/host/ntp.conf.grouse.hpl.hp.com diff --git a/ntp/host/ntp.conf.planet2.ecse.rpi.edu b/PlanetLabConf/ntp/host/ntp.conf.planet2.ecse.rpi.edu similarity index 100% rename from ntp/host/ntp.conf.planet2.ecse.rpi.edu rename to PlanetLabConf/ntp/host/ntp.conf.planet2.ecse.rpi.edu diff --git a/ntp/ntp.conf.au b/PlanetLabConf/ntp/ntp.conf.au similarity index 100% rename from ntp/ntp.conf.au rename to PlanetLabConf/ntp/ntp.conf.au diff --git a/ntp/ntp.conf.bbk.ac.uk b/PlanetLabConf/ntp/ntp.conf.bbk.ac.uk similarity index 100% rename from ntp/ntp.conf.bbk.ac.uk rename to PlanetLabConf/ntp/ntp.conf.bbk.ac.uk diff --git a/ntp/ntp.conf.br b/PlanetLabConf/ntp/ntp.conf.br similarity index 100% rename from ntp/ntp.conf.br rename to PlanetLabConf/ntp/ntp.conf.br diff --git a/ntp/ntp.conf.ch b/PlanetLabConf/ntp/ntp.conf.ch similarity index 100% rename from ntp/ntp.conf.ch rename to PlanetLabConf/ntp/ntp.conf.ch diff --git a/ntp/ntp.conf.cn b/PlanetLabConf/ntp/ntp.conf.cn similarity index 100% rename from ntp/ntp.conf.cn rename to PlanetLabConf/ntp/ntp.conf.cn diff --git a/ntp/ntp.conf.de b/PlanetLabConf/ntp/ntp.conf.de similarity index 100% rename from ntp/ntp.conf.de rename to PlanetLabConf/ntp/ntp.conf.de diff --git a/ntp/ntp.conf.default b/PlanetLabConf/ntp/ntp.conf.default similarity index 100% rename from ntp/ntp.conf.default rename to PlanetLabConf/ntp/ntp.conf.default diff --git a/ntp/ntp.conf.di.unito.it b/PlanetLabConf/ntp/ntp.conf.di.unito.it similarity index 100% rename from ntp/ntp.conf.di.unito.it rename to PlanetLabConf/ntp/ntp.conf.di.unito.it diff --git a/ntp/ntp.conf.dk b/PlanetLabConf/ntp/ntp.conf.dk similarity index 100% rename from ntp/ntp.conf.dk rename to PlanetLabConf/ntp/ntp.conf.dk diff --git a/ntp/ntp.conf.edu b/PlanetLabConf/ntp/ntp.conf.edu similarity index 100% rename from ntp/ntp.conf.edu rename to PlanetLabConf/ntp/ntp.conf.edu diff --git a/ntp/ntp.conf.eurecom.fr b/PlanetLabConf/ntp/ntp.conf.eurecom.fr similarity index 100% rename from ntp/ntp.conf.eurecom.fr rename to PlanetLabConf/ntp/ntp.conf.eurecom.fr diff --git a/ntp/ntp.conf.fr b/PlanetLabConf/ntp/ntp.conf.fr similarity index 100% rename from ntp/ntp.conf.fr rename to PlanetLabConf/ntp/ntp.conf.fr diff --git a/ntp/ntp.conf.ics.forth.gr b/PlanetLabConf/ntp/ntp.conf.ics.forth.gr similarity index 100% rename from ntp/ntp.conf.ics.forth.gr rename to PlanetLabConf/ntp/ntp.conf.ics.forth.gr diff --git a/ntp/ntp.conf.ipv6.lip6.fr b/PlanetLabConf/ntp/ntp.conf.ipv6.lip6.fr similarity index 100% rename from ntp/ntp.conf.ipv6.lip6.fr rename to PlanetLabConf/ntp/ntp.conf.ipv6.lip6.fr diff --git a/ntp/ntp.conf.it b/PlanetLabConf/ntp/ntp.conf.it similarity index 100% rename from ntp/ntp.conf.it rename to PlanetLabConf/ntp/ntp.conf.it diff --git a/ntp/ntp.conf.it.uu.se b/PlanetLabConf/ntp/ntp.conf.it.uu.se similarity index 100% rename from ntp/ntp.conf.it.uu.se rename to PlanetLabConf/ntp/ntp.conf.it.uu.se diff --git a/ntp/ntp.conf.polito.it b/PlanetLabConf/ntp/ntp.conf.polito.it similarity index 100% rename from ntp/ntp.conf.polito.it rename to PlanetLabConf/ntp/ntp.conf.polito.it diff --git a/ntp/ntp.conf.prob.default b/PlanetLabConf/ntp/ntp.conf.prob.default similarity index 100% rename from ntp/ntp.conf.prob.default rename to PlanetLabConf/ntp/ntp.conf.prob.default diff --git a/ntp/ntp.conf.se b/PlanetLabConf/ntp/ntp.conf.se similarity index 100% rename from ntp/ntp.conf.se rename to PlanetLabConf/ntp/ntp.conf.se diff --git a/ntp/ntp.conf.sics.se b/PlanetLabConf/ntp/ntp.conf.sics.se similarity index 100% rename from ntp/ntp.conf.sics.se rename to PlanetLabConf/ntp/ntp.conf.sics.se diff --git a/ntp/ntp.conf.uk b/PlanetLabConf/ntp/ntp.conf.uk similarity index 100% rename from ntp/ntp.conf.uk rename to PlanetLabConf/ntp/ntp.conf.uk diff --git a/ntp/ntp.conf.ukc.ac.uk b/PlanetLabConf/ntp/ntp.conf.ukc.ac.uk similarity index 100% rename from ntp/ntp.conf.ukc.ac.uk rename to PlanetLabConf/ntp/ntp.conf.ukc.ac.uk diff --git a/ntp/step-tickers.php b/PlanetLabConf/ntp/step-tickers.php similarity index 100% rename from ntp/step-tickers.php rename to PlanetLabConf/ntp/step-tickers.php diff --git a/ntptickers.php b/PlanetLabConf/ntptickers.php similarity index 100% rename from ntptickers.php rename to PlanetLabConf/ntptickers.php diff --git a/propd.conf b/PlanetLabConf/propd.conf similarity index 100% rename from propd.conf rename to PlanetLabConf/propd.conf diff --git a/proxies.php b/PlanetLabConf/proxies.php similarity index 100% rename from proxies.php rename to PlanetLabConf/proxies.php diff --git a/sendmail.cf b/PlanetLabConf/sendmail.cf similarity index 100% rename from sendmail.cf rename to PlanetLabConf/sendmail.cf diff --git a/sendmail.mc b/PlanetLabConf/sendmail.mc similarity index 100% rename from sendmail.mc rename to PlanetLabConf/sendmail.mc diff --git a/slocate.cron b/PlanetLabConf/slocate.cron similarity index 100% rename from slocate.cron rename to PlanetLabConf/slocate.cron diff --git a/sshd_config b/PlanetLabConf/sshd_config similarity index 100% rename from sshd_config rename to PlanetLabConf/sshd_config diff --git a/sudoers b/PlanetLabConf/sudoers similarity index 100% rename from sudoers rename to PlanetLabConf/sudoers diff --git a/sysctl.php b/PlanetLabConf/sysctl.php similarity index 100% rename from sysctl.php rename to PlanetLabConf/sysctl.php diff --git a/yum.conf.php b/PlanetLabConf/yum.conf.php similarity index 100% rename from yum.conf.php rename to PlanetLabConf/yum.conf.php diff --git a/boot/getnodeid.php b/boot/getnodeid.php new file mode 100755 index 0000000..004ce23 --- /dev/null +++ b/boot/getnodeid.php @@ -0,0 +1,29 @@ + +// Copyright (C) 2006 The Trustees of Princeton University +// +// $Id$ $ +// + +// Get admin API handle +require_once 'plc_api.php'; +global $adm; + +if (!empty($_REQUEST['mac_addr'])) { + $mac_lower = strtolower(trim($_REQUEST['mac_addr'])); + $mac_upper = strtoupper(trim($_REQUEST['mac_addr'])); + $nodenetworks = $adm->GetNodeNetworks(array('mac' => array($mac_lower, $mac_upper))); +} else { + $nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); +} + +if (!empty($nodenetworks)) { + print $nodenetworks[0]['node_id']; +} else { + print "-1"; +} + +?> diff --git a/boot/index.php b/boot/index.php new file mode 100755 index 0000000..ba7dc7b --- /dev/null +++ b/boot/index.php @@ -0,0 +1,80 @@ + +// Copyright (C) 2006 The Trustees of Princeton University +// +// $Id$ $ +// + +// Get admin API handle +require_once 'plc_api.php'; +global $adm; + +// Default bootmanager +$bootmanager = "bootmanager.sh.sgn"; + +// 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]; + } +} + +if (isset($node)) { + // Allow very old nodes that do not have a node key in their + // configuration files to use their "boot nonce" instead. The boot + // nonce is a random value generated by the node itself and POSTed + // by the Boot CD when it requests the Boot Manager. This is + // obviously not very secure, so we only allow it to be used if the + // requestor IP is the same as the IP address we have on record for + // the node. + + // 3.x CDs post 'version', 2.x CDs post 'id'. + if (!empty($_REQUEST['version'])) { + $version = trim($_REQUEST['version']); + } elseif (!empty($_REQUEST['id'])) { + $version = trim($_REQUEST['id']); + } else { + $version = "2.0"; + } + + if (empty($node['key']) && !empty($_REQUEST['nonce'])) { + // 3.x CDs post the boot nonce in ASCII hex. 2.x CDs post it in binary. + if (strstr($version, "2.0") === FALSE) { + // 3.x CDs post a trailing newline...sigh + $nonce = trim($_REQUEST['nonce']); + } else { + $nonce = bin2hex($_REQUEST['nonce']); + } + $adm->UpdateNode($node['node_id'], array('boot_nonce' => $nonce)); + } + + // Custom bootmanager for the node, e.g. + // planetlab-1.cs.princeton.edu_bootmanager.sh.sgn + $bootmanagers = array(strtolower($node['hostname']) . "_" . $bootmanager); + + // Custom bootmanager for the node group, e.g. + // alpha_bootmanager.sh.sgn + if (!empty($node['nodegroup_ids'])) { + $nodegroups = $adm->GetNodeGroups($node['nodegroup_ids']); + foreach ($nodegroups as $nodegroup) { + $bootmanagers[] = strtolower($nodegroup['name']) . "_" . $bootmanager; + } + } +} + +// Default bootmanager +$bootmanagers[] = $bootmanager; + +foreach ($bootmanagers as $bootmanager) { + if (file_exists($bootmanager)) { + readfile($bootmanager); + exit(); + } +} + +?> diff --git a/boot/uudecode.gz b/boot/uudecode.gz new file mode 100755 index 0000000..040c34f Binary files /dev/null and b/boot/uudecode.gz differ diff --git a/nodeconfig.spec b/nodeconfig.spec index ef5e128..c5caab0 100644 --- a/nodeconfig.spec +++ b/nodeconfig.spec @@ -48,14 +48,18 @@ rm -rf $RPM_BUILD_ROOT echo "* nodeconfig: Installing PlanetLabConf pages" -mkdir -p $RPM_BUILD_ROOT/var/www/html/PlanetLabConf +for dir in boot PlanetLabConf PLCAPI ; do + mkdir -p $RPM_BUILD_ROOT/var/www/html/$dir +done # let's be conservative and exclude codebase files, though there should not be any -rsync -a --exclude \*.spec --exclude .svn --exclude CVS ./ $RPM_BUILD_ROOT/var/www/html/PlanetLabConf +rsync -a --exclude \*.spec --exclude .svn --exclude CVS ./ $RPM_BUILD_ROOT/var/www/html/ %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) +/var/www/html/boot /var/www/html/PlanetLabConf +/var/www/html/PLCAPI