Saltstack Official OpenSSH Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

55 lines
1.9KB

  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. its('content') { should include 'UsePAM yes' }
  27. end
  28. describe file('/etc/ssh/ssh_config') do
  29. it { should be_file }
  30. its('mode') { should cmp '0644' }
  31. it { should be_owned_by 'root' }
  32. it { should be_grouped_into root_group }
  33. its('content') { should include 'Host *' }
  34. its('content') { should include ' GSSAPIAuthentication yes' }
  35. its('content') { should include ' HashKnownHosts yes' }
  36. its('content') { should include ' SendEnv LANG LC_*' }
  37. end
  38. describe file('/etc/ssh/ssh_known_hosts') do
  39. it { should be_file }
  40. its('mode') { should cmp '0644' }
  41. it { should be_owned_by 'root' }
  42. it { should be_grouped_into 'root' }
  43. its('content') { should include github_known_host }
  44. its('content') { should match(gitlab_known_host_re) }
  45. its('content') { should include minion_rsa_known_host }
  46. its('content') { should include minion_ed25519_known_host }
  47. end
  48. end