使用Augeas更改内核审计参数失败,包含多个标题栏

时间:2018-05-03 12:47:01

标签: puppet audit augeas

这个例子应该通过将audit参数添加或设置为1来更改每个标题栏中的内核行。如果只有一个标题栏但是如果有多个标题块,则它可以正常工作任何东西。我错过了什么吗?

Puppet Master

augeas-libs.x86_64     1.0.0-5.el6_5.1  @updates                                
puppet.noarch          2.7.25-2.el6     @epel-6server                           
puppet-server.noarch   2.7.25-2.el6     @epel-6server                           
ruby-augeas.x86_64     0.4.1-1.el6      @epel-6server

Puppet客户端

yum list installed |grep -i "augeas\|puppet"
augeas-libs.x86_64     1.0.0-10.el6     @anaconda-CentOS-201703281317.x86_64/6.9       
puppet.noarch          2.7.26-2.el6     @add-ons_6.9                            
ruby-augeas.x86_64     0.4.1-1.el6      @epel-6server_6.9

我的班级

augeas {
   'grub':
      context => '/files/etc/grub.conf',
      lens    => 'grub.lns',
      incl    => '/etc/grub.conf',
      changes => [
        'set title[*]/kernel/audit 1',
      ];
}

我的grub文件

sudo cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg00-root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
password --encrypted $1$QWxxyxxyxxyxxyx$0eCHxd/
title CentOS (2.6.32-696.23.1.el6.x86_64)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-696.23.1.el6.x86_64 ro root=/dev/mapper/vg00-root rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg00/swap LANG=en_US.UTF-8 rd_LVM_LV=vg00/root rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto quite rd_NO_DM rhgb quiet
    initrd /initramfs-2.6.32-696.23.1.el6.x86_64.img
title CentOS 6 (2.6.32-696.el6.x86_64)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-696.el6.x86_64 ro root=/dev/mapper/vg00-root rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg00/swap LANG=en_US.UTF-8 rd_LVM_LV=vg00/root rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto quite rd_NO_DM rhgb quiet
    initrd /initramfs-2.6.32-696.el6.x86_64.img

1 个答案:

答案 0 :(得分:0)

Puppet Augeas的文档暗示set仅设置单个键的值。有一个setm命令用于更改多个节点。

https://puppet.com/docs/puppet/5.1/types/augeas.html