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.

ufw.rb 1.7KB

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