I used pexpect in chef.  Worked nice!

script "python_install_ossec" do
  interpreter "python"
  user "root"
  cwd "/var"
code <<-PYCODE
import pexpect
import sys
child = pexpect.spawn ('/var/ossec-hids/install.sh')
child.logfile = sys.stdout
child.expect ('(en/br/cn/de/el/es/fr/hu/it/jp/nl/pl/ru/sr/tr)*?:')
child.sendline ('en')
child.expect ('-- Press ENTER to continue or Ctrl-C to abort. --*')
child.sendline ('')
child.expect ('1- What kind of installation do you want (server, agent, 
local, hybrid or help)*')
child.sendline ('agent')
child.expect ('Choose where to install the OSSEC HIDS*')
child.sendline ('/var/ossec')
child.expect ("""3.1- What's the IP Address or hostname of the OSSEC HIDS 
server*""")
child.sendline ('ossec.do.test.com')
child.expect ('3.2- Do you want to run the integrity check daemon*')
child.sendline ('y')
child.expect ('3.3- Do you want to run the rootkit detection engine*')
child.sendline ('y')
child.expect ('3.4 - Do you want to enable active response*')
child.sendline ('y')
child.expect ('--- Press ENTER to continue ---*')
child.sendline ('')
child.expect ('---  Press ENTER to finish (maybe more information below)*')
child.sendline ('')
child.expect(pexpect.EOF)
PYCODE
  not_if {File.exists?("#{Chef::Config[:file_cache_path]}/ossec_lock")}
end




On Wednesday, February 12, 2014 8:55:54 PM UTC+8, dan (ddpbsd) wrote:
>
> On Tue, Feb 11, 2014 at 6:23 PM, David Montgomery 
> <[email protected] <javascript:>> wrote: 
> > Hi, 
> > 
> > Newbie trying to install agent and server.  Will build my own chef 
> recipes. 
> > 
> > Wowee.......If I were a prompt I would love ossec.  Where are the docs 
> to 
> > bypass all of the prompts?  Or to people use expect to install agents? 
> > 
> > I am on ubunutu 12.04 
> > 
> > Thanks 
> > 
> > 
>
> I haven't written the documentation. Create a package. 
>
> > -- 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "ossec-list" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to [email protected] <javascript:>. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"ossec-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to