jefflix-website/vpn-setup/onboard-user.sh

67 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
# ============================================================
# Generate a Jefflix VPN invite for a new user
# Usage: ./onboard-user.sh [username]
# ============================================================
USERNAME="${1:-}"
if [ -z "$USERNAME" ]; then
echo "Usage: ./onboard-user.sh <username>"
echo " Creates a pre-auth key for the user and prints setup instructions."
exit 1
fi
# Generate a single-use pre-auth key (7 day expiry)
echo "Generating pre-auth key for user: $USERNAME"
PREAUTH_KEY=$(docker exec headscale headscale preauthkeys create \
--user jefflix \
--reusable=false \
--expiration 168h 2>&1 | tail -1)
echo ""
echo "============================================================"
echo " Send the following to $USERNAME:"
echo "============================================================"
echo ""
cat <<MSG
Hey! Here's how to connect to Jefflix:
1. Install Tailscale on your device:
- Windows/Mac/Linux: https://tailscale.com/download
- iOS: Search "Tailscale" in the App Store
- Android: Search "Tailscale" in Google Play
2. Connect to the Jefflix VPN:
Desktop (open a terminal and run):
tailscale up --login-server=https://vpn.jeffemmett.com --authkey=$PREAUTH_KEY
iOS: Settings → tap account → "..." → Use custom coordination server
Server: https://vpn.jeffemmett.com
Then log in with this key: $PREAUTH_KEY
Android: Settings → tap account → "..." → Use alternate server
Server: https://vpn.jeffemmett.com
Then log in with this key: $PREAUTH_KEY
3. Once connected, open your browser and go to:
- http://movies.jefflix.lol (Watch movies & shows)
- http://requests.jefflix.lol (Request new content)
- http://upload.jefflix.lol (Upload your own content)
- http://music.jefflix.lol (Listen to music)
Tailscale runs in the background — you only need to set it up once!
NOTE: This invite key expires in 7 days. Let me know if you need a new one.
MSG
echo ""
echo "============================================================"
echo " Key: $PREAUTH_KEY"
echo " Expires: 7 days"
echo " User: jefflix"
echo "============================================================"