summaryrefslogtreecommitdiff
path: root/chaos-at-home
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2022-01-08 21:23:05 +0100
committerChristian Pointner <equinox@spreadspace.org>2022-01-08 21:23:05 +0100
commit71c05309b3b65870b46146f8fb0155592232ac49 (patch)
treeaa70ad4f2f509d5a4cf8fb2b10dfd4475d8d059b /chaos-at-home
parentnftables/base: initial commit (diff)
simple nftables setup for ch-gw-lan
Diffstat (limited to 'chaos-at-home')
-rw-r--r--chaos-at-home/ch-gw-lan.yml21
1 files changed, 21 insertions, 0 deletions
diff --git a/chaos-at-home/ch-gw-lan.yml b/chaos-at-home/ch-gw-lan.yml
index 5e76e90a..64e1c8b8 100644
--- a/chaos-at-home/ch-gw-lan.yml
+++ b/chaos-at-home/ch-gw-lan.yml
@@ -8,7 +8,28 @@
- role: core/zsh
- role: core/ntp
- role: network/dhcp-server
+ - role: network/nftables/base
post_tasks:
+ - name: install public service nftable rules
+ copy:
+ content: |
+ # Ansible managed
+
+ define nic_lan = lan0
+ define public_ipv4 = {{ network_zones.magenta.prefix | ipaddr(network_zones.magenta.offsets['ch-router']) | ipaddr('address') }}
+
+ table ip nat {
+ chain prerouting {
+ type nat hook prerouting priority -100; policy accept;
+ iif $nic_lan ip daddr $public_ipv4 tcp dport { 222 } dnat to {{ network_zones.svc.prefix | ipaddr(network_zones.svc.offsets['ch-router']) | ipaddr('address') }} comment "ssh-router"
+ {% for name, svc in network_services.items() %}
+ iif $nic_lan ip daddr $public_ipv4 tcp dport { {{ svc.ports | join(', ') }} } dnat to {{ svc.addr }} comment "{{ name }}"
+ {% endfor %}
+ }
+ }
+ dest: /etc/nftables.d/public-services.nft
+ notify: reload nftables
+
- name: install etherwake
apt:
name: etherwake