Saltstack Official IPTables 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.

86 lines
2.4KB

  1. {% set schema = salt['grains.filter_by']({
  2. 'default': {
  3. },
  4. }, grain='os_family', merge=salt['pillar.get']('iptables:schema')) %}
  5. {% set service = salt['grains.filter_by']({
  6. 'RedHat': {
  7. 'v4': {
  8. 'enabled': true,
  9. 'persistent_config': '/etc/sysconfig/iptables',
  10. 'pkgs': [ 'iptables', 'iptables-services' ],
  11. 'service': 'iptables',
  12. 'modules': [],
  13. },
  14. 'v6': {
  15. 'enabled': true,
  16. 'persistent_config': '/etc/sysconfig/ip6tables',
  17. 'pkgs': [ 'iptables', 'iptables-services' ],
  18. 'service': 'iptables',
  19. 'modules': [],
  20. },
  21. },
  22. 'Debian': {
  23. 'v4': {
  24. 'enabled': true,
  25. 'persistent_config': '/etc/iptables/rules.v4',
  26. 'pkgs': [ 'iptables','iptables-persistent' ],
  27. 'service': 'netfilter-persistent',
  28. 'modules': [ 'iptable_filter', 'ip_tables' ],
  29. },
  30. 'v6': {
  31. 'enabled': true,
  32. 'persistent_config': '/etc/iptables/rules.v6',
  33. 'pkgs': [ 'iptables','iptables-persistent' ],
  34. 'service': 'netfilter-persistent',
  35. 'modules': [ 'ip6table_filter', 'ip6_tables' ],
  36. },
  37. },
  38. }, grain='os_family', merge=salt['pillar.get']('iptables:service')) %}
  39. {% set defaults = salt['grains.filter_by']({
  40. 'default': {
  41. 'v4': {
  42. 'metadata_rules': false,
  43. 'policy': 'ACCEPT',
  44. 'ruleset': {
  45. 'action': 'ACCEPT',
  46. 'params': '',
  47. 'rule': '',
  48. },
  49. },
  50. 'v6': {
  51. 'metadata_rules': false,
  52. 'policy': 'ACCEPT',
  53. 'ruleset': {
  54. 'action': 'ACCEPT',
  55. 'params': '',
  56. 'rule': '',
  57. },
  58. },
  59. },
  60. }, grain='os_family', merge=salt['pillar.get']('iptables:defaults')) %}
  61. {% set tables = salt['grains.filter_by']({
  62. 'default': {
  63. 'v4': {
  64. 'filter': {
  65. 'chains': {
  66. 'INPUT': {},
  67. 'OUTPUT': {},
  68. 'FORWARD': {},
  69. },
  70. },
  71. },
  72. 'v6': {
  73. 'filter': {
  74. 'chains': {
  75. 'INPUT': {},
  76. 'OUTPUT': {},
  77. 'FORWARD': {},
  78. },
  79. },
  80. },
  81. },
  82. }, grain='os_family', merge=salt['pillar.get']('iptables:tables')) %}