diff options
author | Adam Warner <PromoFaux@users.noreply.github.com> | 2017-05-04 17:12:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-04 17:12:26 +0300 |
commit | 26fcb1b2a012b645991c7ac7c77c6b72036456d7 (patch) | |
tree | 58ead77cd0fed1ab548648476dddda2291d53d1b /advanced/Scripts | |
parent | 1dcc1871fb730d774b44f181c8ec4555341c1bb1 (diff) | |
parent | e9c4e8123cb04fd02cdc0a3d71748327c9de7129 (diff) |
Merge pull request #1429 from pi-hole/developmentv3.0.1
Release v3.0.1
Diffstat (limited to 'advanced/Scripts')
-rwxr-xr-x | advanced/Scripts/piholeDebug.sh | 13 | ||||
-rwxr-xr-x | advanced/Scripts/webpage.sh | 37 |
2 files changed, 37 insertions, 13 deletions
diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 945cd81c..10dd1e8b 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -27,6 +27,7 @@ PIHOLELOG="/var/log/pihole.log" PIHOLEGITDIR="/etc/.pihole/" ADMINGITDIR="/var/www/html/admin/" WHITELISTMATCHES="/tmp/whitelistmatches.list" +readonly FTLLOG="/var/log/pihole-FTL.log" TIMEOUT=60 # Header info and introduction @@ -523,6 +524,18 @@ header_write "Analyzing pihole.log" && log_write "${PIHOLELOG} is ${pihole_size}." \ || log_echo "Warning: No pihole.log file found!" +header_write "Analyzing pihole-FTL.log" + + FTL_length=$(grep -c ^ "${FTLLOG}") \ + && log_write "${FTLLOG} is ${FTL_length} lines long." \ + || log_echo "Warning: No pihole-FTL.log file found!" + + FTL_size=$(du -h "${FTLLOG}" | awk '{ print $1 }') \ + && log_write "${FTLLOG} is ${FTL_size}." \ + || log_echo "Warning: No pihole-FTL.log file found!" + +tail -n50 "${FTLLOG}" >&3 + trap finalWork EXIT ### Method calls for additional logging ### diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 7804fc8f..d3ad3032 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -67,6 +67,13 @@ SetTemperatureUnit(){ } +HashPassword(){ + # Compute password hash twice to avoid rainbow table vulnerability + return=$(echo -n ${1} | sha256sum | sed 's/\s.*$//') + return=$(echo -n ${return} | sha256sum | sed 's/\s.*$//') + echo ${return} +} + SetWebPassword(){ if [ "${SUDO_USER}" == "www-data" ]; then @@ -81,21 +88,25 @@ SetWebPassword(){ exit 1 fi - read -s -p "Enter New Password (Blank for no password): " PASSWORD - echo "" - - if [ "${PASSWORD}" == "" ]; then - change_setting "WEBPASSWORD" "" - echo "Password Removed" - exit 0 - fi + if (( ${#args[2]} > 0 )) ; then + readonly PASSWORD="${args[2]}" + readonly CONFIRM="${PASSWORD}" + else + read -s -p "Enter New Password (Blank for no password): " PASSWORD + echo "" + + if [ "${PASSWORD}" == "" ]; then + change_setting "WEBPASSWORD" "" + echo "Password Removed" + exit 0 + fi + + read -s -p "Confirm Password: " CONFIRM + echo "" + fi - read -s -p "Confirm Password: " CONFIRM - echo "" if [ "${PASSWORD}" == "${CONFIRM}" ] ; then - # Compute password hash twice to avoid rainbow table vulnerability - hash=$(echo -n ${PASSWORD} | sha256sum | sed 's/\s.*$//') - hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//') + hash=$(HashPassword ${PASSWORD}) # Save hash to file change_setting "WEBPASSWORD" "${hash}" echo "New password set" |