下面的木偶清单有问题,它用于在RHEL-6系统上启用passwdqc pam模块(使用Puppet0.25.5和Augeas0.7.2):
augeas { 'authconfig':
context => '/files/etc/sysconfig/authconfig',
changes => [
'set USEPASSWDQC yes',
'set USECRACKLIB no',
],
notify => Exec['authconfig-all'],
}
exec { 'authconfig-all':
command => '/usr/sbin/authconfig --updateall',
refreshonly => true,
}如果运行此清单,它似乎已成功完成:
info: Applying configuration version '1311189237'
notice: //Augeas[authconfig]/returns: executed successfully
info: //Augeas[authconfig]: Scheduling refresh of Exec[authconfig-all]
notice: //Exec[authconfig-all]: Triggering 'refresh' from 1 dependencies但是,如果我检查目标文件,则没有应用这些更改:
# egrep 'PASSWDQC|CRACKLIB' /etc/sysconfig/authconfig
USECRACKLIB=yes
USEPASSWDQC=no如果我从清单中删除notify => ...行,它将完全按照预期工作。也就是说,考虑到这一点:
augeas { 'authconfig':
context => '/files/etc/sysconfig/authconfig',
changes => [
'set USEPASSWDQC yes',
'set USECRACKLIB no',
],
}成功地保存了更改:
# puppet /path/to/manifest.pp
info: Applying configuration version '1311189502'
notice: //Augeas[authconfig]/returns: executed successfully
# egrep 'PASSWDQC|CRACKLIB' /etc/sysconfig/authconfig
USECRACKLIB=no
USEPASSWDQC=yes知道这是怎么回事吗?显然,木偶相信这种改变是第一次出现,但实际上并没有被保存到磁盘中。我们有使用augeas的其他配置,并通知工作正常的操作;我们还无法找出失败的原因。注意,如果我将augeas操作上的notify替换为相应的exec定义上的subscribe,也存在同样的问题。
我目前的计划是用更新版本的木偶和augeas构建软件包,看看问题是否会神奇地消失。
更新: freiheit指出,authconfig似乎正在覆盖这个文件。奇怪的是,在CentOS 5下,修改/etc/sysconfig/authconfig然后运行authconfig --updateall正是正确的过程。这就是我们在遗留的Kickstart中实际使用的东西。
因此,显然,RHEL6升级使authconfig以奇怪和无用的方式运行。
发布于 2011-07-22 03:19:16
部分答案是authconfig命令的行为在RHEL5和RHEL6之间发生了变化。在RHEL6中,authconfig不是读取/etc/sysconfig/authconfig然后生成配置,而是在RHEL6中解析它管理的每个单独的配置文件,然后生成/etc/sysconfig/authconfig作为当前状态的记录。
这意味着,如果(a)试图避免运行authconfig命令,或(b)试图利用authconfig命令行中不支持的特性,则必须直接编辑配置文件。
这就是我最后要启用的passwdqc PAM模块:
augeas { 'pam_passwdqc':
context => '/files/etc/pam.d/system-auth-ac/',
changes => [
'rm *[module="pam_cracklib.so"]',
'ins 9999 before *[type="password"][module="pam_unix.so"]',
'set 9999/type password',
'set 9999/control requisite',
'set 9999/module pam_passwdqc.so',
'set 9999/argument enforce=everyone',
],
onlyif => 'match *[module="pam_passwdqc.so"] size == 0',
notify => Exec['authconfig-update-all'],
}
exec { 'authconfig-update-all':
command => '/usr/sbin/authconfig --updateall',
refreshonly => true,
}如果你发现自己读到了这个答案,我很想听听你对这是否明智的处理问题的评论。我是新来的傀儡,所以我仍然感觉到我的工作方式。
https://serverfault.com/questions/292406
复制相似问题