douyinWEB/scripts/_diag_s3_creds.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 22:42:40 -05:00

39 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
REMOTE = r"""
echo "=== douyinweb-s3 service ==="
systemctl cat douyinweb-s3.service 2>/dev/null | head -40
echo "=== seaweed s3 config files ==="
find /opt/douyinWEB /etc -name '*s3*' -o -name '*seaweed*' 2>/dev/null | head -30
echo "=== grep secrets ==="
grep -r "secret\|access\|identities\|credentials" /opt/douyinWEB/deploy /opt/douyinWEB/scripts /etc/systemd/system/douyinweb-s3* 2>/dev/null | head -25
echo "=== test s3 with both secrets ==="
KEY1=7a9b4d3c9f12bbe404aa2e506ad8e0a4b2ac
KEY2=douyinweb_s3_2026
for KEY in "$KEY1" "$KEY2"; do
echo "-- secret $KEY --"
AWS_ACCESS_KEY_ID=douyin AWS_SECRET_ACCESS_KEY="$KEY" \
aws --endpoint-url http://127.0.0.1:8333 s3 ls s3://douyin-covers/covers/ 2>&1 | head -3 || true
done
echo "=== curl anonymous object ==="
curl -sSI "http://127.0.0.1:8333/douyin-covers/covers/5d3e14cd-8c13-4b7c-9522-e44dc1cad31e.jpg" | head -8
"""
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
_i, o, e = c.exec_command(REMOTE, timeout=120)
print(o.read().decode("utf-8", "replace"))
err = e.read().decode("utf-8", "replace").strip()
if err:
print("ERR", err[:2000])
c.close()