add pw length check

This commit is contained in:
jtf 2017-10-19 23:02:13 +02:00
parent 3f3e429610
commit bc078720fe
2 changed files with 4 additions and 3 deletions

View file

@ -18,15 +18,17 @@ getp() {
#exit #exit
secret=$(getp secret) secret=$(getp secret)
secret_length=`echo $secret | wc --chars`
hashed_secret=$(echo "$secret" | sha512sum | cut -f1 -d\ ) hashed_secret=$(echo "$secret" | sha512sum | cut -f1 -d\ )
cmd=$(getp cmd) cmd=$(getp cmd)
# check secret # check secret
# the secrets file has to contain the hashes on a single line, comments are allowed on seperate lines # the secrets file has to contain the hashes on a single line, comments are allowed on seperate lines
# secrets can only contain the characters that are allowed in getp() with tr -dc # secrets can only contain the characters that are allowed in getp() with tr -dc
if [ -z "$secret" ] || ! grep -q ";$hashed_secret$" /etc/tuer3.0/door_access_list; then if [ -z "$secret" ] || [ $secret_length -lt 73 ] || ! grep -q ";$hashed_secret$" /etc/tuer3.0/door_access_list; then
header header
[ -z "$secret" ] || echo "<html><p>Ich bin mir nicht sicher. Mir scheint, du bist doch ein Kohlkopf oder Anderes!</p> $hashed_secret" [ -z "$secret" ] || echo "<html><p>Ich bin mir nicht sicher. Mir scheint, du bist doch ein Kohlkopf oder Anderes!</p>"
# $hashed_secret"
cat /var/www/tpl/secret.html cat /var/www/tpl/secret.html
exit exit
fi fi

View file

@ -1 +0,0 @@
<head><meta http-equiv="Refresh" content="0; /cgi-bin/kraut.space"></head>