Saltstack Official UFW Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config_spec.rb 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. control 'UFW configuration' do
  2. title 'Test UFW configuration'
  3. describe directory('/etc/ufw') do
  4. it { should exist }
  5. end
  6. describe file('/etc/ufw/ufw.conf') do
  7. its('content') { should include 'ENABLED=' }
  8. its('content') { should include 'LOGLEVEL=' }
  9. end
  10. describe command('ufw status verbose | grep Status') do
  11. its('exit_status') { should eq 0 }
  12. its('stdout') { should match /active/ }
  13. end
  14. describe command('ufw status verbose | grep Logging') do
  15. its('exit_status') { should eq 0 }
  16. its('stdout') { should match /low/ }
  17. end
  18. describe command('ufw status | grep MySQL') do
  19. its('exit_status') { should eq 0 }
  20. its('stdout') { should match /ALLOW/ }
  21. end
  22. describe command('ufw status | grep Postgresql') do
  23. its('exit_status') { should eq 0 }
  24. its('stdout') { should match /LIMIT/ }
  25. end
  26. describe command('ufw status | grep SSH223') do
  27. its('exit_status') { should eq 0 }
  28. its('stdout') { should match /DENY/ }
  29. end
  30. describe command('ufw status | grep 10.0.0.0') do
  31. its('exit_status') { should eq 0 }
  32. its('stdout') { should match /DENY/ }
  33. end
  34. describe command('ufw status | grep 22/tcp') do
  35. its('exit_status') { should eq 0 }
  36. its('stdout') { should match /LIMIT/ }
  37. end
  38. describe command('ufw status | grep 80/tcp') do
  39. its('exit_status') { should eq 0 }
  40. its('stdout') { should match /DENY/ }
  41. end
  42. describe command('ufw status | grep 443/tcp') do
  43. its('exit_status') { should eq 0 }
  44. its('stdout') { should match /ALLOW/ }
  45. end
  46. describe command('ufw status | grep 10.0.0.1') do
  47. its('exit_status') { should eq 0 }
  48. its('stdout') { should match /DENY/ }
  49. end
  50. describe command('ufw status | grep 10.0.0.2') do
  51. its('exit_status') { should eq 0 }
  52. its('stdout') { should match /DENY/ }
  53. end
  54. end