|
|
@@ -4,10 +4,41 @@ |
|
|
|
# |
|
|
|
{% from "firewalld/map.jinja" import firewalld with context %} |
|
|
|
|
|
|
|
{%- if salt['pillar.get']('firewalld:ipset') %} |
|
|
|
# Backward compatibility setting and deprecation notices |
|
|
|
{% set ipset_manage = false %} |
|
|
|
{% set ipset_pkg = 'ipset' %} |
|
|
|
{% set ipset_sets = firewalld.ipsets %} |
|
|
|
|
|
|
|
{% if firewalld.ipset is mapping %} |
|
|
|
{% set ipset_manage = firewalld.ipset.manage %} |
|
|
|
{% set ipset_pkg = firewalld.ipset.pkg %} |
|
|
|
{% else %} |
|
|
|
### Manage setting (old firewalld:ipset) |
|
|
|
firewalld-ipset-deprecated: |
|
|
|
test.show_notification: |
|
|
|
- text: | |
|
|
|
'firewalld:ipset' format has changed and setting it as boolean is deprecated. |
|
|
|
Set 'firewalld:ipset:manage' instead. |
|
|
|
See firewalld/pillar.example for more information |
|
|
|
|
|
|
|
{% set ipset_manage = firewalld.ipset %} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
### Package setting (old firewalld:ipsetpackage) |
|
|
|
{% if firewalld.ipsetpackage is defined %} |
|
|
|
firewalld-ipsetpackage-deprecated: |
|
|
|
test.show_notification: |
|
|
|
- text: | |
|
|
|
'firewalld:ipsetpackage' is deprecated. Use 'firewalld:ipset:pkg' instead |
|
|
|
See firewalld/pillar.example for more information |
|
|
|
|
|
|
|
{% set ipset_pkg = firewalld.ipsetpackage %} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
{%- if ipset_manage %} |
|
|
|
package_ipset: |
|
|
|
pkg.installed: |
|
|
|
- name: {{ firewalld.ipsetpackage }} |
|
|
|
- name: {{ ipset_pkg }} |
|
|
|
|
|
|
|
directory_firewalld_ipsets: |
|
|
|
file.directory: # make sure this is a directory |
|
|
@@ -26,8 +57,8 @@ directory_firewalld_ipsets: |
|
|
|
# |
|
|
|
# This defines a ipset configuration, see firewalld.ipset (5) man page. |
|
|
|
# |
|
|
|
{% for k, v in salt['pillar.get']('firewalld:ipsets', {}).items() %} |
|
|
|
{% set z_name = v.name|default(k) %} |
|
|
|
{% for k, v in ipset_sets.items() %} |
|
|
|
{% set z_name = v.name|default(k) %} |
|
|
|
|
|
|
|
/etc/firewalld/ipsets/{{ z_name }}.xml: |
|
|
|
file.managed: |
|
|
@@ -48,5 +79,5 @@ directory_firewalld_ipsets: |
|
|
|
name: {{ z_name }} |
|
|
|
ipset: {{ v }} |
|
|
|
|
|
|
|
{% endfor %} |
|
|
|
{% endfor %} |
|
|
|
{%- endif %} |