From d28c1d073494b308269f7987971ac4c3678fe8e4 Mon Sep 17 00:00:00 2001 From: fred Date: Fri, 23 Feb 2024 00:19:33 +0100 Subject: [PATCH] Boostrap SSH Dragons WOT --- RUNTIME/DRAGON_p2p_ssh.sh | 19 +++++++++++-------- RUNTIME/G1Voeu.sh | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/RUNTIME/DRAGON_p2p_ssh.sh b/RUNTIME/DRAGON_p2p_ssh.sh index 9a12acb7..f83529bb 100755 --- a/RUNTIME/DRAGON_p2p_ssh.sh +++ b/RUNTIME/DRAGON_p2p_ssh.sh @@ -27,7 +27,8 @@ if [[ "${PARAM,,}" == "off" || "${PARAM,,}" == "stop" ]]; then fi ############################################ -## DISTRIBUTE DRAGON SSH WOT SEED : A_boostrap_ssh.txt +## DISTRIBUTE DRAGON SSH WOT SEED +# A_boostrap_ssh.txt ############################################ while IFS= read -r line do @@ -55,12 +56,12 @@ gpg --export-ssh-key $(cat ~/.zen/game/players/.current/.player) 2>/dev/null > ~ ############################################ echo "Lanching /x/ssh-${IPFSNODEID}" -[[ ! $(ipfs p2p ls | grep "/x/ssh-${IPFSNODEID}") ]] && ipfs p2p listen /x/ssh-${IPFSNODEID} /ip4/127.0.0.1/tcp/22 +[[ ! $(ipfs p2p ls | grep "/x/ssh-${IPFSNODEID}") ]] \ + && ipfs p2p listen /x/ssh-${IPFSNODEID} /ip4/127.0.0.1/tcp/22 ipfs p2p ls echo -echo "#!/bin/bash" ############################################ ## PREPARE x_ssh.sh ## REMOTE ACCESS COMMAND FROM DRAGONS @@ -68,11 +69,13 @@ echo "#!/bin/bash" PORT=22000 PORT=$((PORT+${RANDOM:0:3})) -echo "if [[ ! \$(ipfs p2p ls | grep x/ssh-${IPFSNODEID}) ]]; then -ipfs --timeout=5s ping -n 1 /p2p/${IPFSNODEID} -ipfs p2p forward /x/ssh-${IPFSNODEID} /ip4/127.0.0.1/tcp/$PORT /p2p/${IPFSNODEID} -ssh $USER@127.0.0.1 -p $PORT -fi" > ~/.zen/tmp/${IPFSNODEID}/x_ssh.sh +echo "#!/bin/bash +if [[ ! \$(ipfs p2p ls | grep x/ssh-${IPFSNODEID}) ]]; then + ipfs --timeout=10s ping -n 3 /p2p/${IPFSNODEID} + ipfs p2p forward /x/ssh-${IPFSNODEID} /ip4/127.0.0.1/tcp/$PORT /p2p/${IPFSNODEID} +fi +ssh ${USER}@127.0.0.1 -p $PORT +" > ~/.zen/tmp/${IPFSNODEID}/x_ssh.sh cat ~/.zen/tmp/${IPFSNODEID}/x_ssh.sh diff --git a/RUNTIME/G1Voeu.sh b/RUNTIME/G1Voeu.sh index 4b6e85bb..a62d0c68 100755 --- a/RUNTIME/G1Voeu.sh +++ b/RUNTIME/G1Voeu.sh @@ -46,7 +46,7 @@ mkdir -p ~/.zen/tmp/${MOATS} [[ ${PEPPER} ]] && echo "Using PLAYER PEPPER AS WISH SALT" && SECRET1=${PEPPER} ## [[ ! ${SECRET1} ]] && SECRET1=$(${MY_PATH}/../tools/diceware.sh 3 | xargs) - echo "${SECRET1}" + #~ echo "${SECRET1}" echo "## TITRE DU G1VOEU ? CapitalGluedWords please" [[ ! ${TITRE} ]] && read TITRE