mildly sanitize network configuration files
authorAaron Klingaman <alk@cs.princeton.edu>
Thu, 2 Dec 2004 00:00:25 +0000 (00:00 +0000)
committerAaron Klingaman <alk@cs.princeton.edu>
Thu, 2 Dec 2004 00:00:25 +0000 (00:00 +0000)
conf_files/pl_validateconf [new file with mode: 0644]

diff --git a/conf_files/pl_validateconf b/conf_files/pl_validateconf
new file mode 100644 (file)
index 0000000..1b9d183
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Valid environment variables to appear in a planetlab config file
+TAGS='IP_METHOD HOST_NAME DOMAIN_NAME PROXY_SERVER
+      IP_ADDRESS IP_GATEWAY IP_NETMASK IP_NETADDR IP_BROADCASTADDR 
+      IP_DNS1 IP_DNS2 PRIMARY_DEV PRIMARY_MAC'
+
+# Valid characters that variable can be set to
+CHARS='[:alnum:]\.: _-'
+
+REGEX=''
+
+for t in $TAGS
+do
+    if [ "$REGEX" == "" ]
+    then
+        REGEX="^$t"
+    else
+        REGEX="$REGEX|^$t"
+    fi
+done
+/bin/egrep "($REGEX)\=\\\"[$CHARS]*\\\"\s*$"