new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / debian / ossec-hids / var / ossec / active-response / bin / restart-ossec.sh
diff --git a/debian/ossec-hids/var/ossec/active-response/bin/restart-ossec.sh b/debian/ossec-hids/var/ossec/active-response/bin/restart-ossec.sh
new file mode 100755 (executable)
index 0000000..25d5f77
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Restarts ossec.
+# Requirements: none
+# Author: Daniel B. Cid
+
+ACTION=$1
+USER=$2
+IP=$3
+
+LOCAL=`dirname $0`;
+cd $LOCAL
+cd ../
+PWD=`pwd`
+UNAME=`uname`
+
+
+# Logging the call
+echo "`date` $0 $1 $2 $3 $4 $5" >> ${PWD}/../logs/active-responses.log
+
+
+
+# Adding the ip to hosts.deny
+if [ "x${ACTION}" = "xadd" ]; then
+   ${PWD}/../bin/ossec-control restart
+   exit 0;
+
+
+# Deleting from hosts.deny   
+elif [ "x${ACTION}" = "xdelete" ]; then   
+   exit 0;
+
+
+# Invalid action   
+else
+   echo "$0: invalid action: ${ACTION}"
+fi       
+
+exit 1;