Saltstack Official Apt 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ů.

47 lines
1.6KB

  1. # frozen_string_literal: true
  2. audit = command(
  3. "/usr/bin/apt-config dump --no-empty --format '%f=%v%n' Unattended-Upgrade"
  4. ).stdout
  5. options = {
  6. assignment_regex: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/,
  7. multiple_values: true
  8. }
  9. control 'Apt unattended upgrades' do
  10. title 'should be configured'
  11. describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
  12. it { should be_file }
  13. it { should be_owned_by 'root' }
  14. it { should be_grouped_into 'root' }
  15. its('mode') { should cmp '0644' }
  16. end
  17. describe file('/etc/apt/apt.conf.d/10periodic') do
  18. it { should exist }
  19. it { should be_owned_by 'root' }
  20. it { should be_grouped_into 'root' }
  21. its('mode') { should cmp '0644' }
  22. its(:content) do
  23. should match(
  24. 'APT::Periodic::Enable "1";'
  25. )
  26. end
  27. end
  28. describe parse_config(audit, options) do
  29. its('Unattended-Upgrade::Allowed-Origins::') { should include 'origin1' }
  30. its('Unattended-Upgrade::Mail') { should include 'root' }
  31. its('Unattended-Upgrade::MailReport') { should include 'only-on-error' }
  32. its('Unattended-Upgrade::Package-Blacklist::') { should include 'salt-test' }
  33. its('Unattended-Upgrade::Automatic-Reboot') { should include 'False' }
  34. its('Unattended-Upgrade::SyslogEnable') { should include 'True' }
  35. its('Unattended-Upgrade::SyslogFacility') { should include 'auth' }
  36. its('Unattended-Upgrade::Remove-Unused-Dependencies') { should include 'True' }
  37. its('Unattended-Upgrade::Keep-Debs-After-Install') { should include 'False' }
  38. its('Unattended-Upgrade::Update-Days::') { should include 'Wed' }
  39. end
  40. end