aboutsummaryrefslogtreecommitdiff
path: root/roles/git/files/runner-zola
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-01-03 14:35:21 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-01-03 14:35:21 +0100
commitfc5551b90f4317ccdf2d8c6b6a331647d676e138 (patch)
treef7e7ca66df93062658580c8b2e1e243175c9d7e1 /roles/git/files/runner-zola
parent80636776f6e811f4f1f5e4fe552661cd00ef23ca (diff)
downloadansible-memzero-fc5551b90f4317ccdf2d8c6b6a331647d676e138.tar.gz
ansible-memzero-fc5551b90f4317ccdf2d8c6b6a331647d676e138.zip
firewall: move from iptables to firewalld (nftables)
Diffstat (limited to 'roles/git/files/runner-zola')
-rwxr-xr-xroles/git/files/runner-zola/webhook.sh21
1 files changed, 18 insertions, 3 deletions
diff --git a/roles/git/files/runner-zola/webhook.sh b/roles/git/files/runner-zola/webhook.sh
index 1c10685..b874233 100755
--- a/roles/git/files/runner-zola/webhook.sh
+++ b/roles/git/files/runner-zola/webhook.sh
@@ -18,9 +18,24 @@ while true; do
REF=${REF:-main}
if [ ! -d blog ]; then
- # Use non-redirected port as redirection is handled via PREROUTING
- # iptables rules and if this hook runs on the same machine the request
- # packages will not go through the routing chain.
+ # Use non-redirected port to clone repository as the runner executes on
+ # the same machine as the webserver.
+ #
+ # We use a NAT:PREROUTING chain to implement the redirection (dnat).
+ # However as described by the netfilter packet flow and the connection
+ # tracking system (CONNTRACK), the NAT hooks are only traversed for NEW
+ # connections.
+ # For packages originating from the local machine, the connection will
+ # be seen as NEW by the CONNTRACK system on the OUTPUT path and hence
+ # the NAT:OUTPUT hooks will be traversed.
+ # Once the package is looped-back and arrives at the PREROUTING path,
+ # the NAT:PREROUTING rules wont be traversed as the package is already
+ # known to the CONNTRACK system (not NEW).
+ #
+ # We could additionally implement dnat for lo interface on the OUTPUT
+ # path as described here, but we dont do it and just use the actual
+ # port here :^)
+ # https://unix.stackexchange.com/questions/618229/nftables-destination-nat-block-local-access-to-port
git clone https://git.memzero.de:8443/blog
fi
git -C blog submodule init