From 6c8dae4c8b24475dc8a10b56e86b625dfde6c03d Mon Sep 17 00:00:00 2001 From: Mysaa Java Date: Tue, 9 Jan 2024 10:51:21 -0500 Subject: [PATCH] Added the script for creating a new user with a QR-code --- getNewUser.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 getNewUser.sh diff --git a/getNewUser.sh b/getNewUser.sh new file mode 100755 index 0000000..8a21841 --- /dev/null +++ b/getNewUser.sh @@ -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"