new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / debian / ossec-hids / var / ossec / agentless / ssh_integrity_check_linux
diff --git a/debian/ossec-hids/var/ossec/agentless/ssh_integrity_check_linux b/debian/ossec-hids/var/ossec/agentless/ssh_integrity_check_linux
new file mode 100755 (executable)
index 0000000..51b5796
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/env expect
+
+# Agentless monitoring
+#
+# Copyright (C) 2009 Trend Micro Inc.
+# All rights reserved.
+#
+# This program is a free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License (version 2) as published by the FSF - Free Software
+# Foundation.
+
+# Main script
+source "agentless/main.exp"
+
+# SSH to the box and pass the directories to check
+if [catch {
+    spawn ssh $hostname
+} loc_error] {
+    send_user "ERROR: Opening connection: $loc_error.\n"
+    exit 1;
+}
+
+source $sshsrc
+source $susrc
+
+set timeout 600
+send "unset HISTFILE echo \"INFO: Starting.\"; for i in `find $args 2>/dev/null`;do tail \$i >/dev/null 2>&1 && md5=`md5sum \$i | cut -d \" \" -f 1` && sha1=`sha1sum \$i | cut -d \" \" -f 1` && echo FWD: `stat --printf \"%s:%a:%u:%g\" \$i`:\$md5:\$sha1 \$i; done; exit\r"
+send "exit\r"
+
+expect {
+    timeout {
+        send_user "ERROR: Timeout while running commands on host: $hostname .\n"
+        exit 1;
+    }
+    eof {
+        send_user "\nINFO: Finished.\n"
+        exit 0;
+    }
+}
+
+exit 0;