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';
25 $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR']));
26 if (!empty($interfaces)) {
27 $nodes = $adm->GetNodes(array($interfaces[0]['node_id']));
34 // XXX Implement generic "networks" table
35 // $networks = $adm->GetNetworks();
37 foreach ($networks as $network) {
38 if ($network['blacklisted']) {
39 $dest = $network['ip'];
40 if ($network['netmask']) {
41 $dest .= "/" . $network['netmask'];
43 print "-A BLACKLIST -d $dest -j LOGDROP\n";