Chad Lewis
2012-Nov-06 19:37 UTC
[Puppet Users] augeas syntax for adding similar lines to hosts.allow
I''ve found a similar thread here, but it doesn''t do quite what I need. https://groups.google.com/forum/?fromgroups=#!topic/puppet-users/VMloh1KrSew 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? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/aWaiSr2YhV0J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nathan Huff
2012-Nov-07 18:54 UTC
[Puppet Users] Re: augeas syntax for adding similar lines to hosts.allow
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. > > https://groups.google.com/forum/?fromgroups=#!topic/puppet-users/VMloh1KrSew > > 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? > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/MiixJMy20jQJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.