gotty
gotty copied to clipboard
Added support for basic authentication with custom script
Added support for basic authentication with custom script.
Generate linux system authentication script from template (see content below):
gotty --sys-auth-tpl > ./auth.sh
chmod +x ./auth.sh
NOTE: this script requires root access (or sudo).
Usage example:
sudo gotty --authenticator ./auth.sh top
Access web page and login with your linux username and password.
Content of ./auth.sh:
#!/bin/bash
# #### REQUEST INFO ####
# echo REQUEST INFO:
# json_pp
username="$1"
password="$2"
salt=$(getent shadow $username | cut -d$ -f3)
epassword=$(getent shadow $username | cut -d: -f2)
match=$(python -c 'import crypt; print crypt.crypt("'"$password"'", "$6$'$salt'")')
if [ "$match" == "$epassword" ]; then
# success
exit 0
fi
# failed
exit 1