You are going to probably need something along the lines of
context => '/files/etc/hosts.allow'
changes => [
'ins 01 after *[last()]',
'set 01/process[1] ssh',
'set 01/process[2] ssh2',
'set 01/client ipaddr'
]
onlyif => 'match *[process[1] == 'ssh' and 'client' == 'ipaddr'] size == 0'
you might need to tweak it a little I didn't try it verbatim, but it should get you on the right track.
On Tuesday, November 6, 2012 1:37:08 PM UTC-6, Chad Lewis wrote:
I've found a similar thread here, but it doesn't do quite what I need.
I have multiple lines of the form below in hosts.allow:
sshd,sshd2: 1.1.1.1
sshd,sshd2: 2.2.2.2
etc.
I'm struggling with the syntax to add yet another "sshd,sshd2: client" line to hosts.allow.
augtool is treating the lines as follows
augtool> ls /files/etc/hosts.allow/*[last()]
process[1] = sshd
process[2] = sshd2
client = 3.3.3.3
I need to add another line when the processes already exist, but the client is new.
Any suggestions?