我正在尝试修改 SSH 配置文件以删除 arcfour
, arcfour 128
和 arcfour 256
/etc/ssh/sshd_config
中的算法在 186 台使用 puppet 的 linux 服务器上。基本上,我正在查找和替换以删除 sshd_config
中的这三种算法类型。文件。我创建了一个名为 SSH_Test
的模块我想知道我的下一步是什么。我想我可以使用这些资源,但我不确定将它们放在哪里,我不确定它们是否正确
file_line { 'Ciphers':
path => '/etc/ssh/sshd_config',
line => 'arcfour, arcfour128, arcfour256',
match => '',
}
来自以下评论的新配置
node default {
file { '/etc/motd':
owner => 'root',
group => 'root',
mode => '0644',
content => "\nAll hail the knife crab\n"
}
}
最佳答案
遵循 file_line
的文档此处提供:https://forge.puppet.com/puppetlabs/stdlib/types
我们有以下资源:
file_line { 'Ciphers':
ensure => absent,
path => '/etc/ssh/sshd_config',
match => '.*arcfour.*',
multiple => true,
match_for_absence => true,
}
ensure
删除行,path
对于指定的文件,match
用于匹配正则表达式的行,multiple
因为您希望它作用于文件中的多行,并且 match_for_absence
以便在匹配时删除行。如果您使用 Puppet >= 4.0 或 3.8 和 future 的解析器,那么可以使用 lambda 使这更精确和更清晰。如果你是,请告诉我。
关于ssh - 如何使用 puppet 模块修改 SSH 配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39877334/