【发布时间】:2021-05-27 19:42:18
【问题描述】:
在执行命令ssh-keygen -lf /etc/ssh/ssh_host_dsa_key.pub 时,我得到一个输出,其中前几位数字代表密钥强度。有没有可能使用 Chef inspec 验证密钥强度的方法?
假设我得到 1024...... 作为上述命令的输出,我如何使用 Chef Inspec 检查它应该是 1024 而不是其他值?
【问题讨论】:
标签: chef-infra inspec
在执行命令ssh-keygen -lf /etc/ssh/ssh_host_dsa_key.pub 时,我得到一个输出,其中前几位数字代表密钥强度。有没有可能使用 Chef inspec 验证密钥强度的方法?
假设我得到 1024...... 作为上述命令的输出,我如何使用 Chef Inspec 检查它应该是 1024 而不是其他值?
【问题讨论】:
标签: chef-infra inspec
使用command resource 和match 其output。像下面这样的东西应该可以解决问题
describe command('ssh-keygen -lf /etc/ssh/ssh_host_dsa_key.pub | awk '{print $1}) do
its('exit_status') { should eq 0 }
its('stdout') { should be >= 1024 }
end
【讨论】: