From 75b9f2a395fe042018053031bc3e99b771b60889 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sat, 27 Jul 2024 12:44:19 +0100 Subject: postfix: add firewall rules --- ansible/group_vars/all/nftables.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ansible') diff --git a/ansible/group_vars/all/nftables.yml b/ansible/group_vars/all/nftables.yml index 0e94af9..64d7976 100644 --- a/ansible/group_vars/all/nftables.yml +++ b/ansible/group_vars/all/nftables.yml @@ -14,6 +14,16 @@ nftables_configuration: | } } + {% if "mail" in group_names %} + set mail_accepted { + type inet_service + elements = { + smtp, + smtps + } + } + {% endif %} + {% if "databases" in group_names %} # Access control for database server set possible_lke_ipv4_addrs { @@ -69,6 +79,14 @@ nftables_configuration: | {% if ansible_default_ipv6 is defined %} iifname {{ ansible_default_ipv6.interface }} ip6 saddr @possible_lke_ipv6_addrs tcp dport postgresql ct state new accept {% endif %} + {% endif %} + + {% if "mail" in group_names %} + # Inbound mail + iifname {{ ansible_default_ipv4.interface }} tcp dport @mail_accepted ct state new accept + {% if ansible_default_ipv6 is defined %} + iifname {{ ansible_default_ipv6.interface }} tcp dport @mail_accepted ct state new accept + {% endif %} {% endif %} } -- cgit v1.2.3