new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / debian / ossec-hids / var / ossec / agentless / su.exp
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 # If su was chosen
14 set timeout 10
15 if {[string compare $use_su "su;"] == 0} {
16
17     # Run su command
18     send "\rsu\r"
19
20     expect {
21         "Password:" {
22             send "$addpass\r"
23         }
24         timeout {
25             send_user "\nERROR: Unable to run su.\n"
26             exit 1;
27         }
28     }
29
30     expect {
31         "Permission denied" {
32             send_user "\nERROR: Incorrect su password to host: $hostname .\n"
33             exit 1;
34         }
35         "Password:" {
36             send_user "\nERROR: Incorrect su password to host: $hostname .\n"
37             exit 1;
38         }
39         "Sorry" {
40             send_user "\nERROR: Incorrect su password to remote host: $hostname .\n"
41             exit 1;
42         }
43         eof {
44             send_user "\nERROR: EOF while running su on host: $hostname .\n"
45             exit 1;
46         }
47         timeout {
48             send_user "\nERROR: Timeout while running on host: $hostname .\n"
49             exit 1;
50         }
51         "*#" {
52             send_user "\nINFO: su accepted.\n"
53         }
54     }
55 }