Fixed Tailscale auth sequence

This commit is contained in:
Brian Zalewski 2024-05-13 03:31:26 +00:00
parent f01f38d145
commit 6b201206dc
2 changed files with 32 additions and 13 deletions

View file

@ -1,8 +1,8 @@
-----BEGIN AGE ENCRYPTED FILE----- -----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB4eUNoMlc0VXNQS21zaURI YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBsaGJ1ZG9VWVduVDA4VFA1
aFVtVGpsOGRWQTI0ZFc5ZmpEVUNZRSs5VTMwCmswKzcwOExpbVNZTHpXTE9hK1RW empCeDNERmtWeGhVWTQ5QlpSRXpybjZ2MUFNCkV3UzhXQ3BmRjdwc09LaU5XclNq
N0dkRVRjZXNIYzhXT2tGcmZVMm1XbkkKLS0tIDFCeWJZR1hPN3BISi8wVUo1TmFa VnMyUjdBUXYrWERYVmdPSG4wZWk3TWMKLS0tIE0xQXVBWExnSkl0bndtTjg0cC93
QmVMNnhDUEtGbHNLL0kvcDRpN2FYK2sKjKuAZ9XM2UmZOj9ieANMi6i40MeHCWQV TjVadlVqU3U3aEFCcTB2WFN6UnZxSHcKQszLGd6LHfPXSqkIiF4BzCERqF34QOXJ
aT+tQqnolBmenn0J+VVMSalhnc8/GsIx0kyUV2yM6WvfMWwnlzMUlLk4ULFJy2nl 1vPj7h70g1ay2kjSZ73bw38eLtvne2nzUzEPu0J+XLq30S7j5Tcj9DC3JaetPnnx
vkooM7iZIf8DNXjAZ17uEJs= 25BHfHuTSD++Cj6aq/HA0fsQR9AcWw==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----

View file

@ -15,15 +15,34 @@ if [ -d /Applications ] && [ -d System ]; then
else else
logg info 'tailscaled does not appear to be installed' logg info 'tailscaled does not appear to be installed'
fi fi
### Open Tailscale.app
if [ -d /Applications/Tailscale.app ]; then
logg info 'Opening Tailscale.app menu bar widget' && open -a Tailscale
else
logg info '/Applications/Tailscale.app is missing from the system'
fi
fi fi
### Connect to Tailscale network ### Connect to Tailscale network
if command -v tailscale > /dev/null && [ "$TAILSCALE_AUTH_KEY" != "" ]; then if [ -n "$TAILSCALE_AUTH_KEY" ] && [ "$TAILSCALE_AUTH_KEY" != "" ]; then
logg info 'Connecting to Tailscale with user-defined authentication key' if [ -f /Applications/Tailscale.app/Contents/MacOS/Tailscale ]; then
timeout 14 tailscale up --authkey="$TAILSCALE_AUTH_KEY" --accept-routes || EXIT_CODE=$? logg info 'Connecting to Tailscale with user-defined authentication key (TAILSCALE_AUTH_KEY)'
timeout 30 /Applications/Tailscale.app/Contents/MacOS/Tailscale up --authkey="$TAILSCALE_AUTH_KEY" --accept-routes || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg warn '/Applications/Tailscale.app/Contents/MacOS/Tailscale timed out'
fi
elif command -v tailscale > /dev/null && [ "$TAILSCALE_AUTH_KEY" != "" ]; then
logg info 'Connecting to Tailscale with user-defined authentication key (TAILSCALE_AUTH_KEY)'
timeout 30 tailscale up --authkey="$TAILSCALE_AUTH_KEY" --accept-routes || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then if [ -n "$EXIT_CODE" ]; then
logg warn 'tailscale up timed out' logg warn 'tailscale up timed out'
else else
logg success 'Connected to Tailscale network' logg success 'Connected to Tailscale network'
fi fi
else
logg info 'tailscale does not appear to be installed'
fi
else
logg info 'TAILSCALE_AUTH_KEY is not defined so not logging into Tailscale network'
fi fi