Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save florianleibert/d9fb563135886251b56b66bf483ec47d to your computer and use it in GitHub Desktop.

Select an option

Save florianleibert/d9fb563135886251b56b66bf483ec47d to your computer and use it in GitHub Desktop.
export QUEUE='~/dev/amesh/.debug-queue/chris-enrollment' 13:58 [50/1997]
ssh "$FLO_SSH" "mkdir -p $QUEUE; touch $QUEUE/incoming.md $QUEUE/status.md; tail -n +1 -f $QUEUE/status.md $QUEUE/incoming.md"
Terminal 2: run debug + one join attempt
bash <<'CHRIS_DEBUG'
set -u
export FLO_SSH='floleibert@192.168.68.60'
export QUEUE='~/dev/amesh/.debug-queue/chris-enrollment'
export HUB_URL='https://192.168.68.60:8440'
export HUB_FP='sha256:5dee640d944c757d86375ff49dff9f72b254c5dbcb2ce7d96f46aa9becbfddf1'
export CA="$HOME/Downloads/amesh-ca.crt"
export AMESH_HOME="$HOME/.amesh"
post_queue() {
ssh "$FLO_SSH" "cat >> $QUEUE/incoming.md"
}
{
echo
echo "## Chris debug preflight $(date -Is)"
echo '```text'
echo "USER=$(whoami)"
echo "HOME=$HOME"
echo "AMESH_HOME=$AMESH_HOME"
hostnamectl 2>&1 || hostname 2>&1
command -v amesh 2>&1 || true
amesh version 2>&1 || true
command -v wg 2>&1 || true
command -v wg-quick 2>&1 || true
ls -la "$AMESH_HOME" /etc/wireguard "$CA" 2>&1 || true
sudo env | grep -E '^(HOME|AMESH_HOME)=' 2>&1 || true
sudo wg show wg-amesh 2>&1 || true
echo '```'
} 2>&1 | tee /tmp/amesh-chris-preflight.log >(post_queue)
AMESH_HOME="$HOME/.amesh" amesh init 2>&1 || true
sudo -v
{
echo
echo "## Chris join attempt $(date -Is)"
echo '```text'
sudo AMESH_HOME="$AMESH_HOME" amesh join "$HUB_URL" \
--hub-fp "$HUB_FP" \
--hub-ca-cert "$CA" \
--display-name chris-alienware
rc=$?
echo "JOIN_EXIT=$rc"
sudo wg show wg-amesh 2>&1 || true
sudo wg-quick up wg-amesh 2>&1 || true
ls -la /etc/wireguard /etc/wireguard/wg-amesh.conf 2>&1 || true
echo '```'
exit "$rc"
} 2>&1 | tee /tmp/amesh-chris-join.log >(post_queue)
CHRIS_DEBUG
@florianleibert

Copy link
Copy Markdown
Author

http://192.168.68.60:8765

Send Chris this first:

export QUEUE_URL='http://192.168.68.60:8765'

curl -v "$QUEUE_URL/status"

printf 'chris online %s\n' "$(date -Is)" |
curl -v -X POST --data-binary @- "$QUEUE_URL/incoming"

Then have him monitor responses:

export QUEUE_URL='http://192.168.68.60:8765'

while true; do
clear
echo '=== FLO / AGENT STATUS ==='
curl -fsS "$QUEUE_URL/status" || true
echo
echo '=== CHRIS OUTPUT RECEIVED ==='
curl -fsS "$QUEUE_URL/incoming" | tail -n 120 || true
sleep 3
done

You can watch whether he connects:

@florianleibert

Copy link
Copy Markdown
Author

cd /path/to/amesh/go
git pull
go build -o /home/chris/go/bin/amesh ./cmd/amesh-cli

Then he can run:

sudo /home/chris/go/bin/amesh join https://192.168.68.60:8440/
--hub-fp sha256:5dee640d944c757d86375ff49dff9f72b254c5dbcb2ce7d96f46aa9becbfddf1
--hub-ca-cert /tmp/maintainer-ca.crt
--timeout 1h
--wg-reachability-timeout 1h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment