keygen single multikey auth

This commit is contained in:
fred 2022-08-18 03:47:49 +02:00
parent b72348dea4
commit 5466336d36
5 changed files with 77 additions and 57 deletions

View File

@ -65,13 +65,17 @@ read pass
echo "********* DECODAGE SecuredSocketLayer *********"
rm -f ~/.zen/tmp/${PLAYER}.dunikey 2>/dev/null
openssl enc -aes-256-cbc -d -in "$HOME/.zen/game/players/.current/enc.secret.dunikey" -out "$HOME/.zen/tmp/${PLAYER}.dunikey" -k $pass 2>&1>/dev/null
[ ! -f $HOME/.zen/tmp/${PLAYER}.dunikey ] && echo "ERROR. MAUVAIS PASS. EXIT" && exit 1
[[ ! $? == 0 ]] && echo "ERROR. MAUVAIS PASS. EXIT" && exit 1
G1PUB=$(cat ~/.zen/tmp/${PLAYER}.dunikey | grep 'pub:' | cut -d ' ' -f 2)
[ ! ${G1PUB} ] && echo "ERROR. MAUVAIS PASS. EXIT" && exit 1
echo "________LOGIN OK____________";
echo $G1PUB
echo
echo "MOA : http://127.0.0.1:8080/ipns/$(cat ~/.zen/game/players/$PLAYER/.ipfsnodeid)"
ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
echo "Votre MOA : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
PS3="$PLAYER choisissez : __ "
choices=("AJOUTER MEDIA" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
@ -83,20 +87,26 @@ select fav in "${choices[@]}"; do
;;
"EXPORTER VISA")
echo "EXPORT. INSEREZ CLEF USB"
echo "EXPORT IDENTITE ASTRONAUTE"
du -h ~/.zen/game/players/.current/
echo "Enter to continue. Ctrl+C to stop"
read
echo "NOT FINISHED TODO... ${MY_PATH}/tools/SAVE.astronaut.sh"
echo "MANUAL BACKUP ZIP ~/.zen/game/players/.$PLAYER/"
break
;;
"SUPPRIMER VISA")
echo "ATTENTION SUPPRESSION DEFINITIVE"
echo "ATTENTION SUPPRESSION DEFINITIVE !!"
echo "Enter to continue. Ctrl+C to stop"
read
ipfs key rm $PLAYER; ipfs key rm $G1PUB;
for voeu in $(ls ~/.zen/game/players/$PLAYER/voeux/); do
ipfs key rm $voeu
[[ $voeu != "" ]] && rm -Rf ~/.zen/game/world/$voeu
done
echo "rm -Rf ~/.zen/game/players/$PLAYER"
~/.zen/astrXbian/zen/jaklis/jaklis.py -k $HOME/.zen/tmp/${PLAYER}.dunikey -n https://data.gchange.fr erase
# ~/.zen/astrXbian/zen/jaklis/jaklis.py -k $HOME/.zen/tmp/${PLAYER}.dunikey -n https://g1.data.e-is.pro erase
rm -Rf ~/.zen/game/players/$PLAYER
break
;;

View File

