1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00
iiab/roles/3-base-server/templates/profile_ssh_warn.sh

21 lines
890 B
Bash
Raw Normal View History

2017-05-27 18:09:50 +00:00
#!/bin/bash
# credit to the folks at raspberry pi foundatioon
check_hash ()
{
if ! id -u iiab-admin > /dev/null 2>&1 ; then return 0 ; fi
2017-05-27 18:09:50 +00:00
if grep -q "^PasswordAuthentication\s*no" /etc/ssh/sshd_config ; then return 0 ; fi
SHADOW="$(sudo -n grep -E '^iiab-admin:' /etc/shadow 2>/dev/null)"
2017-05-27 18:09:50 +00:00
test -n "${SHADOW}" || return 0
if echo $SHADOW | grep -q "iiab-admin:!" ; then return 0 ; fi
2017-05-27 18:09:50 +00:00
SHADOW_PW=$(echo $SHADOW | cut -d: -f2)
2017-07-04 20:09:12 +00:00
if [ "$SHADOW_PW" != "\$6\$xsce51\$D.IrrEeLBYIuJkGDmi27pZUGOwPFp98qpl3hxMwWV4hXigFGmdSvy3s/j7tn6OnyTTLmlV7SsN0lCUAFzxSop." ]; then return 0 ; fi
2017-05-27 18:09:50 +00:00
echo
echo "SSH is enabled and the default password for the 'iiab-admin' user is unchanged."
echo "This is a security risk - please login as the 'iiab-admin' user and type 'passwd' to change password."
2017-05-27 18:09:50 +00:00
echo
}
2017-05-29 16:06:09 +00:00
systemctl is-active {{ sshd_service }} > /dev/null && check_hash
2017-05-27 18:09:50 +00:00
unset check_hash