#!/bin/bash # tuer3 passphrase generation script # Copyright (C) 2017-2019 Hackspace Jena e. V. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . QUESTTEXT='Wie ist dein Name/Nick?' HELPTEXT="Nickname" DLG=`which zenity` if [[ $? -ne 0 ]] ; then if [[ "$1" == "" ]] ; then echo "Passphrasengenerierung abgebrochen. Bitte einen Nutzernamen als Kommandoparameter angeben." exit 1 else USER=$1 DIALOG=cmd fi else if [[ "$1" == "" ]] ; then USER=`zenity --entry --text="$QUESTTEXT" --entry-text=$HELPTEXT` else USER=`zenity --entry --text="$QUESTTEXT" --entry-text="$1"` fi if [[ $? -ne 0 || "$USER" == "$HELPTEXT" ]] ; then echo "Passphrasengenerierung abgebrochen." exit 1 fi DIALOG=zenity fi STAMP=`date +%Y-%m-%dT%T` FILE="$PWD/$USER.$STAMP.keyhash" PASSPHRASE=`tr -dc _a-z0-9 >$FILE # Ausgabe TEXT="Hallo $USER,\ndeine neue Passphrase ist:\n\n\t$PASSPHRASE\n Hinweis:\tDie Passphrase erscheint nur in diesem Dialog und im Terminal\n\t\tund wird sonst nirgendwo gespeichert. Sichere sie dir bitte!\n\n Es wurde eine Datei mit deinen Schlüsseldaten generiert. Ihr Name lautet: \n\t$FILE\n\nÜbergib sie bitte vertrauensvoll an einen Schließsystemverantwortlichen.\n" case "$DIALOG" in zenity) zenity --info --text="$TEXT" --window-icon=warning ;; *) ;; esac echo -e "$TEXT"