@ -5,20 +5,19 @@
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
########################################################################
echo "CREATING $PLAYER GCHANGE+ PROFILE"
########################################################################
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/$PLAYER/secret.dunikey -n "https://data.gchange.fr" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/astrXbian/logo.png" --site "https://astroport.com/ipns/$ASTRONAUTENS" #GCHANGE+
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://data.gchange.fr" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/astrXbian/logo.png" --site "http://127.0.0.1:8080/ipns/$ASTRONAUTENS" #GCHANGE+
[[ ! $? == 0 ]] && echo "GCHANGE PROFILE CREATION FAILED" && exit 1
########################################################################
echo "CREATING $PLAYER CESIUM+ PROFILE"
########################################################################
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/$PLAYER/secret.dunikey -n "https://g1.data.e-is.pro" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/astrXbian/logo.png" --site "https://astroport.com/ipns/$ASTRONAUTENS" #CESIUM+
[[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED" && exit 1
#~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://g1.data.e-is.pro" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/astrXbian/logo.png" --site "http://127.0.0.1:8080/ipns/$ASTRONAUTENS" #CESIUM+
#[[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED" && exit 1
########################################################################
########################################################################
@ -30,31 +29,16 @@ if [[ $bootnode != "" ]]; then
ipfsnodeid=${bootnode##*/}
g1node=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $ipfsnodeid)
echo "SENDING STAR TO BOOTSTRAP NODE : $g1node"
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/$PLAYER/secret.dunikey -n "https://data.gchange.fr" stars -p $g1node -n 1
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://data.gchange.fr" stars -p $g1node -n 1
### DELETE
# ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" unstars -p $g1node
fi
done
########################################################################
echo 'Creating "ipfstryme" message'
# echo 'Creating "ipfstryme" message'
########################################################################
~/.zen/astrXbian/zen/tools/add_externIP_to_ipfstryme.sh
# ~/.zen/astrXbian/zen/tools/add_externIP_to_ipfstryme.sh
# [[ $(cat ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr) == "" ]] && echo "IPFS Friendly Swarm Layer rewriting"
[[ $(cat ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr) == "" ]] && echo "Your Swarm Address is unavailable" && exit 0
########################################################################
echo 'Sending \"ipfstryme\" message to BOOTSTRAP nodes' # Add bootstrap in A_boostrap_nodes.txt
########################################################################
for bootnode in $(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#") # remove comments
do
if [[ $bootnode != "" ]]; then
ipfsnodeid=${bootnode##*/}
g1node=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $ipfsnodeid)
echo "SENDING ipfstryme to BOOTSTRAP node : $g1node"
filelines=$(cat ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr | wc -l)
[[ "$filelines" != "0" ]] && ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/game/$PLAYER/secret.dunikey -n "https://data.gchange.fr" send -d $g1node -t "ipfstryme" -f ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
fi
done
## # TODO ADD FRIENDS FROM
exit 0

View File

@ -78,9 +78,8 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
# Create Player "IPNS Key" (key import)
${MY_PATH}/keygen -t ipfs -o ~/.zen/game/players/$PLAYER/secret.player "$SALT" "$PEPPER"
ipfs key import $PLAYER -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/secret.player
ipfs key import $G1PUB -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/secret.player
ASTRONAUTENS=$(ipfs key import $G1PUB -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/secret.player)
ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/G1SSB # Prepare astrXbian sub-datastructure
mkdir -p ~/.zen/game/players/$PLAYER/ipfs_swarm
@ -107,18 +106,16 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
sed -i "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~_PLAYER_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~_G1PUB_~${G1PUB}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
# base58 ssl PASS encoded sec from dunikey (contains public/private key TX tuxmain)
sed -i "s~_QRSEC_~${$PASsec}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~_QRSEC_~${PASsec}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
IPNSK=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
# La Clef IPNS porte comme nom G1PUB.
sed -i "s~_MOAKEY_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${IPNSK}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~_MEDIAKEY_~${PLAYER}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~k2k4r8naeti1ny2hsk3a0ziwz22urwiu633hauluwopf4vwjk4x68qgk~${ASTRONAUTENS}~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html
#echo "## PUBLISHING ${PLAYER} /ipns/$PeerID/"
echo "## PUBLISHING ${PLAYER} /ipns/$ASTRONAUTENS/"
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html | tail -n 1)
echo $IPUSH > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/.moachain # Contains last IPFS backup PLAYER KEY
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/.moats
@ -134,7 +131,6 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
echo "$PLAYER" > ~/.zen/game/players/$PLAYER/.player
echo "$PSEUDO" > ~/.zen/game/players/$PLAYER/.pseudo
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/.g1pub
echo "$IPFSNODEID" > ~/.zen/game/players/$PLAYER/.ipfsnodeid
# astrXbian compatible IPFS sub structure =>$XZUID
cp ~/.zen/game/players/$PLAYER/.player ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/_xbian.zuid
@ -149,15 +145,12 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
rm -f ~/.zen/game/players/.current
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
## CREATE GCHANGE+ PROFILE
${MY_PATH}/Connect_PLAYER_To_Gchange.sh
qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png" "http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
echo; echo "Création de vos QR codes IPNS, clefs de votre réseau IPFS."; sleep 1
echo; echo "Création de votre clef et QR codes de votre réseau Astroport Ŋ1"; sleep 1
[[ $1 != "quiet" ]] && echo; echo "*** Espace Astronaute Activé : ~/.zen/game/players/$PLAYER/"; sleep 1
[[ $1 != "quiet" ]] && echo; echo "*** Votre Journal : $PLAYER"; echo "http://127.0.0.1:8080/ipns/$ASTRONAUTENS"; sleep 2
[[ $1 != "quiet" ]] && echo; echo "*** Votre TW Ŋ7 : $PLAYER"; echo "http://127.0.0.1:8080/ipns/$ASTRONAUTENS"; sleep 2
# PASS CRYPTING KEY
[[ $1 != "quiet" ]] && echo; echo "Sécurisation de vos clefs par chiffrage SSL... "; sleep 1
@ -179,15 +172,16 @@ echo "$PASS" > ~/.zen/game/players/$PLAYER/.pass
rm -f ~/.zen/game/players/.current
ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current
## CREATE GCHANGE+ PROFILE
${MY_PATH}/Connect_PLAYER_To_Gchange.sh
## INIT FRIENDSHIP CAPTAIN/ASTRONAUTS (LATER THROUGH GCHANGE)
## ${MY_PATH}/FRIENDS.init.sh
## NO. GCHANGE+ IS THE MAIN INTERFACE, astrXbian manage
[[ $1 != "quiet" ]] && echo "Bienvenue 'Astronaute' $PSEUDO ($PLAYER)"
[[ $1 != "quiet" ]] && echo "SRetenez votre PASS : $PASS"; sleep 2
[[ $1 != "quiet" ]] && echo "Retenez votre PASS : $PASS"; sleep 2
echo $PSEUDO > ~/.zen/tmp/PSEUDO ## Return data to start.sh
echo "cool $(${MY_PATH}/face.sh cool)"
${MY_PATH}/VISA.print.sh
echo "Relancez start."
exit 0

View File

@ -36,10 +36,10 @@ composite -compose Over -gravity NorthWest -geometry +280+30 /tmp/ASTROPORT.png
composite -compose Over -gravity NorthWest -geometry +0+0 /tmp/QR.png /tmp/astroport.png /tmp/one.png
composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png /tmp/one.png /tmp/image.png
convert -gravity southwest -pointsize 30 -fill black -draw "text 20,20 \"$PLAYER\"" /tmp/image.png /tmp/pseudo.png
convert -gravity southwest -pointsize 40 -fill black -draw "text 20,40 \"$PLAYER\"" /tmp/image.png /tmp/pseudo.png
convert -gravity northwest -pointsize 30 -fill black -draw "text 80,380 \"$PASS\"" /tmp/pseudo.png /tmp/pass.png
convert -gravity northwest -pointsize 20 -fill black -draw "text 300,200 \"$SALT\"" /tmp/pass.png /tmp/salt.png
convert -gravity northwest -pointsize 20 -fill black -draw "text 300,240 \"$PEPPER\"" /tmp/salt.png /tmp/done.jpg
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,200 \"$SALT\"" /tmp/pass.png /tmp/salt.png
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,240 \"$PEPPER\"" /tmp/salt.png /tmp/done.jpg
brother_ql_create --model QL-700 --label-size 62 /tmp/done.jpg > /tmp/toprint.bin 2>/dev/null
sudo brother_ql_print /tmp/toprint.bin $LP

View File

@ -94,11 +94,43 @@ xdg-open "http://127.0.0.1:8080/ipfs/$IPFSROOT"
## AJOUT VIDEO ASTROPORT
MEDIAID="$(date -u +%s%N | cut -b1-13)"
mkdir -p ~/astroport/video/${MEDIAID}/
MEDIAKEY="VIDEO_${MEDIAID}"
cp ~/.zen/tmp/output.mp4 ~/astroport/video/${MEDIAID}/
mkdir -p ~/astroport/video/vlog/
MEDIAKEY="VLOG_${PLAYER}_${MEDIAID}"
cp ~/.zen/tmp/output.mp4 ~/astroport/video/vlog/$PLAYER_$MEDIAID.mp4
~/.zen/astrXbian/zen/new_file_in_astroport.sh "$HOME/astroport/video/${MEDIAID}/" "output.mp4" "$G1PUB"
REAL=$(file --mime-type "$HOME/astroport/video/vlog/$PLAYER_$MEDIAID.mp4" | cut -d ':' -f 2 | cut -d ' ' -f 2)
IPFSID=$(ipfs add -q ~/astroport/video/vlog/$PLAYER_$MEDIAID.mp4)
TEXT="<video controls><source src='/ipfs/"${IPFSID}"' type='"${REAL}"'></video><h1>"${PLAYER}"</h1>"
## TW not displaying direct ipfs
MIME="text/vnd.tiddlywiki"
TAGS="astroport $PLAYER vlog"
echo "## Creation json tiddler"
echo '[
{
"text": "'${TEXT}'",
"title": "'${TITLE}'",
"type": "'${MIME}'",
"mime": "'${REAL}'",
"cat": "'${CAT}'",
"screenshot": "'${SCREENDIR}/screen.png'",
"ipfsroot": "'${IPFSREPFILEID}'",
"file": "'${file}'",
"mediakey": "'${MEDIAKEY}'",
"ipns": "'${IPNS}'",
"tmdb": "'${REFERENCE}'",
"tags": "'${TAGS}'" ' > ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json
[[ ${CANON} != "" ]] && echo ',
"_canonical_uri": "'${CANON}'"' >> ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json
echo '
}
]
' >> ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json
# ~/.zen/astrXbian/zen/new_file_in_astroport.sh "$HOME/astroport/video/${MEDIAID}/" "output.mp4" "$G1PUB"
# https://stackoverflow.com/questions/49846400/raspberry-pi-use-vlc-to-stream-webcam-logitech-c920-h264-video-without-tran
# record to MKV cvlc v4l2:///dev/video0:chroma=h264 :input-slave=alsa://hw:1,0 --sout '#transcode{acodec=mpga,ab=128,channels=2,samplerate=44100,threads=4,audio-sync=1}:standard{access=file,mux=mkv,dst='~/.zen/tmp/Webcam_Record/MyVid.mkv'}'