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.

57 lines
2.6KB

  1. {% set ufw_cfg = pillar.get('ufw', {}) -%}
  2. {% set settings_cfg = ufw_cfg.get('settings', {}) -%}
  3. {% set ipv6 = "yes" if settings_cfg.get('ipv6', True) else "no" -%}
  4. {% set default_input_policy = settings_cfg.get('default_input_policy', 'DROP') -%}
  5. {% set default_output_policy = settings_cfg.get('default_output_policy', 'ACCEPT') -%}
  6. {% set default_forward_policy = settings_cfg.get('default_forward_policy', 'DROP') -%}
  7. {% set default_application_policy = settings_cfg.get('default_application_policy', 'SKIP') -%}
  8. {% set manage_builtins = "yes" if settings_cfg.get('manage_builtins', False) else "no" -%}
  9. {% set ipt_sysctl = settings_cfg.get('ipt_sysctl', '/etc/ufw/sysctl.conf') -%}
  10. {% set ipt_modules = settings_cfg.get('ipt_modules', ['nf_conntrack_ftp', 'nf_nat_ftp', 'nf_conntrack_netbios_ns'])|join(" ") -%}
  11. # /etc/default/ufw
  12. #
  13. # File managed by Salt. Do not edit manually.
  14. # Set to yes to apply rules to support IPv6 (no means only IPv6 on loopback
  15. # accepted). You will need to 'disable' and then 'enable' the firewall for
  16. # the changes to take affect.
  17. IPV6={{ ipv6 }}
  18. # Set the default input policy to ACCEPT, DROP, or REJECT. Please note that if
  19. # you change this you will most likely want to adjust your rules.
  20. DEFAULT_INPUT_POLICY="{{ default_input_policy }}"
  21. # Set the default output policy to ACCEPT, DROP, or REJECT. Please note that if
  22. # you change this you will most likely want to adjust your rules.
  23. DEFAULT_OUTPUT_POLICY="{{ default_output_policy }}"
  24. # Set the default forward policy to ACCEPT, DROP or REJECT. Please note that
  25. # if you change this you will most likely want to adjust your rules
  26. DEFAULT_FORWARD_POLICY="{{ default_forward_policy }}"
  27. # Set the default application policy to ACCEPT, DROP, REJECT or SKIP. Please
  28. # note that setting this to ACCEPT may be a security risk. See 'man ufw' for
  29. # details
  30. DEFAULT_APPLICATION_POLICY="{{ default_application_policy }}"
  31. # By default, ufw only touches its own chains. Set this to 'yes' to have ufw
  32. # manage the built-in chains too. Warning: setting this to 'yes' will break
  33. # non-ufw managed firewall rules
  34. MANAGE_BUILTINS={{ manage_builtins }}
  35. #
  36. # IPT backend
  37. #
  38. # only enable if using iptables backend
  39. IPT_SYSCTL={{ ipt_sysctl }}
  40. # Extra connection tracking modules to load. Complete list can be found in
  41. # net/netfilter/Kconfig of your kernel source. Some common modules:
  42. # nf_conntrack_irc, nf_nat_irc: DCC (Direct Client to Client) support
  43. # nf_conntrack_netbios_ns: NetBIOS (samba) client support
  44. # nf_conntrack_pptp, nf_nat_pptp: PPTP over stateful firewall/NAT
  45. # nf_conntrack_ftp, nf_nat_ftp: active FTP support
  46. # nf_conntrack_tftp, nf_nat_tftp: TFTP support (server side)
  47. IPT_MODULES="{{ ipt_modules }}"