Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
187 lines
5.6 KiB
Bash
Executable File
187 lines
5.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Setup OpenClaw Auth Management System
|
|
# Run this once to set up:
|
|
# 1. Long-lived Claude Code token
|
|
# 2. Auth monitoring with notifications
|
|
# 3. Instructions for Termux widgets
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
echo "=== OpenClaw Auth System Setup ==="
|
|
echo ""
|
|
|
|
# Step 1: Check current auth status
|
|
echo "Step 1: Checking current auth status..."
|
|
"$SCRIPT_DIR/claude-auth-status.sh" full || true
|
|
echo ""
|
|
|
|
# Step 2: Set up long-lived token
|
|
echo "Step 2: Long-lived token setup"
|
|
echo ""
|
|
echo "Option A: Use 'claude setup-token' (recommended)"
|
|
echo " - Creates a long-lived API token"
|
|
echo " - No daily re-auth needed"
|
|
echo " - Run: claude setup-token"
|
|
echo ""
|
|
echo "Would you like to set up a long-lived token now? [y/N]"
|
|
read -r SETUP_TOKEN
|
|
|
|
if [[ "$SETUP_TOKEN" =~ ^[Yy] ]]; then
|
|
echo ""
|
|
echo "Opening https://console.anthropic.com/settings/api-keys"
|
|
echo "Create a new key or copy existing one, then paste below."
|
|
echo ""
|
|
claude setup-token
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# Step 3: Set up auth monitoring
|
|
echo "Step 3: Auth monitoring setup"
|
|
echo ""
|
|
echo "The auth monitor checks expiry every 30 minutes and notifies you."
|
|
echo ""
|
|
echo "Configure notification channels:"
|
|
echo ""
|
|
|
|
# Check for ntfy
|
|
echo " ntfy.sh: Free push notifications to your phone"
|
|
echo " 1. Install ntfy app on your phone"
|
|
echo " 2. Subscribe to a topic (e.g., 'openclaw-alerts')"
|
|
echo ""
|
|
echo "Enter ntfy.sh topic (or leave blank to skip):"
|
|
read -r NTFY_TOPIC
|
|
|
|
# Phone notification
|
|
echo ""
|
|
echo " OpenClaw message: Send warning via OpenClaw itself"
|
|
echo "Enter your phone number for alerts (or leave blank to skip):"
|
|
read -r PHONE_NUMBER
|
|
|
|
# Install systemd units
|
|
SERVICE_TEMPLATE="$SCRIPT_DIR/systemd/openclaw-auth-monitor.service"
|
|
SYSTEMD_USER_DIR="$HOME/.config/systemd/user"
|
|
SERVICE_TARGET="$SYSTEMD_USER_DIR/openclaw-auth-monitor.service"
|
|
TIMER_TARGET="$SYSTEMD_USER_DIR/openclaw-auth-monitor.timer"
|
|
AUTH_MONITOR_PATH="$SCRIPT_DIR/auth-monitor.sh"
|
|
|
|
echo ""
|
|
echo "Installing systemd timer..."
|
|
mkdir -p "$SYSTEMD_USER_DIR"
|
|
|
|
SERVICE_TEMP="$(mktemp "$SYSTEMD_USER_DIR/openclaw-auth-monitor.service.XXXXXX")"
|
|
SERVICE_RENDERED=""
|
|
cleanup_service_temp() {
|
|
rm -f "$SERVICE_TEMP" "$SERVICE_RENDERED"
|
|
}
|
|
trap cleanup_service_temp EXIT
|
|
SERVICE_RENDERED="$(mktemp "$SYSTEMD_USER_DIR/openclaw-auth-monitor.service.rendered.XXXXXX")"
|
|
|
|
cp "$SERVICE_TEMPLATE" "$SERVICE_TEMP"
|
|
|
|
systemd_quote_arg() {
|
|
local value="$1"
|
|
value="${value//\\/\\\\}"
|
|
value="${value//%/%%}"
|
|
value="${value//\$/\$\$}"
|
|
value="${value//\"/\\\"}"
|
|
printf '"%s"' "$value"
|
|
}
|
|
|
|
render_environment_line() {
|
|
local key="$1"
|
|
local placeholder="$2"
|
|
local value="$3"
|
|
|
|
if [ -n "$value" ]; then
|
|
printf 'Environment=%s=%s' "$key" "$value"
|
|
else
|
|
printf '# Environment=%s=%s' "$key" "$placeholder"
|
|
fi
|
|
}
|
|
|
|
RENDERED_EXEC_START="ExecStart=$(systemd_quote_arg "$AUTH_MONITOR_PATH")"
|
|
RENDERED_NTFY_LINE="$(render_environment_line "NOTIFY_NTFY" "openclaw-alerts" "$NTFY_TOPIC")"
|
|
RENDERED_PHONE_LINE="$(render_environment_line "NOTIFY_PHONE" "+1234567890" "$PHONE_NUMBER")"
|
|
FOUND_EXEC_START=0
|
|
FOUND_NTFY=0
|
|
FOUND_PHONE=0
|
|
|
|
while IFS= read -r line || [ -n "$line" ]; do
|
|
if [[ "$line" =~ ^[[:space:]]*ExecStart=.*$ ]]; then
|
|
printf '%s\n' "$RENDERED_EXEC_START"
|
|
FOUND_EXEC_START=1
|
|
elif [[ "$line" =~ ^[[:space:]]*#?[[:space:]]*Environment=NOTIFY_NTFY=.*$ ]]; then
|
|
printf '%s\n' "$RENDERED_NTFY_LINE"
|
|
FOUND_NTFY=1
|
|
elif [[ "$line" =~ ^[[:space:]]*#?[[:space:]]*Environment=NOTIFY_PHONE=.*$ ]]; then
|
|
printf '%s\n' "$RENDERED_PHONE_LINE"
|
|
FOUND_PHONE=1
|
|
else
|
|
printf '%s\n' "$line"
|
|
fi
|
|
done < "$SERVICE_TEMP" > "$SERVICE_RENDERED"
|
|
|
|
if [ "$FOUND_EXEC_START" -ne 1 ]; then
|
|
echo "ERROR: ExecStart line not found in $SERVICE_TEMPLATE" >&2
|
|
exit 1
|
|
fi
|
|
if [ "$FOUND_NTFY" -ne 1 ]; then
|
|
echo "ERROR: NOTIFY_NTFY placeholder not found in $SERVICE_TEMPLATE" >&2
|
|
exit 1
|
|
fi
|
|
if [ "$FOUND_PHONE" -ne 1 ]; then
|
|
echo "ERROR: NOTIFY_PHONE placeholder not found in $SERVICE_TEMPLATE" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mv "$SERVICE_RENDERED" "$SERVICE_TEMP"
|
|
|
|
mv "$SERVICE_TEMP" "$SERVICE_TARGET"
|
|
trap - EXIT
|
|
cp "$SCRIPT_DIR/systemd/openclaw-auth-monitor.timer" "$TIMER_TARGET"
|
|
systemctl --user daemon-reload
|
|
systemctl --user enable --now openclaw-auth-monitor.timer
|
|
|
|
echo "Auth monitor installed and running."
|
|
echo ""
|
|
|
|
# Step 4: Termux widget setup
|
|
echo "Step 4: Termux widget setup (for phone)"
|
|
echo ""
|
|
echo "To set up quick auth from your phone:"
|
|
echo ""
|
|
echo "1. Install Termux and Termux:Widget from F-Droid"
|
|
echo "2. Create ~/.shortcuts/ directory in Termux:"
|
|
echo " mkdir -p ~/.shortcuts"
|
|
echo ""
|
|
echo "3. Copy the widget scripts:"
|
|
echo " scp $SCRIPT_DIR/termux-quick-auth.sh phone:~/.shortcuts/ClawdAuth"
|
|
echo " scp $SCRIPT_DIR/termux-auth-widget.sh phone:~/.shortcuts/ClawdAuth-Full"
|
|
echo ""
|
|
echo "4. Make them executable on phone:"
|
|
echo " ssh phone 'chmod +x ~/.shortcuts/Clawd*'"
|
|
echo ""
|
|
echo "5. Add Termux:Widget to your home screen"
|
|
echo "6. Tap the widget to see your auth scripts"
|
|
echo ""
|
|
echo "The quick widget (ClawdAuth) shows status and opens auth URL if needed."
|
|
echo "The full widget (ClawdAuth-Full) provides guided re-auth flow."
|
|
echo ""
|
|
|
|
# Summary
|
|
echo "=== Setup Complete ==="
|
|
echo ""
|
|
echo "What's configured:"
|
|
echo " - Auth status: $SCRIPT_DIR/claude-auth-status.sh"
|
|
echo " - Mobile re-auth: $SCRIPT_DIR/mobile-reauth.sh"
|
|
echo " - Auth monitor: systemctl --user status openclaw-auth-monitor.timer"
|
|
echo ""
|
|
echo "Quick commands:"
|
|
echo " Check auth: $SCRIPT_DIR/claude-auth-status.sh"
|
|
echo " Re-auth: $SCRIPT_DIR/mobile-reauth.sh"
|
|
echo " Test monitor: $SCRIPT_DIR/auth-monitor.sh"
|
|
echo ""
|