This commit is contained in:
qo-op 2020-05-10 19:52:16 +02:00
parent 30a34e61c7
commit e14975ae48
3 changed files with 19 additions and 16 deletions

View File

@ -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='<id>\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"
IPFSNODEID=$(ipfs id -f='<id>\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

View File

@ -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

View File

@ -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)