fix(vpn-node-config): resolve ansible-lint violations
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 40s
OpenVPN Ansible / Ansible Lint (push) Successful in 59s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 1m57s
OpenVPN Ansible / Generate SBOM (push) Successful in 58s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 21s
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 40s
OpenVPN Ansible / Ansible Lint (push) Successful in 59s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 1m57s
OpenVPN Ansible / Generate SBOM (push) Successful in 58s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 21s
This commit is contained in:
@@ -102,8 +102,8 @@ world-readable `/var/lib/node_exporter/textfile` directory and enables
|
|||||||
systemd, conntrack, filesystem, netdev, textfile, time, and timex collectors;
|
systemd, conntrack, filesystem, netdev, textfile, time, and timex collectors;
|
||||||
`node_exporter_systemd_unit_filter` restricts unit metrics.
|
`node_exporter_systemd_unit_filter` restricts unit metrics.
|
||||||
|
|
||||||
On the NAT gateway, `node_exporter_port` defaults to 9100 and
|
On the NAT gateway, `nat_gateway_node_exporter_port` defaults to 9100 and
|
||||||
`node_exporter_allowed_source` uses `monitoring_vm_ip`. Both the
|
`nat_gateway_node_exporter_allowed_source` uses `monitoring_vm_ip`. Both the
|
||||||
ACCEPT for that source and DROP for all other sources on the port are written
|
ACCEPT for that source and DROP for all other sources on the port are written
|
||||||
into `ensure-nat-gateway-firewall.j2`, so the gateway firewall persistence
|
into `ensure-nat-gateway-firewall.j2`, so the gateway firewall persistence
|
||||||
service owns them.
|
service owns them.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
---
|
---
|
||||||
collections:
|
collections:
|
||||||
|
- name: ansible.posix
|
||||||
- name: community.general
|
- name: community.general
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ nat_gateway_private_interface: enp7s0
|
|||||||
nat_gateway_public_interface: eth0
|
nat_gateway_public_interface: eth0
|
||||||
nat_gateway_firewall_script: /usr/local/sbin/ensure-nat-gateway-firewall
|
nat_gateway_firewall_script: /usr/local/sbin/ensure-nat-gateway-firewall
|
||||||
# Exporter firewall accepts this private source and drops all others on its port.
|
# Exporter firewall accepts this private source and drops all others on its port.
|
||||||
node_exporter_port: 9100
|
nat_gateway_node_exporter_port: 9100
|
||||||
node_exporter_allowed_source: "{{ monitoring_vm_ip }}"
|
nat_gateway_node_exporter_allowed_source: "{{ monitoring_vm_ip }}"
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ iptables -C FORWARD -i {{ nat_gateway_private_interface }} -o {{ nat_gateway_pub
|
|||||||
iptables -C FORWARD -i {{ nat_gateway_public_interface }} -o {{ nat_gateway_private_interface }} -d {{ nat_gateway_private_cidr }} -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT 2>/dev/null || \
|
iptables -C FORWARD -i {{ nat_gateway_public_interface }} -o {{ nat_gateway_private_interface }} -d {{ nat_gateway_private_cidr }} -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT 2>/dev/null || \
|
||||||
iptables -A FORWARD -i {{ nat_gateway_public_interface }} -o {{ nat_gateway_private_interface }} -d {{ nat_gateway_private_cidr }} -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
iptables -A FORWARD -i {{ nat_gateway_public_interface }} -o {{ nat_gateway_private_interface }} -d {{ nat_gateway_private_cidr }} -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
||||||
|
|
||||||
iptables -C INPUT -p tcp -s {{ node_exporter_allowed_source }} --dport {{ node_exporter_port }} -j ACCEPT 2>/dev/null || \
|
iptables -C INPUT -p tcp -s {{ nat_gateway_node_exporter_allowed_source }} --dport {{ nat_gateway_node_exporter_port }} -j ACCEPT 2>/dev/null || \
|
||||||
iptables -I INPUT 1 -p tcp -s {{ node_exporter_allowed_source }} --dport {{ node_exporter_port }} -j ACCEPT
|
iptables -I INPUT 1 -p tcp -s {{ nat_gateway_node_exporter_allowed_source }} --dport {{ nat_gateway_node_exporter_port }} -j ACCEPT
|
||||||
|
|
||||||
iptables -C INPUT -p tcp --dport {{ node_exporter_port }} -j DROP 2>/dev/null || \
|
iptables -C INPUT -p tcp --dport {{ nat_gateway_node_exporter_port }} -j DROP 2>/dev/null || \
|
||||||
iptables -I INPUT 2 -p tcp --dport {{ node_exporter_port }} -j DROP
|
iptables -I INPUT 2 -p tcp --dport {{ nat_gateway_node_exporter_port }} -j DROP
|
||||||
|
|||||||
@@ -80,14 +80,14 @@
|
|||||||
# ---- Verification (both paths) ----
|
# ---- Verification (both paths) ----
|
||||||
- name: Verify selected route to internet
|
- name: Verify selected route to internet
|
||||||
ansible.builtin.command: ip -4 route get 8.8.8.8
|
ansible.builtin.command: ip -4 route get 8.8.8.8
|
||||||
register: private_route_get
|
register: private_routing_route_get
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: private_routing_gateway not in private_route_get.stdout or private_routing_interface not in private_route_get.stdout
|
failed_when: private_routing_gateway not in private_routing_route_get.stdout or private_routing_interface not in private_routing_route_get.stdout
|
||||||
|
|
||||||
- name: Verify DNS resolution through the gateway
|
- name: Verify DNS resolution through the gateway
|
||||||
ansible.builtin.command: getent hosts archive.ubuntu.com
|
ansible.builtin.command: getent hosts archive.ubuntu.com
|
||||||
register: private_dns_check
|
register: private_routing_dns_check
|
||||||
changed_when: false
|
changed_when: false
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 3
|
delay: 3
|
||||||
until: private_dns_check.rc == 0
|
until: private_routing_dns_check.rc == 0
|
||||||
|
|||||||
Reference in New Issue
Block a user