@aiassesstech/mighty-mark 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/scripts/gog-reauth.sh +91 -0
- package/src/watchdog/install.sh +21 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiassesstech/mighty-mark",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "System Health Sentinel for AI Assess Tech Fleet — autonomous monitoring, watchdog recovery, and fleet infrastructure oversight.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"src/watchdog",
|
|
21
21
|
"src/watchdog/fleet-backup",
|
|
22
22
|
"src/watchdog/fleet-backup/test",
|
|
23
|
+
"src/scripts",
|
|
23
24
|
"README.md",
|
|
24
25
|
"LICENSE",
|
|
25
26
|
"CHANGELOG.md"
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# GOG Re-Authentication Helper
|
|
3
|
+
# Usage: /usr/local/bin/gog-reauth.sh
|
|
4
|
+
#
|
|
5
|
+
# Prerequisites: socat must be installed (apt install -y socat)
|
|
6
|
+
# Tailscale must be running and connected
|
|
7
|
+
#
|
|
8
|
+
# @see SPEC-GOG-TOKEN-RESILIENCE-1.0.md Section 5.1
|
|
9
|
+
|
|
10
|
+
set -e
|
|
11
|
+
|
|
12
|
+
TAILSCALE_IP="100.92.178.114"
|
|
13
|
+
GOG_ACCOUNT="gidanc.defend.good@gmail.com"
|
|
14
|
+
GOG_SERVICES="gmail,calendar,drive,contacts,docs,sheets"
|
|
15
|
+
export GOG_KEYRING_PASSWORD=test123
|
|
16
|
+
|
|
17
|
+
echo "========================================"
|
|
18
|
+
echo " GOG Re-Authentication Helper"
|
|
19
|
+
echo "========================================"
|
|
20
|
+
echo ""
|
|
21
|
+
|
|
22
|
+
# Kill any existing socat forwarding
|
|
23
|
+
pkill -f "socat.*bind=$TAILSCALE_IP" 2>/dev/null || true
|
|
24
|
+
|
|
25
|
+
# Start GOG auth in background
|
|
26
|
+
gog auth login \
|
|
27
|
+
--account="$GOG_ACCOUNT" \
|
|
28
|
+
--services="$GOG_SERVICES" \
|
|
29
|
+
--force-consent &
|
|
30
|
+
GOG_PID=$!
|
|
31
|
+
|
|
32
|
+
# Wait for GOG to start its HTTP server
|
|
33
|
+
sleep 3
|
|
34
|
+
|
|
35
|
+
# Find the port GOG chose
|
|
36
|
+
PORT=$(ss -tlnp | grep "pid=$GOG_PID" | grep -oP ':([0-9]+)' | head -1 | tr -d ':')
|
|
37
|
+
|
|
38
|
+
if [ -z "$PORT" ]; then
|
|
39
|
+
echo "ERROR: Could not detect GOG auth port."
|
|
40
|
+
echo "Check if GOG auth is running and try manually."
|
|
41
|
+
kill $GOG_PID 2>/dev/null
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
echo "GOG auth server running on port: $PORT"
|
|
46
|
+
echo ""
|
|
47
|
+
|
|
48
|
+
# Start socat to forward Tailscale IP to localhost
|
|
49
|
+
socat TCP-LISTEN:$PORT,bind=$TAILSCALE_IP,fork TCP:127.0.0.1:$PORT &
|
|
50
|
+
SOCAT_PID=$!
|
|
51
|
+
|
|
52
|
+
echo "========================================"
|
|
53
|
+
echo " STEP 1: Open this URL in your browser:"
|
|
54
|
+
echo ""
|
|
55
|
+
echo " http://$TAILSCALE_IP:$PORT"
|
|
56
|
+
echo ""
|
|
57
|
+
echo " STEP 2: Click the account card to re-authorize"
|
|
58
|
+
echo ""
|
|
59
|
+
echo " STEP 3: After Google consent screen, the callback"
|
|
60
|
+
echo " URL will show 127.0.0.1 — change it to:"
|
|
61
|
+
echo " $TAILSCALE_IP"
|
|
62
|
+
echo " and press Enter"
|
|
63
|
+
echo ""
|
|
64
|
+
echo " STEP 4: You should see 'You're connected'"
|
|
65
|
+
echo "========================================"
|
|
66
|
+
echo ""
|
|
67
|
+
echo "Waiting for authentication to complete..."
|
|
68
|
+
echo "Press Ctrl+C when done."
|
|
69
|
+
|
|
70
|
+
# Wait for GOG to finish (|| true prevents set -e from killing the script
|
|
71
|
+
# when GOG exits non-zero after browser callback completes)
|
|
72
|
+
wait $GOG_PID 2>/dev/null || true
|
|
73
|
+
|
|
74
|
+
# Cleanup
|
|
75
|
+
kill $SOCAT_PID 2>/dev/null || true
|
|
76
|
+
|
|
77
|
+
echo ""
|
|
78
|
+
echo "Authentication complete. Testing..."
|
|
79
|
+
|
|
80
|
+
# Smoke test
|
|
81
|
+
export GOG_ACCOUNT="$GOG_ACCOUNT"
|
|
82
|
+
RESULT=$(gog gmail search "newer_than:1d" --max 1 2>&1)
|
|
83
|
+
|
|
84
|
+
if echo "$RESULT" | grep -q "invalid_grant"; then
|
|
85
|
+
echo "FAILED: Token still invalid. Try again."
|
|
86
|
+
exit 1
|
|
87
|
+
else
|
|
88
|
+
echo "SUCCESS: GOG is working. Jessie has Google access."
|
|
89
|
+
echo ""
|
|
90
|
+
echo "$RESULT"
|
|
91
|
+
fi
|
package/src/watchdog/install.sh
CHANGED
|
@@ -287,8 +287,25 @@ if [ -f /etc/cron.d/fleet-backup ]; then
|
|
|
287
287
|
echo " Removed: /etc/cron.d/fleet-backup (now orchestrated by Mighty Mark)"
|
|
288
288
|
fi
|
|
289
289
|
|
|
290
|
-
# ── Step 7:
|
|
291
|
-
echo "[7/
|
|
290
|
+
# ── Step 7: Install GOG re-auth script ──
|
|
291
|
+
echo "[7/9] Installing GOG re-auth script..."
|
|
292
|
+
|
|
293
|
+
GOG_REAUTH_SRC="${SOURCE_DIR}/../scripts/gog-reauth.sh"
|
|
294
|
+
GOG_REAUTH_DEST="/usr/local/bin/gog-reauth.sh"
|
|
295
|
+
|
|
296
|
+
if [ "$DRY_RUN" = true ]; then
|
|
297
|
+
echo " [DRY RUN] Would install ${GOG_REAUTH_DEST}"
|
|
298
|
+
elif [ -f "$GOG_REAUTH_SRC" ]; then
|
|
299
|
+
cp "$GOG_REAUTH_SRC" "$GOG_REAUTH_DEST"
|
|
300
|
+
chmod 700 "$GOG_REAUTH_DEST"
|
|
301
|
+
echo " Installed: ${GOG_REAUTH_DEST} (permissions: 700)"
|
|
302
|
+
else
|
|
303
|
+
echo " Skipped — gog-reauth.sh not found in package"
|
|
304
|
+
echo " Expected at: ${GOG_REAUTH_SRC}"
|
|
305
|
+
fi
|
|
306
|
+
|
|
307
|
+
# ── Step 8: Initialize state ──
|
|
308
|
+
echo "[8/9] Initializing state files..."
|
|
292
309
|
|
|
293
310
|
if [ "$DRY_RUN" = true ]; then
|
|
294
311
|
echo " [DRY RUN] Would initialize state files"
|
|
@@ -301,8 +318,8 @@ else
|
|
|
301
318
|
fi
|
|
302
319
|
fi
|
|
303
320
|
|
|
304
|
-
# ── Step
|
|
305
|
-
echo "[
|
|
321
|
+
# ── Step 9: Test Telegram connectivity ──
|
|
322
|
+
echo "[9/9] Testing Telegram connectivity..."
|
|
306
323
|
|
|
307
324
|
if [ "$DRY_RUN" = true ]; then
|
|
308
325
|
echo " [DRY RUN] Would test Telegram API"
|