Added the script for creating a new user with a QR-code

This commit is contained in:
Mysaa Java 2024-01-09 10:51:21 -05:00
parent 3393efd811
commit 6c8dae4c8b

21
getNewUser.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
if [ $# -lt 1 ]
then
read -p "L'utilisateur: " user
else
user=$1
fi
if [ $# -lt 2 ]
then
read -p "Le nom du pc: " pc
else
pc=$2
fi
otpHex=`openssl rand -hex 32`
otpBase32=`oathtool -v $otpHex | grep "Base32" | cut -d " " -f 3`
qrUrl="otpauth://totp/$pc:$user@git.bernard.com.de?digits=6&issuer=Bernard&secret=$otpBase32"
qrencode -t UTF8 $qrUrl
echo "Le code hexadecimal secret est $otpHex"