Skip to content

Commit 7ba088f

Browse files
committed
Instrument the client where the hang actually reproduces
The three-corner comparison put this in the certificate path: forty attempts of the same five hostile modes reproduced nothing on upstream and nothing on this branch with public-key targets, while the certificate suite reproduces on the first iteration. So trace the client here rather than in the probe that hits once in sixty. The gateway's log already shows it refusing the target and closing the session within a second; what is missing is which message the client never got. Fork-only: this edits the suite's connect() and is not for PR warp-tech#2397.
1 parent c3e54ef commit 7ba088f

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

.github/workflows/hostile-hunt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
echo "::group::iteration $i"
6363
TIMEOUT=120 poetry run pytest \
6464
test_vault_hostile_target.py test_vault_hostile_certs.py \
65-
-q --tb=short -p no:randomly || { echo "reproduced on iteration $i"; exit 1; }
65+
-q --tb=short -s -p no:randomly || { echo "reproduced on iteration $i"; exit 1; }
6666
echo "::endgroup::"
6767
done
6868
echo "twenty iterations, no reproduction"

tests/test_ssh_target_cert_auth.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from uuid import uuid4
1515

1616
import psutil
17+
import subprocess
18+
1719
import pytest
1820
import yaml
1921

@@ -149,8 +151,20 @@ def start(processes: ProcessManager, wg: WarpgateProcess, user, target, *extra):
149151

150152

151153
def connect(processes: ProcessManager, wg: WarpgateProcess, user, target, timeout, *extra):
152-
client = start(processes, wg, user, target, *extra)
153-
stdout = client.communicate(timeout=timeout)[0]
154+
client = start(processes, wg, user, target, "-v", *extra)
155+
try:
156+
stdout = client.communicate(timeout=timeout)[0]
157+
except subprocess.TimeoutExpired:
158+
# Fork-only instrumentation. The gateway's log already shows it closing
159+
# the session in the same second; this is the other half — the stage the
160+
# client was still waiting at when its patience ran out.
161+
client.kill()
162+
out, err = client.communicate(timeout=10)
163+
print("---- ssh stdout ----")
164+
print(out.decode(errors="replace")[-2000:])
165+
print("---- ssh stderr ----")
166+
print("\n".join(err.decode(errors="replace").splitlines()[-80:]))
167+
raise
154168
return client.returncode, stdout
155169

156170

0 commit comments

Comments
 (0)