2 # /etc/planetlab/blacklist
4 # post: iptables-restore --noflush < /etc/planetlab/blacklist
6 # PlanetLab per-node outbound blacklist
8 # Aaron Klingaman <alk@cs.princeton.edu>
9 # Mark Huang <mlhuang@cs.princeton.edu>
10 # Copyright (C) 2004 The Trustees of Princeton University
20 // Get admin API handle
21 require_once 'plc_api.php';
24 // backwards compatibility with the old 4.2 API
25 global $__PLC_API_VERSION;
26 if ( ! method_exists ($adm,"GetInterfaces"))
27 $__PLC_API_VERSION = 4.2;
29 $__PLC_API_VERSION = 4.3;
32 if ($__PLC_API_VERSION==4.2)
33 $interfaces = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR']));
35 $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR']));
36 if (!empty($interfaces)) {
37 $nodes = $adm->GetNodes(array($interfaces[0]['node_id']));
44 // XXX Implement generic "networks" table
45 // $networks = $adm->GetNetworks();
47 foreach ($networks as $network) {
48 if ($network['blacklisted']) {
49 $dest = $network['ip'];
50 if ($network['netmask']) {
51 $dest .= "/" . $network['netmask'];
53 print "-A BLACKLIST -d $dest -j LOGDROP\n";