feat(wireguard): admit a host's WireGuard listen ports #54
No reviewers
Labels
No labels
bug
cannot reproduce
duplicate
enhancement
help wanted
invalid
need info
need triage
need verification
not a bug
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
claudiomaradonna/castrum!54
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/wireguard-port"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
fortify.ymlloads theinet castrumnftables table on every Linux host,with an input policy of drop that admits only SSH and the ports of the
service roles switched on. A host that terminates a WireGuard tunnel
listens on a UDP port for its peers' handshakes, and no role opened it:
the first run dropped the handshakes and took the tunnel down, and where
SSH runs over that tunnel, the host was then reachable only from its
console.
Closes #53
What changed
A host can now declare that it listens for WireGuard. Before, no setting
admitted its listen port. After,
wireguard_enabled: truein the host'svariables adds a
wireguardchain that admits new UDP packets on eachport in
wireguard_ports(default[51820], one per interface'sListenPort) from every source, IPv4 and IPv6.The new
wireguardrole has the same shape askdeconnect. It holdsonly a flag and a port file,
roles/wireguard/vars/firewall.yml, whichfirewall-applyreads like any other service's. The role is inservice_rolesand in the role catalogue.firewall-applyitself isunchanged.
A host that does not set the flag renders the same table as before, so
its next run reloads nothing. The role leaves installing, configuring and
keying WireGuard to the host.
How to verify
Prerequisites: Setup,
make setup. Basemainat
7ee3e7f, branchfeat/wireguard-portat13cfd32. From the checkout'sroot on each revision, render the table for a host that declares
WireGuard on port 51821 and list what names it:
Base:
grepprints nothing, so the handshake would be dropped.Branch, run as written:
Checks run on
13cfd32:make checkpassed.tests/gates/check_firewall_render.shcase 6 holds two new checks:with "the host that declares WireGuard has no jump to a wireguard
chain".
on both revisions.
Untested:
make test(molecule'snft -cand live load) did not run,because the environment had no podman. Expected result: it passes
unchanged.
firewall-applyand its scenarios are untouched, and the newrule has the form
kdeconnect's UDP rule already renders.Considerations
packet that is not authenticated to the host's key, and its peers are
often roaming clients outside the inventory. Restricting it to
from_grouppeers would also be IPv4-only.ListenPortis not 51820 must setwireguard_ports.Otherwise the wrong port opens and the handshake is still dropped. The
role README says so.