使用 Chef Inspec 是否可以验证 SSH 密钥的强度?
Using Chef Inspec is it possible to verify the strength of SSH keys?
在执行命令 ssh-keygen -lf /etc/ssh/ssh_host_dsa_key.pub
时,我得到一个输出,其中前几位数字代表密钥强度。是否有可能使用 Chef inspec 验证密钥强度的方法?
假设我得到 1024...... 作为上述命令的输出,我如何使用 Chef Inspec 检查它应该是 1024 而不是其他值?
使用command resource and match its output。像下面这样的东西应该可以解决问题
describe command('ssh-keygen -lf /etc/ssh/ssh_host_dsa_key.pub | awk '{print }) do
its('exit_status') { should eq 0 }
its('stdout') { should be >= 1024 }
end
在执行命令 ssh-keygen -lf /etc/ssh/ssh_host_dsa_key.pub
时,我得到一个输出,其中前几位数字代表密钥强度。是否有可能使用 Chef inspec 验证密钥强度的方法?
假设我得到 1024...... 作为上述命令的输出,我如何使用 Chef Inspec 检查它应该是 1024 而不是其他值?
使用command resource and match its output。像下面这样的东西应该可以解决问题
describe command('ssh-keygen -lf /etc/ssh/ssh_host_dsa_key.pub | awk '{print }) do
its('exit_status') { should eq 0 }
its('stdout') { should be >= 1024 }
end