#!/bin/bash ################################################################################ # Author: Fred (support@qo-op.com) # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ################################################################################ # Activate SUPPORT MODE: open ssh over IPFS MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ######################################################################## YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || er+=" ipfs daemon not running" IPFSNODEID=$(ipfs id -f='\n') || er+=" ipfs id problem" WHOAMI=$(sbotc whoami | jq -r .id) || er+=" sbotc whoami problem" [[ "$YOU" == "" || "$IPFSNODEID" == "" || "$WHOAMI" == "" ]] && echo "ERROR : $er " && exit 1 ######################################################################## # TODO ESTABLISH A PORT FORWARD STRATEGY (depending on Node Flavour) [[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title) [[ $XZUID ]] && ipfs p2p listen /x/$XZUID-ssh /ip4/127.0.0.1/tcp/22 # or CLOSE ipfs p2p close /x/$UIDNA-ssh