new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / debian / ossec-hids / var / ossec / agentless / ssh_integrity_check_linux
1 #!/usr/bin/env expect
2
3 # Agentless monitoring
4 #
5 # Copyright (C) 2009 Trend Micro Inc.
6 # All rights reserved.
7 #
8 # This program is a free software; you can redistribute it
9 # and/or modify it under the terms of the GNU General Public
10 # License (version 2) as published by the FSF - Free Software
11 # Foundation.
12
13 # Main script
14 source "agentless/main.exp"
15
16 # SSH to the box and pass the directories to check
17 if [catch {
18     spawn ssh $hostname
19 } loc_error] {
20     send_user "ERROR: Opening connection: $loc_error.\n"
21     exit 1;
22 }
23
24 source $sshsrc
25 source $susrc
26
27 set timeout 600
28 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"
29 send "exit\r"
30
31 expect {
32     timeout {
33         send_user "ERROR: Timeout while running commands on host: $hostname .\n"
34         exit 1;
35     }
36     eof {
37         send_user "\nINFO: Finished.\n"
38         exit 0;
39     }
40 }
41
42 exit 0;