The configuration reference, the shipped fips.yaml and two code comments said that setting dns.bind_addr to "::" exposes the responder to mesh peers. On Linux, macOS and FreeBSD with the daemon's own TUN, queries arriving on the mesh interface are dropped, so a wildcard bind in fact serves the host's other networks, and every host on them that can reach the port. They now say that, and that mesh peers are served on Windows, with an application-supplied TUN, or when the daemon logs at start that the mesh interface index is unresolved. The reference and fips.yaml also say that a reply goes to the query's source by the routing table, so a host on one of those networks that forges a mesh source address has the reply sent into the mesh from this node's mesh address. The macOS WireGuard container example published the container's DNS port on every host interface. It is now published on 127.0.0.1 only, which is all the macOS resolver it serves needs.
5.2 KiB
WireGuard Sidecar For macOS
This example lets macOS reach the FIPS mesh through a local Docker container.
Files
fips-on.sh: user-facing startup wrapperfips-host.sh: small privileged helper for macOS networkingfips-off.sh: teardown wrapperentrypoint-sidecar.sh: container startup logicidentity/fips.keyandidentity/fips.pub: generated persistent sidecar identityfips.yaml: FIPS node config used inside the container
Prerequisites
fips-on.sh generates the sidecar identity with fipsctl from the fips-test:latest image, which this example's docker-compose.yml does not build. Build it once from the repo root before the first run:
./testing/scripts/build.sh
Configure Peers
Before first use, replace the placeholder bootstrap peer in fips.yaml with a real peer for the mesh you want to join.
Startup Flow
macOS user fips-on.sh Docker / wireguard-sidecar fips-host.sh (sudo)
| | | |
| ./fips-on.sh | | |
|---------------> | | |
| | generate fips.key | |
| | generate client keys | |
| |----------------------->| bind-mount identity/ |
| | start/recreate container |
| |----------------------->| entrypoint starts |
| | | generate server keys |
| | | wait for client.pub |
| | | bring up wg0 |
| | poll `wg show wg0` | |
| |<-----------------------| |
| | sudo fips-host.sh on | |
| |------------------------------------------------->|
| | | write /etc/wireguard |
| | | wg-quick up fips0 |
| | | write /etc/resolver/fips |
| | | flush DNS |
| |<-------------------------------------------------|
| ready | | |
What fips-on.sh Does
- Creates
identity/andidentity/wireguard/if needed. - Generates
identity/fips.keyandidentity/fips.pubwithfipsctl keygen --dir /etc/fipsif the sidecar does not already have a persistent identity. - Generates the host WireGuard client keypair if missing.
- Fixes ownership on the generated client key files so the Docker bind mount stays readable on macOS.
- Starts
wireguard-sidecarwithdocker compose up -d --build --force-recreate. - Waits until the container has created and brought up
wg0. - Calls the privileged helper to configure host networking:
- writes
/etc/wireguard/fips0.conf - runs
wg-quick up fips0 - writes
/etc/resolver/fips - flushes macOS DNS caches
- writes
What Happens In The Container
entrypoint-sidecar.sh:
- Generates the server WireGuard keypair on first run.
- Waits briefly for
identity/wireguard/client.pubfrom the host. - Writes the container-side
wg0config. - Brings up
wg0on UDP port51820. - Starts
fips --config /etc/fips/fips.yamlusing the bind-mountedidentity/fips.key. - Enables forwarding and NAT66 from
wg0towardfips0for FIPSfd00::/8destinations only.
Only FIPS traffic for fd00::/8 is forwarded through the sidecar. Regular
internet traffic still uses the macOS host network and does not route through
wg0 or fips0.
The container's DNS port 5354 is published on 127.0.0.1 only, for the macOS
resolver that /etc/resolver/fips points at, and not to the network.
Sidecar FIPS Identity
fips-on.sh generates identity/fips.key and identity/fips.pub on first run by calling:
docker run --rm \
--entrypoint fipsctl \
-v "$PWD/identity:/etc/fips" \
fips-test:latest \
keygen --dir /etc/fips
That key is then bind-mounted into /etc/fips/fips.key, so the sidecar keeps
the same FIPS identity even though fips-on.sh uses docker compose up --force-recreate.
Delete identity/fips.key if you want the next ./fips-on.sh run to create a
fresh sidecar identity.
Why sudo Is Still Needed
Only fips-host.sh needs root, because macOS requires it for:
/etc/wireguard/fips0.conf/etc/resolver/fipswg-quick up/down- DNS cache flushes
Everything else runs as the normal user.
Teardown
Run:
./fips-off.sh
This:
- Calls
sudo ./fips-host.sh offto remove the host WireGuard and DNS config. - Stops the Docker container.
Generated Files
These are local runtime artifacts under identity/ and should not be committed:
identity/fips.keyidentity/fips.pubidentity/wireguard/client.keyidentity/wireguard/client.pubidentity/wireguard/server.keyidentity/wireguard/server.pubidentity/wireguard/wg0.conf