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.

88 lines
1.9KB

  1. <%
  2. distrib, infos = ENV.fetch('DISTRIB', 'debian:stretch/9').split(':')
  3. codename, version = infos.split('/')
  4. %>
  5. ---
  6. driver:
  7. name: docker
  8. use_sudo: false
  9. privileged: true
  10. provisioner:
  11. name: salt_solo
  12. formula: ufw
  13. # Install Salt from official repositories
  14. salt_install: apt
  15. salt_version: latest
  16. salt_apt_repo: https://repo.saltstack.com/apt/<%= distrib %>/<%= version %>/amd64
  17. salt_apt_repo_key: https://repo.saltstack.com/apt/<%= distrib %>/<%= version %>/amd64/latest/SALTSTACK-GPG-KEY.pub
  18. # Don't install Chef
  19. require_chef: false
  20. # Configure Salt
  21. state_top:
  22. base:
  23. '*':
  24. - ufw
  25. pillars:
  26. top.sls:
  27. base:
  28. '*':
  29. - ufw
  30. ufw.sls:
  31. ufw:
  32. enabled: True
  33. settings:
  34. loglevel: 'low'
  35. applications:
  36. MySQL:
  37. comment: Allow MySQL
  38. Postgresql:
  39. limit: True
  40. comment: Limit Postgresql
  41. SSH223:
  42. deny: True
  43. comment: Deny Webscale SSH
  44. '*':
  45. deny: True
  46. from_addr: 10.0.0.0/8
  47. services:
  48. '*':
  49. deny: True
  50. from_addr:
  51. - 10.0.0.1
  52. - 10.0.0.2
  53. '22':
  54. protocol: tcp
  55. limit: True
  56. comment: Limit SSH
  57. '80':
  58. protocol: tcp
  59. deny: True
  60. comment: Deny HTTP
  61. '443':
  62. protocol: tcp
  63. comment: Allow HTTPS
  64. platforms:
  65. - name: <%= distrib %>-<%= codename %>
  66. driver_config:
  67. image: "<%= distrib %>:<%= codename %>"
  68. platform: <%= distrib %>
  69. provision_command:
  70. - apt-get update && apt-get install -y locales
  71. - echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
  72. - locale-gen en_US.UTF-8
  73. run_command: /lib/systemd/systemd
  74. verifier:
  75. name: inspec
  76. reporter: progress
  77. suites:
  78. - name: ufw