#+NAME: iot-forward
#+CAPTION: ~iot-forward~
#+BEGIN_SRC conf
--A ufw-user-forward -i lan -o wild -j ACCEPT
--A ufw-user-forward -i wg0 -o wild -j ACCEPT
+-A ufw-before-forward -i lan -o wild -j ACCEPT
+-A ufw-before-forward -i wg0 -o wild -j ACCEPT
#+END_SRC
The ~lan~ interface encompasses the private LAN and the public VPN.
** Configure UFW for IoT
-The following tasks install the additional rules in =before.rules=
-and =user.rules= (as in [[file:Institute/README.org::*Configure UFW][Configure UFW]]).
+The following task installs the additional rules in =before.rules= (as
+in [[file:Institute/README.org::*Configure UFW][Configure UFW]]).
#+CAPTION: [[file:roles_t/abbey-gate/tasks/main.yml][=roles_t/abbey-gate/tasks/main.yml=]]
#+BEGIN_SRC conf :tangle roles_t/abbey-gate/tasks/main.yml :noweb no-export :mkdirp yes
---
-- name: Configure UFW NAT rules for IoT.
+- name: Configure UFW rules for IoT.
become: yes
blockinfile:
block: |
*nat
<<iot-nat>>
COMMIT
- dest: /etc/ufw/before.rules
- marker: "# {mark} ABBEY MANAGED BLOCK"
- insertafter: EOF
- prepend_newline: yes
-
-- name: Configure UFW FORWARD rules for IoT.
- become: yes
- blockinfile:
- block: |
*filter
<<iot-forward>>
COMMIT
- dest: /etc/ufw/user.rules
+ dest: /etc/ufw/before.rules
marker: "# {mark} ABBEY MANAGED BLOCK"
insertafter: EOF
prepend_newline: yes
---
-- name: Configure UFW NAT rules for IoT.
+- name: Configure UFW rules for IoT.
become: yes
blockinfile:
block: |
-A POSTROUTING -s {{ private_net_cidr }} -o wild -j MASQUERADE
-A POSTROUTING -s {{ public_wg_net_cidr }} -o wild -j MASQUERADE
COMMIT
- dest: /etc/ufw/before.rules
- marker: "# {mark} ABBEY MANAGED BLOCK"
- insertafter: EOF
- prepend_newline: yes
-
-- name: Configure UFW FORWARD rules for IoT.
- become: yes
- blockinfile:
- block: |
*filter
- -A ufw-user-forward -i lan -o wild -j ACCEPT
- -A ufw-user-forward -i wg0 -o wild -j ACCEPT
+ -A ufw-before-forward -i lan -o wild -j ACCEPT
+ -A ufw-before-forward -i wg0 -o wild -j ACCEPT
COMMIT
- dest: /etc/ufw/user.rules
+ dest: /etc/ufw/before.rules
marker: "# {mark} ABBEY MANAGED BLOCK"
insertafter: EOF
prepend_newline: yes