From 7b667134c6589a5d21fd0cfea3c0110e6f05e01d Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Wed, 25 Dec 2019 13:55:52 +0100 Subject: [PATCH] =?UTF-8?q?Ecrit=20le=20script=20pour=20cr=C3=A9er=20en=20?= =?UTF-8?q?batch=20les=20tunnels=20SSH=20pour=20tous=20les=20NodeMCU=20en?= =?UTF-8?q?=20remotes=20via=20la=20passerelle=20SSH=20reverse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mesures/humidity/bolo/_zremote_cmd.txt | 4 +++ Mesures/humidity/bolo/make_tunnels.sh | 42 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 Mesures/humidity/bolo/make_tunnels.sh diff --git a/Mesures/humidity/bolo/_zremote_cmd.txt b/Mesures/humidity/bolo/_zremote_cmd.txt index 36a6e6d..0b29bc0 100644 --- a/Mesures/humidity/bolo/_zremote_cmd.txt +++ b/Mesures/humidity/bolo/_zremote_cmd.txt @@ -172,6 +172,10 @@ cat("boot2.lua") ./luatool.py --ip $zIP:$zport --delete toto.lua + +**************************************************************************** + + # création des tunnels ssh ATTENTION: dans un premier terminal ! Pour Bolo à Ruchonnet: diff --git a/Mesures/humidity/bolo/make_tunnels.sh b/Mesures/humidity/bolo/make_tunnels.sh new file mode 100755 index 0000000..9de9934 --- /dev/null +++ b/Mesures/humidity/bolo/make_tunnels.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Petit script pour créer tous les tunnels SSH sur les NodeMCU en remote +# zf191225.1352 + +# Définition des variables +TREMPLIN_SSH=www.zuzutest.ml +OPIZ_PORT=20223 + +TH1_IP=192.168.8.100 +TH1_PORT=23001 +TH2_IP=192.168.8.101 +TH2_PORT=23002 +TH3_IP=192.168.8.102 +TH3_PORT=23003 +TH4_IP=192.168.8.103 +TH4_PORT=23004 + + +# On tue tous les tunnels ssh +echo "kill" +killall -9 ssh +sleep 3 + +# On crée le tunnel sur la passerelle ssh 20223 +echo "first" +ssh -y -y -N -T -L $OPIZ_PORT:localhost:$OPIZ_PORT ubuntu@$TREMPLIN_SSH & +sleep 3 + +# On crée tous les tunnels sur les nodemcu +echo "second" +ssh -y -y -N -T -L $TH1_PORT:$TH1_IP:23 ubuntu@localhost -p $OPIZ_PORT & +ssh -y -y -N -T -L $TH2_PORT:$TH2_IP:23 ubuntu@localhost -p $OPIZ_PORT & +ssh -y -y -N -T -L $TH3_PORT:$TH3_IP:23 ubuntu@localhost -p $OPIZ_PORT & +ssh -y -y -N -T -L $TH4_PORT:$TH4_IP:23 ubuntu@localhost -p $OPIZ_PORT & +sleep 3 + +echo "end" +ps ax |grep ssh + +# On liste les fichiers de chaque nodemcu +#echo -e "th1" +#/luatool.py --ip localhost:$TH1_PORT --list