summaryrefslogtreecommitdiff
path: root/templates-cfg/system/conntrack/log/node.def
diff options
context:
space:
mode:
Diffstat (limited to 'templates-cfg/system/conntrack/log/node.def')
-rw-r--r--templates-cfg/system/conntrack/log/node.def35
1 files changed, 35 insertions, 0 deletions
diff --git a/templates-cfg/system/conntrack/log/node.def b/templates-cfg/system/conntrack/log/node.def
new file mode 100644
index 0000000..cb7521a
--- /dev/null
+++ b/templates-cfg/system/conntrack/log/node.def
@@ -0,0 +1,35 @@
+help: Log connection tracking events per protocol
+priority: 219 # failure at log shouldnt fail conntrack
+end:
+if [[ ${COMMIT_ACTION} != 'DELETE' ]]
+then
+ declare -a ARR;
+ declare -a EVENTS;
+ declare -a STATES;
+ eval "ARR=($(cli-shell-api listNodes system conntrack log))";
+ if [ "${#ARR[@]}" == "0" ]; then
+ echo Protocol must be specified for log;
+ exit 1;
+ fi
+ for var in "${ARR[@]}"
+ do
+ eval "EVENTS=($(cli-shell-api listNodes system conntrack log $var))";
+ if [ "${#EVENTS[@]}" == "0" ]; then
+ echo Event must be specified for specified protocol $var;
+ exit 1;
+ fi
+ if [ "$var" == "tcp" ]; then
+ for i in "${EVENTS[@]}"
+ do
+ if [ "$i" == "update" ]; then
+ eval "STATES=($(cli-shell-api listNodes system conntrack log $var $i))";
+ if [ "${#STATES[@]}" == "0" ]; then
+ echo State must be specified for specified protocol-event $var $i;
+ exit 1;
+ fi
+ fi
+ done
+ fi
+ done
+fi
+sudo /opt/vyatta/sbin/vyatta-update-conntrack-log.pl