mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 06:10:20 +00:00
Implement possibility to remove password using "pihole -web -p"
This commit is contained in:
parent
88c161769d
commit
733919be4a
1 changed files with 11 additions and 5 deletions
|
@ -43,11 +43,17 @@ SetWebPassword(){
|
||||||
|
|
||||||
# Remove password from file (create backup setupVars.conf.bak)
|
# Remove password from file (create backup setupVars.conf.bak)
|
||||||
sed -i.bak '/WEBPASSWORD/d' /etc/pihole/setupVars.conf
|
sed -i.bak '/WEBPASSWORD/d' /etc/pihole/setupVars.conf
|
||||||
# Compute password hash twice to avoid rainbow table vulnerability
|
# Set password only if there is one to be set
|
||||||
hash=$(echo -n ${args[2]} | sha256sum | sed 's/\s.*$//')
|
if (( ${#args[2]} > 0 )) ; then
|
||||||
hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//')
|
# Compute password hash twice to avoid rainbow table vulnerability
|
||||||
# Save hash to file
|
hash=$(echo -n ${args[2]} | sha256sum | sed 's/\s.*$//')
|
||||||
echo "WEBPASSWORD=${hash}" >> /etc/pihole/setupVars.conf
|
hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//')
|
||||||
|
# Save hash to file
|
||||||
|
echo "WEBPASSWORD=${hash}" >> /etc/pihole/setupVars.conf
|
||||||
|
echo "New password set"
|
||||||
|
else
|
||||||
|
echo "Password removed"
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue