From: Thierry Parmentelat Date: Mon, 25 Jan 2010 14:42:17 +0000 (+0000) Subject: Branch 5.0 for module nodeconfig created (as new trunk) from tag nodeconfig-4.3-7 X-Git-Tag: nodeconfig-5.0-0^0 X-Git-Url: http://git.onelab.eu/?p=nodeconfig.git;a=commitdiff_plain;h=30b599a198824f635775f2d22ab6c536fa4e77a7;hp=4e706ba83f612797e4f7b946f16c03d1a05516a0 Branch 5.0 for module nodeconfig created (as new trunk) from tag nodeconfig-4.3-7 --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dce5ef7 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +### $Id$ +# +# how to push a working directoy to a running plc +# + +tags: + find . -type f | grep -v '/\.svn/' | egrep -v '/(uudecode.gz|tags|TAGS)$$' | xargs etags + +.PHONY: tags + +########## make sync PLCHOST=hostname VSERVER=vservername +ifdef PLCHOST +ifdef VSERVER +PLCSSH:=root@$(PLCHOST):/vservers/$(VSERVER) +endif +endif + +LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' +RSYNC_EXCLUDES := --exclude .svn --exclude CVS --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES) +RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,) +RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES) + +sync: +ifeq (,$(PLCSSH)) + echo "sync: You must define PLCHOST and VSERVER on the command line" + echo " e.g. make sync PLCHOST=private.one-lab.org VSERVER=myplc01" ; exit 1 +else + +$(RSYNC) PlanetLabConf boot PLCAPI $(PLCSSH)/var/www/html/ + ssh root@$(PLCHOST) vserver $(VSERVER) exec apachectl graceful +endif + diff --git a/PlanetLabConf/RPM-GPG-KEY-fedora b/PlanetLabConf/RPM-GPG-KEY-fedora deleted file mode 100755 index 17d4ec7..0000000 --- a/PlanetLabConf/RPM-GPG-KEY-fedora +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.0.7 (GNU/Linux) - -mQGiBD+dnTsRBACwnlz4AhctOLlVBAsq+RaU82nb5P3bD1YJJpsAce1Ckd2sBUOJ -D11NUCqH8c7EctOquOZ5zTcWxHiWWbLyKQwUw2SUvnWa5SSbi8kI8q9MTPsPvhwt -gMrQMLenMO+nsrxrSaG6XcD+ssfJNxC7NQVCQAj3pvvg9rKi3ygsM7CXHwCghgsq -X6TOr55HE90DbEsoq3b/jjsD/i8aIZ6urUgrpAkQslcakXdJLKgSdwjRUgVZgvYZ -b7kAx1iPq0t/AhB3NJw3zW4AAKJohGg3xj5K4V8PJEZrSIpoRYlF43Kqlfu2p5gh -WT89SP4YAlWPeTqf0+dTYUYz3b144k2ZFOdRuXIRxunoYNAUr9oMrxBXbJ/eY+0U -QX3pBACYzKizyY4JJgd0zFJmNkcdK9nzcm+btYFnYQo33w5GSE686UNr+9yiXt9t -mPRvNEbj3u+xoAX8B/5k3aZ5NbUhV64/VcKlUdRIxNlFCG7I9KgxeHWAYwi7yqOG -XM3T/v6o7GLdQEB0ChFqS7kUlqmwLV+C3QhlrFe/Cuk26i+Q6rQiRmVkb3JhIFBy -b2plY3QgPGZlZG9yYUByZWRoYXQuY29tPohbBBMRAgAbBQI/nZ07BgsJCAcDAgMV -AgMDFgIBAh4BAheAAAoJELRCadBPKm/S2PAAnRTlhorITphab+oxAHtbxZF9BVyD -AJ9WOVaZUG53IWWIAXOGv3j/cmr3lohGBBMRAgAGBQI/nZ22AAoJECGRgM3bQqYO -R5QAoIp1G+omVktq/snxpmz5UeHjlSYjAKCRr/ea/L7S7ZTxB18cf1TYfad1x4hG -BBARAgAGBQI/ntjgAAoJECnVuiSN9W0FUSUAoJnrone4J0o1HMkRz+6g9KVuO2Fy -AJ0XyebOzVmI9U5OyOfnNmYV0wnQcrkBDQQ/nZ08EAQAugOfLWJbKwMA9vg2mJU5 -94TZU0HRJkx/fqYhx0YxWWRpzplrEyvcDXuYcWi1Hwh0tD86T4fR5GV6joWiWClz -D+Hwhhb6gcSdeSGlGLlZAvWYtFSHWiv+3LaI9w8Vtczl99Bh2WiMDNDDGw0RQg6Z -aftldLSe4j1pffpFGQ8SuisAAwUEAKVxqLT7fC5xQ6oclcZ+PhoDlePQ1BiTS7tu -GM07bFF4nNvY91LL7S31pooz3XbGSWP8jxzSv1Fw35YhSmWGOBOEXluqMbVQGJJ5 -m8fqJOjC0imbfeWgr/T7zLrJeiljDxvX+6TyawyWQngF6v1Hq6FRV0O0bOp9Npt5 -zqCbDGs/iEYEGBECAAYFAj+dnTwACgkQtEJp0E8qb9L//gCcDVYnDegNCOxDn1se -dDwxw+0h8OcAn1CZHof15QqxnTwEnvwF2QeOI5dn -=mJAx ------END PGP PUBLIC KEY BLOCK----- diff --git a/PlanetLabConf/RootResources/pl_conf.py b/PlanetLabConf/RootResources/pl_conf.py deleted file mode 100755 index 0a156df..0000000 --- a/PlanetLabConf/RootResources/pl_conf.py +++ /dev/null @@ -1,29 +0,0 @@ -# RootResources/pl_conf - -PL_CONF_VINIT = """#!/bin/sh - -# crond needs syslogd running -/sbin/chkconfig syslog on - -# use crond to check for updates -/sbin/chkconfig crond on - -cat </etc/cron.daily/yum-upgrade -#!/bin/sh - -rm -f /var/lib/rpm/__db* -yum -y upgrade -EOF -chmod a+x /etc/cron.daily/yum-upgrade - -PACKAGE=sidewinder-PlanetLab-SCS -rm -f /var/lib/rpm/__db* -yum -y install $PACKAGE -""" - -try: - pl_conf = RootSlice(nm_vserver_flags = "static", - nm_cpu_share = 32, - nm_initscript = PL_CONF_VINIT) -except: - pass diff --git a/PlanetLabConf/RootResources/pl_netflow.py b/PlanetLabConf/RootResources/pl_netflow.py deleted file mode 100755 index 5d5a4dd..0000000 --- a/PlanetLabConf/RootResources/pl_netflow.py +++ /dev/null @@ -1,7 +0,0 @@ -# RootResources/pl_netflow - -try: - pl_netflow = RootSlice(nm_vserver_flags = "syncstart", - nm_cpu_share = 32) -except: - pass diff --git a/PlanetLabConf/RootResources/plc_slice_pool.php b/PlanetLabConf/RootResources/plc_slice_pool.php deleted file mode 100755 index a61a656..0000000 --- a/PlanetLabConf/RootResources/plc_slice_pool.php +++ /dev/null @@ -1,22 +0,0 @@ - -# RootResources/plc_slice_pool - -SA_HOST = "" -SA_URL = SA_HOST + "/xml/" -CACERT_PATH = "/mnt/cdrom/bootme/cacert/%s/cacert.pem" % SA_HOST - -plc_slice_pool = RootPool(slice = "pl_conf", - plc_sa_prefix = "pl", - plc_sa_server = SA_URL, - plc_sa_cacert = CACERT_PATH, - nm_pool_child_type = "VServerSlice", - nm_cpu_share = RES_INF, - nm_net_avg_rate = RES_INF, - nm_net_min_rate = RES_INF, - nm_net_max_rate = RES_INF, - nm_net_exempt_avg_rate = RES_INF, - nm_net_exempt_min_rate = RES_INF, - nm_net_exempt_max_rate = RES_INF, - nm_disk_quota = RES_INF) diff --git a/PlanetLabConf/blacklist.php b/PlanetLabConf/blacklist.php index 8966f6d..33a04f9 100755 --- a/PlanetLabConf/blacklist.php +++ b/PlanetLabConf/blacklist.php @@ -21,10 +21,20 @@ require_once 'plc_api.php'; global $adm; +// backwards compatibility with the old 4.2 API +global $__PLC_API_VERSION; +if ( ! method_exists ($adm,"GetInterfaces")) + $__PLC_API_VERSION = 4.2; +else + $__PLC_API_VERSION = 4.3; + // Look up the node -$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); -if (!empty($nodenetworks)) { - $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id'])); +if ($__PLC_API_VERSION==4.2) + $interfaces = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); +else + $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); +if (!empty($interfaces)) { + $nodes = $adm->GetNodes(array($interfaces[0]['node_id'])); if (!empty($nodes)) { $node = $nodes[0]; } diff --git a/PlanetLabConf/bwlimit.php b/PlanetLabConf/bwlimit.php deleted file mode 100755 index 3e3cbc9..0000000 --- a/PlanetLabConf/bwlimit.php +++ /dev/null @@ -1,34 +0,0 @@ - -// Copyright (C) 2006 The Trustees of Princeton University -// -// $Id$ -// - -// Get admin API handle -require_once 'plc_api.php'; -global $adm; - -// Look up the node -$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); -if (!empty($nodenetworks)) { - if ($nodenetworks[0]['bwlimit'] !== NULL) { - $rate = $nodenetworks[0]['bwlimit']; - if ($rate >= 1000000000 && ($rate % 1000000000) == 0) { - printf("%.0fgbit", ($rate / 1000000000.)); - } elseif ($rate >= 1000000 && ($rate % 1000000) == 0) { - printf("%.0fmbit", ($rate / 1000000.)); - } elseif ($rate >= 1000) { - printf("%.0fkbit", ($rate / 1000.)); - } else { - printf("%.0fbit", $rate); - } - } else { - print "-1"; - } -} - -?> \ No newline at end of file diff --git a/PlanetLabConf/extensions.php b/PlanetLabConf/extensions.php new file mode 100755 index 0000000..53807bb --- /dev/null +++ b/PlanetLabConf/extensions.php @@ -0,0 +1,12 @@ +GetNodeExtensions($node_id); +} + +?> + diff --git a/PlanetLabConf/get_plc_config.php b/PlanetLabConf/get_plc_config.php index 6102a15..3d83056 100755 --- a/PlanetLabConf/get_plc_config.php +++ b/PlanetLabConf/get_plc_config.php @@ -11,6 +11,8 @@ // Try the new plc_config.php file first include 'plc_config.php'; +require_once 'plc_api.php'; +global $adm; if (isset($_REQUEST['perl'])) { $shebang = '#!/usr/bin/perl'; @@ -31,21 +33,69 @@ if (isset($_REQUEST['perl'])) { } echo $shebang . "\n"; +$limit_view = True; -foreach (array('PLC_API_HOST', 'PLC_API_PATH', 'PLC_API_PORT', - 'PLC_WWW_HOST', 'PLC_BOOT_HOST', 'PLC_PLANETFLOW_HOST', - 'PLC_NAME', 'PLC_SLICE_PREFIX', - 'PLC_MAIL_SUPPORT_ADDRESS', - 'PLC_MAIL_MOM_LIST_ADDRESS', - 'PLC_MAIL_SLICE_ADDRESS') - as $name) { - if (defined($name)) { - // Perl, PHP, Python, and sh all support strong single quoting - $value = "'" . str_replace("'", "\\'", constant($name)) . "'"; - printf($format, $name, $value); - } +if (isset($_REQUEST['node_id']) ) { + $node_id = intval($_REQUEST['node_id']); +} else { + $node_id = 0; +} + + +if ($node_id) { + $nodes = $adm->GetNodes($node_id); + if (!empty($nodes)) { + $node = $nodes[0]; + $tags = $adm->GetNodeTags(array('node_id' => $node_id, + 'tagname' => 'infrastructure')); + if (!empty($tags)) { + $tag = $tags[0]; + if ( intval($tag['value']) == 1 ) { + $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); + if (!empty($interfaces)) { + $nodes = $adm->GetNodes(array($interfaces[0]['node_id'])); + if (!empty($nodes)) { + $node = $nodes[0]; + if ( $node['node_id'] == $node_id ) + { + # NOTE: only provide complete view if + # node exists + # node has infrastrucure tag + # infrastructure tag value == 1 + # Check that the requestor is the node. + $limit_view = False; + } + } + } + } + } + } } +if ( $limit_view ) { + $plc_constants = array('PLC_API_HOST', 'PLC_API_PATH', 'PLC_API_PORT', + 'PLC_WWW_HOST', 'PLC_BOOT_HOST', 'PLC_PLANETFLOW_HOST', + 'PLC_NAME', 'PLC_SLICE_PREFIX', 'PLC_MONITOR_HOST', + 'PLC_MAIL_SUPPORT_ADDRESS', + 'PLC_MAIL_MOM_LIST_ADDRESS', + 'PLC_MAIL_SLICE_ADDRESS'); +} else { + $plc_constants = array(); + $const = get_defined_constants(true); + foreach ( $const['user'] as $name => $v ){ + if ( preg_match('/^PLC_/', $name) == 1 ){ + $plc_constants[] = $name; + } + } +} + +foreach ($plc_constants as $name) { + if (defined($name)) { + // Perl, PHP, Python, and sh all support strong single quoting + $value = "'" . str_replace("'", "\\'", constant($name)) . "'"; + printf($format, $name, $value); + } +} printf($format, 'PLC_API_CA_SSL_CRT', "'/usr/boot/cacert.pem'"); printf($format, 'PLC_ROOT_GPG_KEY_PUB', "'/usr/boot/pubring.gpg'"); diff --git a/PlanetLabConf/getupdatesxml.php b/PlanetLabConf/getupdatesxml.php deleted file mode 100755 index 8ca522b..0000000 --- a/PlanetLabConf/getupdatesxml.php +++ /dev/null @@ -1,137 +0,0 @@ - -// Mark Huang -// -// Copyright (C) 2006 The Trustees of Princeton University -// -// $Id$ -// - -// Get admin API handle -require_once 'plc_api.php'; -global $adm; - -function writeXMLHeader() -{ - print( "\n\n" ); -} - -define("ENT_UNPARSED", 0); // i.e., CDATA -define("ENT_PARSED", 1); // i.e., PCDATA (attributes) - -function xmlspecialchars_decode($string, $parsed = ENT_UNPARSED) -{ - if ($parsed == ENT_PARSED) { - // & to & - // ' to ' - // < to < - // > to > - // " to " - return str_replace('&', '&', - str_replace(array(''', '<', '>', '"'), - array("'", '<', '>', '"'), - $string)); - } else { - // & to & - // ' to ' - // < to < - // > to > - // \" to " - // \\ to \ - return str_replace('&', '&', - str_replace(array(''', '<', '>', '\"', '\\'), - array("'", '<', '>', '"', "\\"), - $string)); - } -} - -function xmlspecialchars($string, $parsed = ENT_UNPARSED) -{ - if ($parsed == ENT_PARSED) { - // & to & - // ' to ' - // < to < - // > to > - // " to " - $string = str_replace(array("'", '<', '>', '"'), - array(''', '<', '>', '"'), - str_replace('&', '&', $string)); - } else { - // & to & - // ' to ' - // < to < - // > to > - // " to \" - // \ to \\ - $string = str_replace(array("'", '<', '>', '"'), - array(''', '<', '>', '\"'), - str_replace(array('&', "\\"), - array('&', '\\'), - $string)); - } - - return utf8_encode($string); -} - -// Look up the node -if (!empty($_REQUEST['node_id'])) { - $node = $adm->GetSlivers(intval($_REQUEST['node_id'])); -} else { - $nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); - if (!empty($nodenetworks)) { - $node = $adm->GetSlivers($nodenetworks[0]['node_id']); - } -} - -if (empty($node)) { - exit(); -} -$node_id = $node['node_id']; - -writeXMLHeader(); -$curtime= time(); -print( "\n" ); -print( "\n" ); - -foreach( $node['conf_files'] as $conf_file ) -{ - $source = xmlspecialchars($conf_file["source"]); - $dest = xmlspecialchars($conf_file["dest"]); - $file_permissions = xmlspecialchars($conf_file["file_permissions"]); - $file_owner = xmlspecialchars($conf_file["file_owner"]); - $file_group = xmlspecialchars($conf_file["file_group"]); - $preinstall_cmd = xmlspecialchars($conf_file["preinstall_cmd"]); - $postinstall_cmd = xmlspecialchars($conf_file["postinstall_cmd"]); - $error_cmd = xmlspecialchars($conf_file["error_cmd"]); - $ignore_cmd_errors = $conf_file["ignore_cmd_errors"]; - $always_update = $conf_file["always_update"]; - - if( $ignore_cmd_errors == 1 ) - $ignore_cmd_errors= "y"; - else - $ignore_cmd_errors= "n"; - - if( $always_update == 1 ) - $always_update= "y"; - else - $always_update= "n"; - - print( "\n" ); - print( "$source\n" ); - print( "$dest\n" ); - print( "$file_permissions\n" ); - print( "$file_owner\n" ); - print( "$file_group\n" ); - print( "$preinstall_cmd\n" ); - print( "$postinstall_cmd\n" ); - print( "$error_cmd\n" ); - print( "\n" ); -} - -print( "\n" ); -print( "\n" ); - -?> diff --git a/PlanetLabConf/iptables b/PlanetLabConf/iptables deleted file mode 100755 index 1690448..0000000 --- a/PlanetLabConf/iptables +++ /dev/null @@ -1,34 +0,0 @@ -# -# /etc/sysconfig/iptables -# -# post: service iptables restart -# -# PlanetLab standard filter chains -# -# $Id$ -# - - -*mangle -:PREROUTING ACCEPT [0:0] -:INPUT ACCEPT [0:0] -:FORWARD ACCEPT [0:0] -:OUTPUT ACCEPT [0:0] -:POSTROUTING ACCEPT [0:0] --A POSTROUTING -j MARK --copy-xid 0x0 --A INPUT -i ! lo -j MARK --copy-xid 0x0 -COMMIT - -*filter -:INPUT ACCEPT [0:0] -:FORWARD ACCEPT [0:0] -:OUTPUT ACCEPT [0:0] -:BLACKLIST - [0:0] -:LOGDROP - [0:0] --A OUTPUT -j BLACKLIST --A LOGDROP -j LOG --A LOGDROP -j DROP --A OUTPUT -o eth0 -j ULOG --ulog-cprange 54 --ulog-qthreshold 16 -COMMIT - - diff --git a/PlanetLabConf/keys.php b/PlanetLabConf/keys.php index 58721b0..5fca766 100755 --- a/PlanetLabConf/keys.php +++ b/PlanetLabConf/keys.php @@ -1,8 +1,8 @@ GetPersons(array('roles' => array($_REQUEST['role']))); $all_persons = $adm->GetPersons(); foreach ($all_persons as $person) { @@ -33,57 +33,56 @@ if (!empty($_REQUEST['role'])) { } } } -if (isset($_REQUEST[PLC_SLICE_PREFIX . '_monitor'])) { - $user = $adm->GetPersons(array('first_name' => 'Site', 'last_name' => 'Assistant')); - if (!empty($user)) { - $persons[] = $user[0]; - } -} -if (isset($_REQUEST['site_admin'])) { - // 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]; - } +// +// NOTE: this user is not used by the monitor for the moment. +// +/* // {ple,pl}_monitor user is created on the nodes by the monitor-runlevelagent init script. */ +/* if (isset($_REQUEST[PLC_SLICE_PREFIX . '_monitor'])) { */ +/* $user = $adm->GetPersons(array('first_name' => 'Site', 'last_name' => 'Assistant')); */ +/* if (!empty($user)) { */ +/* $persons[] = $user[0]; */ +/* } */ +/* } */ + +if (isset($_REQUEST['site_admin']) && isset($_REQUEST['node_id'])) { + $nodes = $adm->GetNodes(array(intval($_REQUEST['node_id']))); + if (!empty($nodes)) { + $node = $nodes[0]; } if (isset($node)) { // Look up the site $sites = $adm->GetSites(array($node['site_id'])); - // Can't filter on roles so have to bruit force through entire userlist of site. + // Can't filter on roles so have to brute force through entire userlist of site. if ($sites && $sites[0]['person_ids']) { $all_persons = $adm->GetPersons($sites[0]['person_ids']); - foreach ($all_persons as $person) { - if ((in_array('pi', $person['roles']) || in_array('tech', $person['roles'])) && - $person['enabled']) { - $persons[] = $person; - } - } + if (!empty($all_persons)) + foreach ($all_persons as $person) + if ((in_array('pi', $person['roles']) || in_array('tech', $person['roles'])) && $person['enabled']) + $persons[] = $person; } } } -if (isset($_REQUEST['root'])) { +if (isset($_REQUEST['root'])) $keys[] = array('key' => file_get_contents(PLC_ROOT_SSH_KEY_PUB)); -} if (!empty($persons)) { $key_ids = array(); foreach ($persons as $person) { - if ($person['key_ids']) { - $key_ids[] = $person['key_ids'][0]; - } + if ($person['key_ids']) { + $person_key_ids = $person['key_ids']; + foreach ($person_key_ids as $person_key_id) { + $key_ids[] = $person_key_id; + } + } } - if (!empty($key_ids)) { + if (!empty($key_ids)) $keys = $adm->GetKeys($key_ids); - } } -foreach ($keys as $key) { +foreach ($keys as $key) print $key['key']. "\n"; -} ?> diff --git a/PlanetLabConf/ntp.conf.php b/PlanetLabConf/ntp.conf.php index 4676c23..afd0d76 100755 --- a/PlanetLabConf/ntp.conf.php +++ b/PlanetLabConf/ntp.conf.php @@ -18,9 +18,15 @@ $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'])); + +// backwards compatibility with the old 4.2 API +if ( ! method_exists ($adm,"GetInterfaces")) + $interfaces = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); +else + $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); + +if (!empty($interfaces)) { + $nodes = $adm->GetNodes(array($interfaces[0]['node_id'])); if (!empty($nodes)) { $node = $nodes[0]; } @@ -42,6 +48,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 */ @@ -95,4 +105,4 @@ else { readfile($file_name); } -?> \ No newline at end of file +?> diff --git a/PlanetLabConf/ntp/ntp.conf.au b/PlanetLabConf/ntp/ntp.conf.au index aa14dd3..b939b79 100755 --- a/PlanetLabConf/ntp/ntp.conf.au +++ b/PlanetLabConf/ntp/ntp.conf.au @@ -3,4 +3,3 @@ server time.apple.com server pool.ntp.org server ntp.saard.net server ucsd.ron.lcs.mit.edu -server ntp1.linux.medialabs.com diff --git a/PlanetLabConf/ntp/ntp.conf.ch b/PlanetLabConf/ntp/ntp.conf.ch index 62b478e..386b7c9 100755 --- a/PlanetLabConf/ntp/ntp.conf.ch +++ b/PlanetLabConf/ntp/ntp.conf.ch @@ -1,4 +1,2 @@ -server ntp1.theinternetone.net -server ntp2.theinternetone.net -server ntp3.theinternetone.net -server time.alcanet.no +server tock.fh-augsburg.de +server tack.fh-augsburg.de diff --git a/PlanetLabConf/ntp/ntp.conf.cn b/PlanetLabConf/ntp/ntp.conf.cn index 3217953..d37ad09 100755 --- a/PlanetLabConf/ntp/ntp.conf.cn +++ b/PlanetLabConf/ntp/ntp.conf.cn @@ -1,5 +1,3 @@ -server s2a.time.edu.cn -server s2b.time.edu.cn server clock.redhat.com server time.apple.com server pool.ntp.org diff --git a/PlanetLabConf/ntp/ntp.conf.de b/PlanetLabConf/ntp/ntp.conf.de index bb193ea..80bfa5c 100755 --- a/PlanetLabConf/ntp/ntp.conf.de +++ b/PlanetLabConf/ntp/ntp.conf.de @@ -1,4 +1,3 @@ server tock.fh-augsburg.de -server tack.fh-augsburg.de -server ntp2.theinternetone.net -server ntp3.theinternetone.net +server timeserver.rwth-aachen.de +server clock.redhat.com diff --git a/PlanetLabConf/ntp/ntp.conf.dk b/PlanetLabConf/ntp/ntp.conf.dk index ab41c82..a58a691 100755 --- a/PlanetLabConf/ntp/ntp.conf.dk +++ b/PlanetLabConf/ntp/ntp.conf.dk @@ -1,6 +1,2 @@ -server ntp1.theinternetone.net -server ntp2.theinternetone.net -server ntp3.theinternetone.net -server time.alcanet.no server clock.netcetera.dk server clock2.netcetera.dk diff --git a/PlanetLabConf/ntp/ntp.conf.eurecom.fr b/PlanetLabConf/ntp/ntp.conf.eurecom.fr index 1b66d3f..648bbeb 100755 --- a/PlanetLabConf/ntp/ntp.conf.eurecom.fr +++ b/PlanetLabConf/ntp/ntp.conf.eurecom.fr @@ -1,6 +1,3 @@ server ntp.univ-lyon1.fr minpoll 5 server ntp1.tuxfamily.net minpoll 5 server ntp2.tuxfamily.net minpoll 5 -server ntp1.theinternetone.net minpoll 5 -server ntp2.theinternetone.net minpoll 5 -server ntp3.theinternetone.net minpoll 5 diff --git a/PlanetLabConf/ntp/ntp.conf.fr b/PlanetLabConf/ntp/ntp.conf.fr index 3041606..449dd1f 100755 --- a/PlanetLabConf/ntp/ntp.conf.fr +++ b/PlanetLabConf/ntp/ntp.conf.fr @@ -1,6 +1,3 @@ server ntp.univ-lyon1.fr server ntp1.tuxfamily.net server ntp2.tuxfamily.net -server ntp1.theinternetone.net -server ntp2.theinternetone.net -server ntp3.theinternetone.net diff --git a/PlanetLabConf/ntp/ntp.conf.ipv6.lip6.fr b/PlanetLabConf/ntp/ntp.conf.ipv6.lip6.fr index 3a5e610..449dd1f 100755 --- a/PlanetLabConf/ntp/ntp.conf.ipv6.lip6.fr +++ b/PlanetLabConf/ntp/ntp.conf.ipv6.lip6.fr @@ -1,7 +1,3 @@ -server 132.227.74.33 server ntp.univ-lyon1.fr server ntp1.tuxfamily.net server ntp2.tuxfamily.net -server ntp1.theinternetone.net -server ntp2.theinternetone.net -server ntp3.theinternetone.net diff --git a/PlanetLabConf/ntp/ntp.conf.tp.pl b/PlanetLabConf/ntp/ntp.conf.tp.pl new file mode 100755 index 0000000..d628c27 --- /dev/null +++ b/PlanetLabConf/ntp/ntp.conf.tp.pl @@ -0,0 +1,2 @@ +server ntp1.tp.pl +server ntp2.tp.pl diff --git a/PlanetLabConf/ntp/ntp.conf.tpnet.pl b/PlanetLabConf/ntp/ntp.conf.tpnet.pl new file mode 100755 index 0000000..d628c27 --- /dev/null +++ b/PlanetLabConf/ntp/ntp.conf.tpnet.pl @@ -0,0 +1,2 @@ +server ntp1.tp.pl +server ntp2.tp.pl diff --git a/PlanetLabConf/ntp/step-tickers.php b/PlanetLabConf/ntp/step-tickers.php index 98d0cc2..7fc31ce 100755 --- a/PlanetLabConf/ntp/step-tickers.php +++ b/PlanetLabConf/ntp/step-tickers.php @@ -18,9 +18,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'])); +$interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); +if (!empty($interfaces)) { + $nodes = $adm->GetNodes(array($interfaces[0]['node_id'])); if (!empty($nodes)) { $node = $nodes[0]; } @@ -77,4 +77,4 @@ foreach ($lines as $line_num => $line) { } } -?> \ No newline at end of file +?> diff --git a/PlanetLabConf/ntptickers.php b/PlanetLabConf/ntptickers.php deleted file mode 100755 index 263fecb..0000000 --- a/PlanetLabConf/ntptickers.php +++ /dev/null @@ -1,53 +0,0 @@ - 0) { - $file_name = $config_directory . $file_prefix . $compare_chunk ; - if (is_file($file_name)) { - $chunk_counter = 0; - $found_file = 1; - } - else { - array_shift($hostname_bits); - $compare_chunk = implode('.',$hostname_bits); - $chunk_counter--; - } -} - -if ($found_file and is_readable($file_name)) { - $lines=file($file_name); -} -else { - $file_name = $config_directory . $file_prefix . $default_name ; - $lines=file($file_name); -} - -foreach ($lines as $line_num => $line) { - $line=rtrim($line); - $elements=explode(' ',$line); - if ($elements[0] == "server") { - print ("$elements[1]\n"); - } -} - -?> - diff --git a/PlanetLabConf/propd.conf b/PlanetLabConf/propd.conf deleted file mode 100755 index dd5a6d0..0000000 --- a/PlanetLabConf/propd.conf +++ /dev/null @@ -1,100 +0,0 @@ -# -# default ACL: -# -# anyone can execute the get_file_flags operation (since it is applied -# within the caller's vserver and the command lsattr gives the same -# info anyway) or get the version string. wait is harmless too since -# the caller needs to know the child ID. and we let any slice unmount -# directories in its own filesystem, mostly as a workaround for some -# Stork problems. -# -*: get_file_flags -*: version -*: wait -+: unmount - -# give Stork permission to mount and unmount client dirs -arizona_stork: mount_dir -arizona_stork: set_file_flags pass, "1" -arizona_stork: set_file_flags_list "1" -arizona_stork: bind_socket sockname=64?:* -arizona_stork2: mount_dir -arizona_stork2: set_file_flags pass, "1" -arizona_stork2: set_file_flags_list "1" -arizona_stork2: bind_socket sockname=64?:* - -# give CoMon the necessary permissions to run slicestat -princeton_slicestat: exec "root", pass, "/usr/local/planetlab/bin/pl-ps", none -princeton_slicestat: exec "root", pass, "/usr/sbin/vtop", "bn1", none -princeton_slicestat: open_file file=/proc/virtual/*/cacct -princeton_slicestat: open_file file=/proc/virtual/*/limit -princeton_comon: open_file file=/var/log/secure -princeton_comon: exec "root", pass, "/bin/df", "/vservers", none - -# give pl_slicedir access to /etc/passwd -pl_slicedir: open_file pass, "/etc/passwd" - -# netflow now runs in a slice so needs various accesses -pl_netflow: open file=/etc/passwd, flags=r -pl_netflow: open_file file=/etc/passwd -pl_netflow: create_socket -pl_netflow: bind_socket - -# nyu_d are building a DNS demux so give them access to port 53 -nyu_d: bind_socket -nyu_oasis: bind_socket - -# QA slices need to be able to create and delete bind-mounts -pl_qa_0: mount_dir -pl_qa_1: mount_dir - -# irb_snort needs packet sockets for tcpdump -irb_snort: create_socket - -# uw_ankur is using netlink sockets to do the same thing as netflow -uw_ankur: create_socket - -# cornell_codons gets access to port 53 for now -cornell_codons: create_socket - -# give Mic Bowman's conf-monitor service read-only access to root fs -# and the ability to run df -idsl_monitor: mount_dir "root:/", pass, "ro" -idsl_monitor: unmount -idsl_monitor: exec "root", pass, "/bin/df", "-P", "/", "/vservers", none - -# give Shark access to port 111 to run portmap -# and port 955 to run mount -nyu_shkr: bind_socket -nyu_shkr: mount_dir "nfs:**:**" -nyu_shkr: exec "root", pass, "/bin/umount", "-l", "/vservers/nyu_shkr/**", none - -# give tsinghua_lgh access to restricted ports -tsinghua_lgh: bind_socket - -# CoDeeN needs port 53 too -princeton_codeen: bind_socket sockname=53:* - -# give ucin_load access to /var/log/wtmp -ucin_load: open_file file=/var/log/wtmp* - -# give google_highground permission to bind port 81 (and raw sockets) -google_highground: bind_socket - -# pl_conf needs access to port 814 -pl_conf: bind_socket sockname=814:* -pl_conf: open file=/home/*/.ssh/authorized_keys - -# give princeton_visp permission to read all packets sent through the -# tap0 device -princeton_visp: open file=/dev/net/tun, flags=rw - -# The PLB group needs the BGP port -princeton_iias: bind_socket sockname=179:* -princeton_visp: bind_socket sockname=179:* -mit_rcp: bind_socket sockname=179:* - -# PL-VINI group -mit_rcp: exec "root", pass, "/usr/bin/chrt" -princeton_iias: exec "root", pass, "/usr/bin/chrt" -uw_arvind: exec "root", pass, "/usr/bin/chrt" diff --git a/PlanetLabConf/proxies.php b/PlanetLabConf/proxies.php index 39b9b39..4431aca 100755 --- a/PlanetLabConf/proxies.php +++ b/PlanetLabConf/proxies.php @@ -3,7 +3,7 @@ # # post: service vnet restart # -# Proxy (a.k.a. network telescope a.k.a. honeypot) nodenetwork configuration +# Proxy (a.k.a. network telescope a.k.a. honeypot) interface configuration # # Aaron Klingaman # Mark Huang @@ -18,9 +18,19 @@ require_once 'plc_api.php'; global $adm; // Look up the node -$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); -if (!empty($nodenetworks)) { - $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id'])); +// backwards compatibility with the old 4.2 API +global $__PLC_API_VERSION; +if ( ! method_exists ($adm,"GetInterfaces")) + $__PLC_API_VERSION = 4.2; +else + $__PLC_API_VERSION = 4.3; +if ($__PLC_API_VERSION==4.2) + $interfaces = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); +else + $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); + +if (!empty($interfaces)) { + $nodes = $adm->GetNodes(array($interfaces[0]['node_id'])); if (!empty($nodes)) { $node = $nodes[0]; } @@ -30,18 +40,21 @@ if (!isset($node)) { exit(); } -$nodenetworks = $adm->GetNodeNetworks($node['nodenetwork_ids']); +if ($__PLC_API_VERSION==4.2) + $interfaces = $adm->GetInterfaces($node['nodenetwork_ids']); +else + $interfaces = $adm->GetInterfaces($node['interface_ids']); -foreach ($nodenetworks as $nodenetwork) { - // XXX PL2896: need nodenetworks.device - switch ($nodenetwork['method']) { +foreach ($interfaces as $interface) { + // XXX PL2896: need interfaces.device + switch ($interface['method']) { case 'tap': $dev = "tap0"; - $types['taps'][$dev][0] = $nodenetwork['ip'] . "/" . $nodenetwork['gateway']; + $types['taps'][$dev][0] = $interface['ip'] . "/" . $interface['gateway']; break; case 'proxy': $dev = "proxy0"; - $types['proxies'][$dev][] = $nodenetwork['ip']; + $types['proxies'][$dev][] = $interface['ip']; break; } } diff --git a/PlanetLabConf/sfa_config.php b/PlanetLabConf/sfa_config.php new file mode 100755 index 0000000..851128e --- /dev/null +++ b/PlanetLabConf/sfa_config.php @@ -0,0 +1,14 @@ + diff --git a/PlanetLabConf/sudoers b/PlanetLabConf/sudoers deleted file mode 100755 index e29525a..0000000 --- a/PlanetLabConf/sudoers +++ /dev/null @@ -1,36 +0,0 @@ -# ----------------------------------------------------------------- -# We're assuming that ssh authentication has already been used, this -# is more risky than I'm comfortable with, but it saves the problem -# of managing a separate password file. -# ----------------------------------------------------------------- -Defaults !authenticate - -# ----------------------------------------------------------------- -# No surpise... root has universal access -# ----------------------------------------------------------------- -root ALL = (ALL) ALL - -# ----------------------------------------------------------------- -# SITE_CMDS are those available to local site administrators -# ----------------------------------------------------------------- -Cmnd_Alias SITE_CMDS = /usr/sbin/vps, \ - /usr/sbin/vpstree, \ - /usr/sbin/vtop, \ - /bin/ps, \ - /usr/bin/pstree, \ - /usr/bin/top, \ - /usr/sbin/tcpdump, \ - /usr/bin/pfgrep, \ - /usr/local/planetlab/bin/pl-catlogs, \ - /sbin/halt, \ - /sbin/reboot, \ - /sbin/shutdown, \ - /usr/bin/passwd -d site_admin, \ - /usr/bin/passwd site_admin, \ - /bin/more /var/log/messages, \ - /bin/more /var/log/nm - -# ----------------------------------------------------------------- -# Site Admins -- accounts with admin privileges on the local nodes -# ----------------------------------------------------------------- -site_admin ALL = SITE_CMDS diff --git a/PlanetLabConf/sysctl-ip_forward.php b/PlanetLabConf/sysctl-ip_forward.php new file mode 100755 index 0000000..1cc7e5b --- /dev/null +++ b/PlanetLabConf/sysctl-ip_forward.php @@ -0,0 +1,59 @@ +GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); +else + $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); + +if (!empty($interfaces)) { + $nodes = $adm->GetNodes(array($interfaces[0]['node_id'])); + if (!empty($nodes)) { + $node = $nodes[0]; + if ($__PLC_API_VERSION==4.2) + $interfaces = $adm->GetInterfaces($node['nodenetwork_ids']); + else + $interfaces = $adm->GetInterfaces($node['interface_ids']); + + foreach ($interfaces as $interface) { + // Nodes with proxy socket interfaces need to be able to forward + // between the fake proxy0 interface and the real interface. + if ($interface['method'] == 'proxy') { + $ip_forward = 1; + break; + } + } + } +} + +?> + +# $Id$ +# +# sysctl configuration file to optionally enable/disable IP forwarding +# +# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and +# sysctl.conf(5) for more details. +# +# This file is generated by NodeManager Configuration Files... +# do not manually edit +# + +# Controls IP packet forwarding +net.ipv4.ip_forward = diff --git a/PlanetLabConf/sysctl.conf b/PlanetLabConf/sysctl.conf new file mode 100644 index 0000000..ce6f512 --- /dev/null +++ b/PlanetLabConf/sysctl.conf @@ -0,0 +1,30 @@ +# Controls the System Request debugging functionality of the kernel +kernel.sysrq = 0 + +# Controls whether core dumps will append the PID to the core filename. +# Useful for debugging multi-threaded applications. +kernel.core_uses_pid = 1 + +# Controls source route verification +net.ipv4.conf.default.rp_filter = 1 + +# TCP window scaling and broken routers +net.ipv4.tcp_moderate_rcvbuf=0 +net.ipv4.tcp_default_win_scale=0 +net.ipv4.tcp_window_scaling=1 + +# Mark only out of window RST segments as INVALID. This setting, among +# other things, allows data to be sent with SYN packets. +net.ipv4.netfilter.ip_conntrack_tcp_be_liberal=1 + +# Fixes dst cache overflow bug +net.ipv4.route.max_size=262144 + +net.ipv4.tcp_congestion_control = cubic +net.ipv4.tcp_moderate_rcvbuf = 0 +net.core.rmem_max = 131071 +net.core.wmem_max = 131071 +net.ipv4.tcp_rmem = 4096 87380 4194304 +net.ipv4.tcp_wmem = 4096 16384 4194304 +net.netfilter.nf_conntrack_icmp_timeout = 60 + diff --git a/PlanetLabConf/sysctl.php b/PlanetLabConf/sysctl.php deleted file mode 100755 index edd8e86..0000000 --- a/PlanetLabConf/sysctl.php +++ /dev/null @@ -1,67 +0,0 @@ - -// Copyright (C) 2006 The Trustees of Princeton University -// -// $Id$ -// - -// Get admin API handle -require_once 'plc_api.php'; -global $adm; - -$ip_forward = 0; - -// 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]; - $nodenetworks = $adm->GetNodeNetworks($node['nodenetwork_ids']); - foreach ($nodenetworks as $nodenetwork) { - // Nodes with proxy socket interfaces need to be able to forward - // between the fake proxy0 interface and the real interface. - if ($nodenetwork['method'] == 'proxy') { - $ip_forward = 1; - break; - } - } - } -} - -?> - -# Kernel sysctl configuration file for Red Hat Linux -# -# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and -# sysctl.conf(5) for more details. - -# $Id$ - -# Controls IP packet forwarding -net.ipv4.ip_forward = - -# Controls source route verification -net.ipv4.conf.default.rp_filter = 1 - -# Controls the System Request debugging functionality of the kernel -kernel.sysrq = 0 - -# Controls whether core dumps will append the PID to the core filename. -# Useful for debugging multi-threaded applications. -kernel.core_uses_pid = 1 - -# TCP window scaling and broken routers -net.ipv4.tcp_moderate_rcvbuf=0 -net.ipv4.tcp_default_win_scale=0 -net.ipv4.tcp_window_scaling=0 - -# Mark only out of window RST segments as INVALID. This setting, among -# other things, allows data to be sent with SYN packets. -net.ipv4.netfilter.ip_conntrack_tcp_be_liberal=1 - -# Fixes dst cache overflow bug -net.ipv4.route.max_size=262144 diff --git a/PlanetLabConf/yum.conf.php b/PlanetLabConf/yum.conf.php deleted file mode 100755 index 9eaf430..0000000 --- a/PlanetLabConf/yum.conf.php +++ /dev/null @@ -1,135 +0,0 @@ - -// Copyright (C) 2004-2006 The Trustees of Princeton University -// -// $Id$ -// - -// For PLC_NAME and PLC_BOOT_HOST -include('plc_config.php'); - -$PLC_NAME = PLC_NAME; -$PLC_BOOT_HOST = PLC_BOOT_HOST; - -$oldrepos = array(array('FedoraCore2Base', 'Fedora Core 2 Base', 'stock-fc2'), - array('FedoraCore2Updates', 'Fedora Core 2 Updates', 'updates-fc2'), - array('ThirdParty', 'Third Party RPMS', '3rdparty')); - -$repos = array(array('ThirdParty', 'Third Party RPMS', '3rdparty')); - - -if (isset($_REQUEST['alpha'])) { - $repos[] = array('PlanetLabAlpha', 'PlanetLab Alpha RPMS', 'planetlab-alpha'); -} elseif (isset($_REQUEST['beta'])) { - $repos[] = array('PlanetLabBeta', 'PlanetLab Beta RPMS', 'planetlab-beta'); -} elseif (isset($_REQUEST['rollout'])) { - $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab-rollout'); -} else { - $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab'); -} - -if (isset($_REQUEST['gpgcheck'])) { - $gpgcheck = $_REQUEST['gpgcheck']; -} else { - $gpgcheck = 0; -} - -// Requesting a mirror list. Yum bombs out completely if a repository -// is (even temporarily) unavailable, so if CoBlitz is down, provide a -// few more options. Make sure that gpgcheck remains enabled. Last -// chance option is ourselves so that yum never fails. -if (isset($_REQUEST['mirrorlist']) && - isset($_REQUEST['repo']) && - isset($_REQUEST['releasever'])) { - $mirrors = array("http://coblitz.codeen.org/coblitz.planet-lab.org/pub/fedora/linux", - "http://fedora.gtlib.cc.gatech.edu/pub/fedora.redhat/linux", - "http://download.fedoraproject.org/pub/fedora/linux", - "http://mirrors.kernel.org/fedora"); - #"ftp://rpmfind.net/linux/fedora", still uses the old style of directory hierarchy - $releasever = $_REQUEST['releasever']; - switch ($_REQUEST['repo']) { - case "base": - if ( intval($releasever) >= 7 ) - { - foreach ($mirrors as $mirror) { - echo "$mirror/releases/$releasever/Everything/\$ARCH/os/\n"; - } - - } else { - foreach ($mirrors as $mirror) { - echo "$mirror/core/$releasever/\$ARCH/os/\n"; - } - } - break; - case "updates": - if ( intval($releasever) >= 7 ) - { - foreach ($mirrors as $mirror) { - echo "$mirror/updates/$releasever/\$ARCH/\n"; - } - - } else { - foreach ($mirrors as $mirror) { - echo "$mirror/core/updates/$releasever/\$ARCH/\n"; - } - } - break; - } - - // Always list ourselves last - echo "https://$PLC_BOOT_HOST/install-rpms/planetlab/\n"; - exit; -} - -// Requesting yum.conf. See above for the mirrorlist definition. -echo << diff --git a/boot/getnodeid.php b/boot/getnodeid.php index 004ce23..fdbf9dd 100755 --- a/boot/getnodeid.php +++ b/boot/getnodeid.php @@ -15,13 +15,13 @@ 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))); + $interfaces = $adm->GetInterfaces(array('mac' => array($mac_lower, $mac_upper))); } else { - $nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); + $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); } -if (!empty($nodenetworks)) { - print $nodenetworks[0]['node_id']; +if (!empty($interfaces)) { + print $interfaces[0]['node_id']; } else { print "-1"; } diff --git a/boot/index.php b/boot/index.php index ba7dc7b..9afe279 100755 --- a/boot/index.php +++ b/boot/index.php @@ -16,9 +16,9 @@ global $adm; $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'])); +$interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); +if (!empty($interfaces)) { + $nodes = $adm->GetNodes(array($interfaces[0]['node_id'])); if (!empty($nodes)) { $node = $nodes[0]; } @@ -62,7 +62,7 @@ if (isset($node)) { if (!empty($node['nodegroup_ids'])) { $nodegroups = $adm->GetNodeGroups($node['nodegroup_ids']); foreach ($nodegroups as $nodegroup) { - $bootmanagers[] = strtolower($nodegroup['name']) . "_" . $bootmanager; + $bootmanagers[] = strtolower($nodegroup['groupname']) . "_" . $bootmanager; } } } diff --git a/boot/upload-bmlog.php b/boot/upload-bmlog.php new file mode 100755 index 0000000..6e29e23 --- /dev/null +++ b/boot/upload-bmlog.php @@ -0,0 +1,112 @@ +GetInterfaces(array("ip"=>$ip)); +if (! empty($interfaces) ) { + $interface=$interfaces[0]; + $node_id=$interface['node_id']; + $nodes=$adm->GetNodes($node_id,array("hostname")); + if (!empty($nodes)) { + $hostname=$nodes[0]['hostname']; + } + } + +// store the actual data in /var/log/bm/raw/2008-11-31-20-02-onelab01.inria.fr-138.96.250.141.txt + +$rawdir=$logdir . "/raw"; +$date=strftime("%Y-%m-%d-%H-%M"); +$log_name=$date . "-" . $hostname . "-" . $ip . ".txt"; +$log_path=$rawdir . "/" . $log_name; +$month=strftime("%Y-%m"); +$time=strftime("%d-%H-%M"); + +mkdir_if_needed ($rawdir); + +//////////////////////////////////////// + +$log=fopen($log_path,"w") or die ("Cannot open logfile "+$log_path); + +$uploaded_name= $_FILES['log']['tmp_name']; +$uploaded_size=filesize($uploaded_name); + +fprintf ($log, "BootManager log created on: %s-%s\n",$month,$time); +fprintf( $log, "From IP: %s\n",$ip); +fprintf( $log, "hostname: %s\n",$hostname); +fprintf ( $log, "uploaded file: %s (%d bytes)\n",$uploaded_name,$uploaded_size); +if ( ( strcmp($hostname,$default_hostname)==0) && ( $uploaded_size >= $limit_bytes) ) { + fprintf ( $log, "contents from an unrecognized IP address was truncated to %d bytes\n",$limit_bytes); + $truncated=TRUE; + $uploaded_size=$limit_bytes; + } else { + $truncated=FALSE; + } + +fprintf( $log, "-----------------\n\n" ); +$uploaded = fopen($uploaded_name,'r'); +$contents = fread($uploaded, $uploaded_size); +fclose($uploaded); +fwrite($log,$contents); +if ($truncated) + fwrite ($log, " ..<" . "truncated" . ">..\n"); +fclose($log); + +//////////////////////////////////////// + +// create symlinks for easy browsing + +// /var/log/bm/per-month/2008-11/onelab1.inria.fr/31-20-02.bmlog +$linkdir=$logdir; +$linkdir=$linkdir . "/per-month"; +mkdir_if_needed ($linkdir); +$linkdir=$linkdir . "/" . $month; +mkdir_if_needed ($linkdir); +$linkdir = $linkdir . "/" . $hostname; +mkdir_if_needed ($linkdir); +$link = $linkdir . "/" . $time ; +symlink ("../../../raw/".$log_name,$link); + +# /var/log/bm/per-hostname/onelab1.inria.fr/2008-11-31-20-02.bmlog +$linkdir=$logdir; +$linkdir=$linkdir . "/per-hostname"; +mkdir_if_needed ($linkdir); +$linkdir=$linkdir . "/" . $hostname; +mkdir_if_needed ($linkdir); +$link = $linkdir . "/" . $month . "-" . $time ; +symlink ("../../raw/".$log_name,$link); + +# /var/log/bm/per-ip/138.96.250.141/2008-11-31-20-02.bmlog +$linkdir=$logdir; +$linkdir=$linkdir . "/per-ip"; +mkdir_if_needed ($linkdir); +$linkdir=$linkdir . "/" . $ip; +mkdir_if_needed ($linkdir); +$link = $linkdir . "/" . $month . "-" . $time ; +symlink ("../../raw/".$log_name,$link); + +?> diff --git a/nodeconfig.spec b/nodeconfig.spec index 0455d8f..17fe645 100644 --- a/nodeconfig.spec +++ b/nodeconfig.spec @@ -1,11 +1,11 @@ # -# $Id: PLCWWW.spec 7881 2008-01-22 14:45:22Z thierry $ +# $Id$ # %define url $URL: svn+ssh://thierry@svn.planet-lab.org/svn/WWW/trunk/PLCWWW.spec $ %define name nodeconfig -%define version 5.0 -%define taglevel 0 +%define version 4.3 +%define taglevel 7 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}} @@ -17,7 +17,8 @@ License: PlanetLab Group: System Environment/Daemons Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -BuildArch: noarch +# cannot do this as of f12 +#BuildArch: noarch Vendor: PlanetLab Packager: PlanetLab Central @@ -26,7 +27,9 @@ URL: %(echo %{url} | cut -d ' ' -f 2) # We use set everywhere Requires: php >= 5.0 -Requires: PLCAPI >= 4.0 +Requires: PLCAPI >= 4.3 +# need the apache user at install-time +Requires: httpd %description @@ -40,30 +43,104 @@ reasons these scripts get installed in /var/www/html/PlanetLabConf. %setup -q %build -echo "There is no build stage for this component." -echo "All files just need to be installed as is from the codebase." +pushd nodeconfig/yum + +KEXCLUDE="exclude=$(../../build/getkexcludes.sh)" + +# expand list of kexcludes +for filein in $(find . -name '*.in') ; do + file=$(echo $filein | sed -e "s,\.in$,,") + sed -e "s,@KEXCLUDE@,$KEXCLUDE,g" $filein > $file +done + +# scan fcdistros and catenate all repos in 'stock.repo' so db-config can be distro-independant + +for fcdistro in $(ls); do + [ -d $fcdistro ] || continue + pushd $fcdistro/yum.myplc.d + rm -f stock.repo + cat *.repo > stock.repo + popd +done + +popd %install rm -rf $RPM_BUILD_ROOT +pushd nodeconfig + echo "* nodeconfig: Installing PlanetLabConf pages" for dir in boot PlanetLabConf PLCAPI ; do mkdir -p $RPM_BUILD_ROOT/var/www/html/$dir + rsync -a --exclude .svn ./$dir/ $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/ + +# the yum area -- se db-config +# expose (fixed) myplc.repo.php as https:///yum/myplc.repo.php +install -D -m 644 ./yum/myplc.repo.php $RPM_BUILD_ROOT/var/www/html/yum/myplc.repo.php +# expose the fcdistro-dependant yum.conf as https:///yum/yum.conf +install -D -m 644 ./yum/%{distroname}/yum.conf $RPM_BUILD_ROOT/var/www/html/yum/yum.conf +# expose the (fcdistro-dependant) stock.repo as https:///yum/stock.repo +install -D -m 644 ./yum/%{distroname}/yum.myplc.d/stock.repo $RPM_BUILD_ROOT/var/www/html/yum/stock.repo + +popd %clean rm -rf $RPM_BUILD_ROOT +%post +# the boot manager upload area +mkdir -p /var/log/bm +chown apache:apache /var/log/bm +chmod 700 /var/log/bm + %files %defattr(-,root,root,-) /var/www/html/boot /var/www/html/PlanetLabConf /var/www/html/PLCAPI +/var/www/html/yum %changelog +* Wed Dec 23 2009 Marc Fiuczynski - nodeconfig-4.3-7 +- - decompose PlanetLabConf/sysctl.php into sysctl.conf and +- sysctl-ip_forward.php. This is in prep of phasing out the latter +- altogether, as enabling ip_forwarding should be something that is +- managed by NM. +- - PlanetLabConf/ntptickers.php migrated PlanetLabConf/ntp/step-tickers.php +- - Added sfa_config.php +- - updated ntp server set for .de (german) nodes. +- - f12 related changes from Thierry/Baris + +* Sun Nov 22 2009 Marc Fiuczynski - nodeconfig-4.3-6 +- For all MyPLC nodes deployed at Polish Telecom (PLC, PLE and CoBlitz), +- use the TP local NTP servers. + +* Mon Sep 07 2009 Thierry Parmentelat - nodeconfig-4.3-5 +- new script for updating the exentions set +- keys.php reviewed +- cleanup useless scripts + +* Sat Jul 04 2009 Stephen Soltesz - nodeconfig-4.3-4 +- add two views to the PLC config data, limited and unlimited. +- unlimited view reports all values. Requires the 'infrastructure=1' tag and +- that the call originates from the node. + +* Fri May 15 2009 Thierry Parmentelat - nodeconfig-4.3-3 +- changes to sysctl.conf for co* relating to tcp window scaling + +* Tue Mar 24 2009 Thierry Parmentelat - nodeconfig-4.3-2 +- renumbered 4.3 +- new script upload-bmlog.php +- attempts to ship decent yum configs for stock repos to nodes +- cleanup old stuff +- attempts to be 4.2 compatible + +* Wed Sep 10 2008 Thierry Parmentelat - nodeconfig-4.3-1 +- reflects new names from the data model + * Tue Apr 22 2008 Thierry Parmentelat - nodeconfig-4.2-4 - keys.php know about monitor - new sudoers.php script diff --git a/yum/centos5/yum.conf b/yum/centos5/yum.conf new file mode 100644 index 0000000..bfff95d --- /dev/null +++ b/yum/centos5/yum.conf @@ -0,0 +1,22 @@ +[main] +reposdir=/etc/yum.myplc.d +pkgpolicy=newest +exactarch=0 +keepcache=0 +cachedir=/var/cache/yum +debuglevel=1 +logfile=/var/log/yum.log +distroverpkg=redhat-release +tolerant=1 +obsoletes=1 +gpgcheck=1 +plugins=0 + +# Note: yum-RHN-plugin doesn't honor this. +metadata_expire=1h + +# Default. +# installonly_limit = 3 + +# PUT YOUR REPOS HERE OR IN separate files named file.repo +# in /etc/yum.repos.d diff --git a/yum/centos5/yum.myplc.d/CentOS-Base.repo.in b/yum/centos5/yum.myplc.d/CentOS-Base.repo.in new file mode 100644 index 0000000..be1e9c2 --- /dev/null +++ b/yum/centos5/yum.myplc.d/CentOS-Base.repo.in @@ -0,0 +1,62 @@ +# CentOS-Base.repo +# +# This file uses a new mirrorlist system developed by Lance Davis for CentOS. +# The mirror system uses the connecting IP address of the client and the +# update status of each mirror to pick mirrors that are updated to and +# geographically close to the client. You should use this for CentOS updates +# unless you are manually picking other mirrors. +# +# If the mirrorlist= does not work for you, as a fall back you can try the +# remarked out baseurl= line instead. +# +# + +[base] +name=CentOS-$releasever - Base +mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os +#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ +@KEXCLUDE@ +gpgcheck=1 +enabled=1 +gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 + +#released updates +[updates] +name=CentOS-$releasever - Updates +mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates +#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ +@KEXCLUDE@ +gpgcheck=1 +enabled=1 +gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 + +#packages used/produced in the build but not released +[addons] +name=CentOS-$releasever - Addons +mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons +#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/ +@KEXCLUDE@ +gpgcheck=1 +enabled=0 +gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 + +#additional packages that may be useful +[extras] +name=CentOS-$releasever - Extras +mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras +#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ +@KEXCLUDE@ +gpgcheck=1 +enabled=0 +gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 + +#additional packages that extend functionality of existing packages +[centosplus] +name=CentOS-$releasever - Plus +mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus +#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ +@KEXCLUDE@ +gpgcheck=1 +enabled=0 +gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 + diff --git a/yum/centos5/yum.myplc.d/epel.repo.in b/yum/centos5/yum.myplc.d/epel.repo.in new file mode 100644 index 0000000..1a844c1 --- /dev/null +++ b/yum/centos5/yum.myplc.d/epel.repo.in @@ -0,0 +1,29 @@ +[epel] +name=Extra Packages for Enterprise Linux 5 - $basearch +#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch +failovermethod=priority +@KEXCLUDE@ +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL + +[epel-debuginfo] +name=Extra Packages for Enterprise Linux 5 - $basearch - Debug +#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch +failovermethod=priority +@KEXCLUDE@ +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL +gpgcheck=1 + +[epel-source] +name=Extra Packages for Enterprise Linux 5 - $basearch - Source +#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch +failovermethod=priority +@KEXCLUDE@ +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL +gpgcheck=1 diff --git a/yum/f10/yum.conf b/yum/f10/yum.conf new file mode 100644 index 0000000..13046c8 --- /dev/null +++ b/yum/f10/yum.conf @@ -0,0 +1,10 @@ +[main] +reposdir=/etc/yum.myplc.d +cachedir=/var/cache/yum +debuglevel=1 +logfile=/var/log/yum.log +lockfile=/var/lock/yum.pid +pkgpolicy=newest +distroverpkg=fedora-release +installonlypkgs= +exactarch=0 diff --git a/yum/f10/yum.myplc.d/fedora-updates.repo.in b/yum/f10/yum.myplc.d/fedora-updates.repo.in new file mode 100644 index 0000000..2323288 --- /dev/null +++ b/yum/f10/yum.myplc.d/fedora-updates.repo.in @@ -0,0 +1,29 @@ +[updates] +name=Fedora $releasever - $basearch - Updates +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch +@KEXCLUDE@ +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora + +[updates-debuginfo] +name=Fedora $releasever - $basearch - Updates - Debug +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/debug/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-f$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora + +[updates-source] +name=Fedora $releasever - Updates Source +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/SRPMS/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-f$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora diff --git a/yum/f10/yum.myplc.d/fedora.repo.in b/yum/f10/yum.myplc.d/fedora.repo.in new file mode 100644 index 0000000..b7cea58 --- /dev/null +++ b/yum/f10/yum.myplc.d/fedora.repo.in @@ -0,0 +1,29 @@ +[fedora] +name=Fedora $releasever - $basearch +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch +@KEXCLUDE@ +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY + +[fedora-debuginfo] +name=Fedora $releasever - $basearch - Debug +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY + +[fedora-source] +name=Fedora $releasever - Source +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY diff --git a/yum/f12/yum.conf b/yum/f12/yum.conf new file mode 100644 index 0000000..13046c8 --- /dev/null +++ b/yum/f12/yum.conf @@ -0,0 +1,10 @@ +[main] +reposdir=/etc/yum.myplc.d +cachedir=/var/cache/yum +debuglevel=1 +logfile=/var/log/yum.log +lockfile=/var/lock/yum.pid +pkgpolicy=newest +distroverpkg=fedora-release +installonlypkgs= +exactarch=0 diff --git a/yum/f12/yum.myplc.d/fedora-updates.repo.in b/yum/f12/yum.myplc.d/fedora-updates.repo.in new file mode 100644 index 0000000..2323288 --- /dev/null +++ b/yum/f12/yum.myplc.d/fedora-updates.repo.in @@ -0,0 +1,29 @@ +[updates] +name=Fedora $releasever - $basearch - Updates +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch +@KEXCLUDE@ +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora + +[updates-debuginfo] +name=Fedora $releasever - $basearch - Updates - Debug +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/debug/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-f$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora + +[updates-source] +name=Fedora $releasever - Updates Source +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/SRPMS/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-f$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora diff --git a/yum/f12/yum.myplc.d/fedora.repo.in b/yum/f12/yum.myplc.d/fedora.repo.in new file mode 100644 index 0000000..b7cea58 --- /dev/null +++ b/yum/f12/yum.myplc.d/fedora.repo.in @@ -0,0 +1,29 @@ +[fedora] +name=Fedora $releasever - $basearch +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch +@KEXCLUDE@ +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY + +[fedora-debuginfo] +name=Fedora $releasever - $basearch - Debug +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY + +[fedora-source] +name=Fedora $releasever - Source +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY diff --git a/yum/f8/yum.conf b/yum/f8/yum.conf new file mode 100644 index 0000000..13046c8 --- /dev/null +++ b/yum/f8/yum.conf @@ -0,0 +1,10 @@ +[main] +reposdir=/etc/yum.myplc.d +cachedir=/var/cache/yum +debuglevel=1 +logfile=/var/log/yum.log +lockfile=/var/lock/yum.pid +pkgpolicy=newest +distroverpkg=fedora-release +installonlypkgs= +exactarch=0 diff --git a/yum/f8/yum.myplc.d/fedora-updates.repo.in b/yum/f8/yum.myplc.d/fedora-updates.repo.in new file mode 100644 index 0000000..9f9b7f6 --- /dev/null +++ b/yum/f8/yum.myplc.d/fedora-updates.repo.in @@ -0,0 +1,59 @@ +[updates] +name=Fedora $releasever - $basearch - Updates +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch +@KEXCLUDE@ +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora + +[updates-debuginfo] +name=Fedora $releasever - $basearch - Updates - Debug +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/debug/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-f$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora + +[updates-source] +name=Fedora $releasever - Updates Source +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/SRPMS/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-f$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora + +[updates-newkey] +name=Fedora $releasever - $basearch - Updates Newkey +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch.newkey/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever.newkey&arch=$basearch +@KEXCLUDE@ +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-8-and-9 + +[updates-newkey-debuginfo] +name=Fedora $releasever - $basearch - Updates - Debug Newkey +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch.newkey/debug/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-f$releasever.newkey&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-8-and-9 + +[updates-newkey-source] +name=Fedora $releasever - Updates Source Newkey +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/SRPMS.newkey/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-f$releasever.newkey&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-8-and-9 diff --git a/yum/f8/yum.myplc.d/fedora.repo.in b/yum/f8/yum.myplc.d/fedora.repo.in new file mode 100644 index 0000000..b7cea58 --- /dev/null +++ b/yum/f8/yum.myplc.d/fedora.repo.in @@ -0,0 +1,29 @@ +[fedora] +name=Fedora $releasever - $basearch +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch +@KEXCLUDE@ +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY + +[fedora-debuginfo] +name=Fedora $releasever - $basearch - Debug +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY + +[fedora-source] +name=Fedora $releasever - Source +failovermethod=priority +#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/ +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch +@KEXCLUDE@ +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY diff --git a/yum/myplc.repo.php b/yum/myplc.repo.php new file mode 100644 index 0000000..e76be48 --- /dev/null +++ b/yum/myplc.repo.php @@ -0,0 +1,101 @@ +GetNodes(array('node_id'=>$node_id)); + $nodegroup_ids = $nodes[0]['nodegroup_ids']; + $nodegroups = $adm->GetNodeGroups($nodegroup_ids); + foreach ($nodegroups as $nodegroup) { + $nodegroup_name = $nodegroup['groupname']; + $nodegroup_names [] = $nodegroup_name; + echo "# in nodegroup $nodegroup_name \n" ; + } + } + +$topdir=$_SERVER['DOCUMENT_ROOT'] . "/install-rpms/"; +$topurl="https://$PLC_BOOT_HOST" . "/install-rpms/"; + + +# locate the planetlab repo for this node family & nodegroup +$repo=NULL; +foreach ($nodegroup_names as $nodegroup_name) { + $groupdir = "$nodefamily-$nodegroup_name"; + # have we got a repo like /install-rpms/planetlab-i386-alpha ? + echo "# trying " . $topdir . $groupdir . "\n"; + if (is_dir (realpath($topdir . $groupdir))) { + $repo=array($pldistro, $groupdir, "$PLC_NAME $nodefamily $nodegroup_name"); + break; + } +} + +# if not found yet +if ( ! $repo) { + echo "# trying default " . $topdir . $nodefamily . "\n"; + if (is_dir (realpath($topdir . $nodefamily))) { + $repo = array($pldistro, $nodefamily, "$PLC_NAME $nodefamily regular"); + } + } + +# default: if we're here it's probably very wrong +if ( ! $repo) { + echo "# WARNING: could not find a decent planetlab repo for this node\n"; + $repo = array ($pldistro, "planetlab", "default probably wrong"); + # don't define the repo in this case + exit; + } + +list( $id, $dir, $name) = $repo; + +echo <<< __PLC_REPO__ +[$id] +name=$name +baseurl=$topurl/$dir +gpgcheck=$gpgcheck + +__PLC_REPO__; + +?>