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

74 lines
2.2KB

  1. # frozen_string_literal: true
  2. control 'zones/public.xml configuration' do
  3. title 'should match desired lines'
  4. describe file('/etc/firewalld/zones/public.xml') do
  5. it { should be_file }
  6. it { should be_owned_by 'root' }
  7. it { should be_grouped_into 'root' }
  8. its('mode') { should cmp '0644' }
  9. its('content') do
  10. should include <<~ZONE_XML
  11. <zone>
  12. <short>Public</short>
  13. <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  14. <service name="zabbixcustom" />
  15. <service name="http" />
  16. <service name="https" />
  17. <service name="ssh" />
  18. <service name="salt-minion" />
  19. <!-- zabbix-agent -->
  20. <port port="10050" protocol="tcp" />
  21. <!-- bacula-client -->
  22. <port port="9102" protocol="tcp" />
  23. <!-- vsftpd -->
  24. <port port="21" protocol="tcp" />
  25. <protocol value="igmp" />
  26. <!-- something -->
  27. <source-port port="2222" protocol="tcp" />
  28. <!-- something_else -->
  29. <source-port port="4444" protocol="tcp" />
  30. <rule family="ipv4">
  31. <source address="8.8.8.8/24" />
  32. <accept/>
  33. </rule>
  34. <rule family="ipv4">
  35. <source ipset="fail2ban-ssh" />
  36. <reject type="icmp-port-unreachable" />
  37. </rule>
  38. </zone>
  39. ZONE_XML
  40. end
  41. end
  42. end
  43. control 'zones/rich_public.xml configuration' do
  44. title 'should match desired lines'
  45. describe file('/etc/firewalld/zones/rich_public.xml') do
  46. it { should be_file }
  47. it { should be_owned_by 'root' }
  48. it { should be_grouped_into 'root' }
  49. its('mode') { should cmp '0644' }
  50. its('content') do
  51. should include <<~ZONE_XML
  52. <zone>
  53. <short>rich_public</short>
  54. <description>Example</description>
  55. <rule>
  56. <source ipset="fail2ban-ssh" />
  57. <service name="ssh" />
  58. <accept/>
  59. </rule>
  60. <rule>
  61. <source ipset="other-ipset" />
  62. <service name="ssh" />
  63. <accept/>
  64. </rule>
  65. </zone>
  66. ZONE_XML
  67. end
  68. end
  69. end