diff --git a/.gitea/workflows/read-auth.yml b/.gitea/workflows/read-auth.yml new file mode 100644 index 000000000..418e5b0e1 --- /dev/null +++ b/.gitea/workflows/read-auth.yml @@ -0,0 +1,38 @@ +name: Read Auth Logic + +on: + push: + branches: + - 'debug/cmd-agent' + +jobs: + read: + name: Read check_auth logic + runs-on: host + timeout-minutes: 3 + steps: + - name: Read + shell: bash + run: | + echo "=== Full server.py (lines 1-50) ===" + sed -n '1,50p' /opt/xiaoxia-cmd-agent/server.py + echo "" + echo "=== Lines 120-160 (startup logic) ===" + sed -n '120,160p' /opt/xiaoxia-cmd-agent/server.py + echo "" + echo "=== Test with X-Token header ===" + curl -s -X POST http://127.0.0.1:18888/cmd-agent/exec \ + -H "X-Token: $(cat /etc/xiaoxia-cmd-agent.token)" \ + -H "Content-Type: application/json" \ + -d '{"command":"hostname"}' + echo "" + echo "=== Test with token in query string ===" + curl -s -X POST "http://127.0.0.1:18888/cmd-agent/exec?token=$(cat /etc/xiaoxia-cmd-agent.token)" \ + -H "Content-Type: application/json" \ + -d '{"command":"hostname"}' + echo "" + echo "=== Check if path is /exec not /cmd-agent/exec ===" + curl -s -X POST http://127.0.0.1:18888/exec \ + -H "Authorization: Bearer $(cat /etc/xiaoxia-cmd-agent.token)" \ + -H "Content-Type: application/json" \ + -d '{"command":"hostname"}'