automate installing tripwire using expect

tripwire is a handy part of an intrusion detection system. It’s a nice piece of software but the installer is interactive which makes it a pain to install automatically (e.g. when using PoolParty/EC2). Below is a simple expect script I whipped up to solve the make install problem. Hopefully this will save someone two or three minutes.

# Usage: expect install-tripwire.tcl pass1 pass2 
set PASS1 [lindex $argv 0]
set PASS2 [lindex $argv 1]
 
spawn make install
 
expect "Press ENTER to view the License Agreement."
send "\r"
send "q"
expect "license agreement. \[do not accept\]"
send "accept\r"
expect "Continue with installation? \[y/n\]"
send "y\r"
 
expect "Enter the site keyfile passphrase:"
send "$PASS1\r"
expect "Verify the site keyfile passphrase:"
send "$PASS1\r"
 
expect "Enter the local keyfile passphrase:"
send "$PASS2\r"
expect "Verify the local keyfile passphrase:"
send "$PASS2\r"
 
expect "Please enter your site passphrase:"
send "$PASS1\r"
 
expect "Please enter your site passphrase:"
send "$PASS1\r"
Share:
  • del.icio.us
  • Reddit
  • Technorati
  • Twitter
  • Facebook
  • Google Bookmarks
  • HackerNews
  • PDF
  • RSS
This entry was posted in tips and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • Trey Henefield

    I came across this as useful. But I found an even easier solution.

    There is an option that disables the license prompt.

    After running ‘./configure’ and ‘make’, I perform the following change from within the tripwire source directory:

    sed -i ‘/PROMPT=/s/true/false/’ install/install.sh

    You also have prompts for SITE and LOCAL passwords. These can be automated with:

    sed -i ‘/TW_SITE_PASS=/s/\”\”/\”PASSWORD\”/’ install/install.sh
    sed -i ‘/TW_LOCAL_PASS=/s/\”\”/\”PASSWORD\”/’ install/install.sh

    The above will define both passwords as PASSWORD.

    You can then run ‘make install’ without any prompts.

    Hope that may help others.