Reconnect clients after server restart #1177
Replies: 3 comments
|
When you restart the server, the in-memory correlation cache is wiped - this is expected behavior. Here's how to handle it: Solution 1: Use persistent storage on server Start your server with disk-based caching: interactsh-server -d yourdomain.com -diskThe Solution 2: Client-side session recovery Even with # Create a wrapper script
#!/bin/bash
while true; do
interactsh-client -s your-server.com -sf session.txt
echo "Reconnecting in 5s..."
sleep 5
doneSolution 3: Use interactsh-server -d yourdomain.com -persistWhy session files alone don't help: Best setup for HA: interactsh-server -d yourdomain.com -disk -eviction 168hThis persists data and keeps it for 7 days. What version are you running? The |
|
When you restart the server, the in-memory correlation cache is wiped - this is expected behavior. Here's how to handle it: Solution 1: Use persistent storage on server Start your server with disk-based caching: interactsh-server -d yourdomain.com -diskThe Solution 2: Client-side session recovery Even with # Create a wrapper script
#!/bin/bash
while true; do
interactsh-client -s your-server.com -sf session.txt
echo "Reconnecting in 5s..."
sleep 5
doneSolution 3: Use interactsh-server -d yourdomain.com -persistWhy session files alone don't help: Best setup for HA: interactsh-server -d yourdomain.com -disk -eviction 168hThis persists data and keeps it for 7 days. What version are you running? The |
|
The core issue is that interactsh generates a unique correlation ID per client session, and when the server restarts, its in-memory cache of valid correlation IDs is wiped. The client keeps trying to poll with the old ID, but the server doesn't recognize it anymore. Solutions:
interactsh-server -d your.domain.com -disk -disk-path /var/lib/interactsh/After a restart, the server reloads the correlation IDs from disk and existing clients can reconnect.
interactsh-client -s your.domain.com -sf /tmp/interactsh-session.yamlThe session file stores the crypto keys and correlation ID. On reconnect, the client reuses the same ID. But this only works if the server also persists its cache (via
#!/bin/bash
while true; do
interactsh-client -s your.domain.com -token YOUR_TOKEN -sf /tmp/session.yaml -v 2>&1
echo "[*] Client disconnected, reconnecting in 5s..."
sleep 5
done
# /etc/systemd/system/interactsh-client.service
[Service]
ExecStart=/usr/local/bin/interactsh-client -s your.domain.com -sf /var/lib/interactsh/session.yaml
Restart=always
RestartSec=5TL;DR: You need both |
Uh oh!
There was an error while loading. Please reload this page.
Is there a way to automatically reconnect the Interactsh CLI Client after restarting the Interactsh Server?
I'm self-hosting the server.
When I restart the server, simulating a problem/crash, the clients start throwing this error:
[ERR] The correlation id was not found (probably evicted due to inactivity): could not get correlation-id from cache
The server works properly, just not the clients.
A guy suggested using a session file, but that didn't help.
All reactions