Saltstack Official OpenSSH Formula
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

57 lines
2.0KB

  1. # frozen_string_literal: true
  2. # Overide by Platform
  3. root_group =
  4. case platform[:family]
  5. when 'bsd'
  6. 'wheel'
  7. else
  8. 'root'
  9. end
  10. github_known_host = 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGm[...]'
  11. gitlab_known_host_re = /gitlab.com,[0-9a-f.:,]* ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA/
  12. minion_rsa_known_host = 'minion.id,alias.of.minion.id ssh-rsa [...]'
  13. minion_ed25519_known_host = 'minion.id,alias.of.minion.id ssh-ed25519 [...]'
  14. control 'openssh configuration' do
  15. title 'should match desired lines'
  16. describe file('/etc/ssh/sshd_config') do
  17. it { should be_file }
  18. its('mode') { should cmp '0644' }
  19. it { should be_owned_by 'root' }
  20. it { should be_grouped_into root_group }
  21. its('content') { should include 'ChallengeResponseAuthentication no' }
  22. its('content') { should include 'X11Forwarding yes' }
  23. its('content') { should include 'PrintMotd no' }
  24. its('content') { should include 'AcceptEnv LANG LC_*' }
  25. its('content') { should include 'Subsystem sftp /usr/lib/openssh/sftp-server' }
  26. unless %w[openbsd].include?(platform[:name])
  27. its('content') { should include 'UsePAM yes' }
  28. end
  29. end
  30. describe file('/etc/ssh/ssh_config') do
  31. it { should be_file }
  32. its('mode') { should cmp '0644' }
  33. it { should be_owned_by 'root' }
  34. it { should be_grouped_into root_group }
  35. its('content') { should include 'Host *' }
  36. its('content') { should include ' GSSAPIAuthentication yes' }
  37. its('content') { should include ' HashKnownHosts yes' }
  38. its('content') { should include ' SendEnv LANG LC_*' }
  39. end
  40. describe file('/etc/ssh/ssh_known_hosts') do
  41. it { should be_file }
  42. its('mode') { should cmp '0644' }
  43. it { should be_owned_by 'root' }
  44. it { should be_grouped_into root_group }
  45. its('content') { should include github_known_host }
  46. its('content') { should match(gitlab_known_host_re) }
  47. its('content') { should include minion_rsa_known_host }
  48. its('content') { should include minion_ed25519_known_host }
  49. end
  50. end