Hoxt.com – Open Source Mirrors Apache, CPAN, PHP, MySQL, PuTTY, Linux Virtual Server, Linux Documentation Project, ProFTPD

17Jul/100

Install OSSEC automatically with expect

If you want to script the installation of ossec, this script will use expect/spawn to automatically enter values for prompts:

#!/usr/bin/expect -d
set timeout -1
spawn ossec-hids-2.4.1/install.sh
expect "en/br/cn/de"
send "en\r"
expect "Press ENTER to continue"
send "\r"
expect "What kind of installation"
send "local\r"
expect "Choose where to install the OSSEC HIDS"
send "\r"
expect "Do you want e-mail notification"
send "y\r"
expect "your e-mail address"
send "root@localhost\r"
expect "Do you want to use it"
send "y\r"
expect "Do you want to run the integrity check daemon"
send "y\r"
expect "Do you want to run the rootkit detection engine"
send "y\r"
expect "Do you want to enable active response"
send "y\r"
expect "Do you want to enable the firewall-drop response"
send "y\r"
expect "Do you want to add more IPs to the white list"
send "n\r"
expect "Press ENTER to continue"
send "\r"
expect "Press ENTER to finish"
send "\r"
expect eof