Add a documented macOS sidecar setup under examples so gateway traffic can be routed through a local Docker WireGuard sidecar for development and testing. Generate persistent FIPS and WireGuard key material on first run and keep those local runtime artifacts out of version control.
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-gateway.sh: container startup logicidentity/fips.keyandidentity/fips.pub: generated persistent gateway identityfips.yaml: FIPS node config used inside the container
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 / fips-gateway 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 gateway 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
fips-gatewaywithdocker 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-gateway.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.
Gateway FIPS Identity
fips-on.sh generates identity/fips.key and identity/fips.pub on first run by calling:
docker run --rm \
-v "$PWD/identity:/etc/fips" \
fips-test:latest \
fipsctl keygen --dir /etc/fips
That key is then bind-mounted into /etc/fips/fips.key, so the gateway 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 gateway 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