From e14975ae48e4f1b91aa28c7b0ab25939c089b2c1 Mon Sep 17 00:00:00 2001 From: qo-op Date: Sun, 10 May 2020 19:52:16 +0200 Subject: [PATCH] --pubsec --- g1sms/cron_IPFS_open_SSH.sh | 24 +++++++++++++----------- g1sms/functions.sh | 4 ++-- g1sms/init_keys.sh | 7 ++++--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/g1sms/cron_IPFS_open_SSH.sh b/g1sms/cron_IPFS_open_SSH.sh index 849e4c4..0e0a422 100755 --- a/g1sms/cron_IPFS_open_SSH.sh +++ b/g1sms/cron_IPFS_open_SSH.sh @@ -7,17 +7,19 @@ # Activate SUPPORT MODE: open ssh over IPFS MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized -if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi -if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi + +exit + +# Arrange local port forwarded to swarm +# GET _uidna YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1) -if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi -if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi -IPFSNODEID=$(su $YOU -c "ipfs id -f='\n'") -cd $GPATH -su $YOU -c "ipfs p2p close --all" -su $YOU -c "ipfs p2p listen /x/ssh /ip4/127.0.0.1/tcp/22" -su $YOU -c "ipfs p2p listen /x/http /ip4/127.0.0.1/tcp/80" -su $YOU -c "ipfs p2p listen /x/https /ip4/127.0.0.1/tcp/443" -su $YOU -c "ipfs p2p ls" \ No newline at end of file +IPFSNODEID=$(ipfs id -f='\n') +UIDNA=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna) + +p2p close --all +ipfs p2p listen /x/ssh /ip4/127.0.0.1/tcp/22 +ipfs p2p listen /x/http /ip4/127.0.0.1/tcp/80 +ipfs p2p listen /x/https /ip4/127.0.0.1/tcp/443 +ipfs p2p ls diff --git a/g1sms/functions.sh b/g1sms/functions.sh index 3420c1c..f66f1d6 100755 --- a/g1sms/functions.sh +++ b/g1sms/functions.sh @@ -309,7 +309,7 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)" # TODO make decypher less stress on filesystem, use /tmp and ramdisk echo "${IPFSPrivKey}" | gpg -d -q --output "$PINFILE" --yes --pinentry-mode loopback --passphrase-fd 0 "$GPGPINFILE" PIN=$(cat "$PINFILE" | xargs) - [[ "$PIN" == "" && -f "$PINFILE.$NODE_UIDNA.crypt" ]] && ./natools.py decrypt -k "$NODE_G1AUTHFILE" -i "$PINFILE.$NODE_UIDNA.crypt" -o "$PINFILE" && PIN=$(cat "$PINFILE"); + [[ "$PIN" == "" && -f "$PINFILE.$NODE_UIDNA.crypt" ]] && ./natools.py decrypt --pubsec -k "$NODE_G1AUTHFILE" -i "$PINFILE.$NODE_UIDNA.crypt" -o "$PINFILE" && PIN=$(cat "$PINFILE"); [[ "$PIN" != "" ]] && echo "" > "$PINFILE" || log "SYSTEM ERROR :: PIN EMPTY !!! GPG???" # HIDE EMAIL FILE @@ -317,7 +317,7 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)" log "__SUB:sms_INIT_ACCOUNT: DECODING EMAIL .gpg... " echo "${IPFSPrivKey}" | gpg -d -q --output "$MAILFILE" --yes --pinentry-mode loopback --passphrase-fd 0 "$GPGMAILFILE" MAIL=$(cat "$MAILFILE"); - [[ $MAIL == "" && -f "$MAILFILE.node.crypt" ]] && ./natools.py decrypt -k "$NODE_G1AUTHFILE" -i "$MAILFILE.node.crypt" -o "$MAILFILE" && MAIL=$(cat "$MAILFILE"); + [[ $MAIL == "" && -f "$MAILFILE.node.crypt" ]] && ./natools.py decrypt --pubsec -k "$NODE_G1AUTHFILE" -i "$MAILFILE.node.crypt" -o "$MAILFILE" && MAIL=$(cat "$MAILFILE"); # EMPTY CLEAR EMAIL FILE [[ $MAIL != "" ]] && echo "" > "$MAILFILE" || log "SYSTEM ERROR :: MAIL EMPTY !!! GPG???" fi diff --git a/g1sms/init_keys.sh b/g1sms/init_keys.sh index a43704b..01fcfbb 100755 --- a/g1sms/init_keys.sh +++ b/g1sms/init_keys.sh @@ -37,7 +37,7 @@ if [[ ! -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then # GIVE NAME TO NODE G1 WALLET: "6789diceware" # And write ~/.zen/g1sms_wallets/.Qm***/G1SSB/(_files) #################################################################### - PRE=${MASTERPHONE:8:4} + PRE=${ADMINPHONE:8:4} ZUID=$($MY_PATH/diceware.sh 1 | xargs) # Check if already existing among all swarm wallets G1SSB or G1SMS while [[ $(grep -Rwl "$PRE$ZUID" ~/.zen/ipfs_swarm/.*/*/_uidna) ]]; do ZUID=$($MY_PATH/diceware.sh 1 | xargs); done @@ -76,12 +76,13 @@ if [[ ! -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then fi +# COHERENCE TEST [[ -f ~/.zen/secret.astroport.key ]] && source ~/.zen/secret.astroport.key || echo "Missing ~/.zen/secret.astroport.key" && exit 1 +[[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]] && NODE_UIDNA=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna)|| echo "Missing _uidna" && exit 1 -NODE_UIDNA=$(cat "~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna") ## INIT NODE G1 PUB & PRIV KEY NODE_G1PUBKEY=$ZENG1 -NODE_G1AUTHFILE="${GPATH}/g1sms.preoni.priv.key" +NODE_G1AUTHFILE="~/.ssb/secret.dunikey" ########################################################## # MEMORIZE NODE NANODATE EXECUTION TIME (for ntpdate regular sync)