mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
Without masquerading, packets sent by the gateway through the TUN interface use the wrong source address (the TUN device's address) instead of the gateway's actual network interface. We set this env variable in all our uses of the gateway, thus we might as well remove it and always perform unconditionally. --------- Signed-off-by: Thomas Eizinger <thomas@eizinger.io> Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com>
25 lines
902 B
Bash
Executable File
25 lines
902 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ -f "${FIREZONE_TOKEN}" ]; then
|
|
FIREZONE_TOKEN="$(cat "${FIREZONE_TOKEN}")"
|
|
export FIREZONE_TOKEN
|
|
fi
|
|
|
|
if [ "${LISTEN_ADDRESS_DISCOVERY_METHOD}" = "gce_metadata" ]; then
|
|
echo "Using GCE metadata to discover listen address"
|
|
|
|
if [ "${PUBLIC_IP4_ADDR}" = "" ]; then
|
|
public_ip4=$(curl "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip" -H "Metadata-Flavor: Google" -s)
|
|
export PUBLIC_IP4_ADDR="${public_ip4}"
|
|
echo "Discovered PUBLIC_IP4_ADDR: ${PUBLIC_IP4_ADDR}"
|
|
fi
|
|
|
|
if [ "${PUBLIC_IP6_ADDR}" = "" ]; then
|
|
public_ip6=$(curl "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ipv6s" -H "Metadata-Flavor: Google" -s)
|
|
export PUBLIC_IP6_ADDR="${public_ip6}"
|
|
echo "Discovered PUBLIC_IP6_ADDR: ${PUBLIC_IP6_ADDR}"
|
|
fi
|
|
fi
|
|
|
|
exec "$@"
|