From 033ba2604131fa33d91a88bb9878f5873369cf89 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 28 Jan 2017 20:00:02 -0500 Subject: [PATCH 1/7] Stay in repo directory until we error check --- advanced/Scripts/update.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index df71e9a9..10afded4 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -105,9 +105,6 @@ GitCheckUpdateAvail() { # defaults to the current one. REMOTE="$(git rev-parse @{upstream})" - # Change back to original directory - cd "${curdir}" - if [[ ${#LOCAL} == 0 ]]; then echo "::: Error: Local revision could not be optained, ask Pi-hole support." echo "::: Additional debugging output:" @@ -120,6 +117,9 @@ GitCheckUpdateAvail() { git status exit fi + + # Change back to original directory + cd "${curdir}" if [[ "${LOCAL}" != "${REMOTE}" ]]; then # Local branch is behind remote branch -> Update From 99a4a8001759da332a81b62810da36ffc4dc43cc Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 17:08:38 -0800 Subject: [PATCH 2/7] Spelling --- advanced/Scripts/update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index 10afded4..32fb712b 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -106,13 +106,13 @@ GitCheckUpdateAvail() { REMOTE="$(git rev-parse @{upstream})" if [[ ${#LOCAL} == 0 ]]; then - echo "::: Error: Local revision could not be optained, ask Pi-hole support." + echo "::: Error: Local revision could not be obtained, ask Pi-hole support." echo "::: Additional debugging output:" git status exit fi if [[ ${#REMOTE} == 0 ]]; then - echo "::: Error: Remote revision could not be optained, ask Pi-hole support." + echo "::: Error: Remote revision could not be obtained, ask Pi-hole support." echo "::: Additional debugging output:" git status exit From a8ac212ee627f0f72aad5e65322541c4b265e5a6 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 29 Jan 2017 13:46:27 +0100 Subject: [PATCH 3/7] Show number of wildcard blocked domains in gravity's summary --- gravity.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gravity.sh b/gravity.sh index b1cd57a6..31bc6bd0 100755 --- a/gravity.sh +++ b/gravity.sh @@ -32,6 +32,7 @@ adListDefault=/etc/pihole/adlists.default whitelistScript="pihole -w" whitelistFile=/etc/pihole/whitelist.txt blacklistFile=/etc/pihole/blacklist.txt +readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf" #Source the setupVars from install script for the IP setupVars=/etc/pihole/setupVars.conf @@ -235,6 +236,21 @@ gravity_Blacklist() { } +gravity_Wildcard() { + # Return number of wildcards in output - don't actually handle wildcards + if [[ -f "${wildcardlist}" ]]; then + num=$(grep -c ^ "${wildcardlist}") + if [[ -n "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]];then + let num/=2 + fi + plural=; [[ "$num" != "1" ]] && plural=s + echo "::: Wildcard blocked domain${plural}: $numBlacklisted" + else + echo "::: No wildcards used!" + fi + +} + gravity_Whitelist() { #${piholeDir}/${eventHorizon}) echo ":::" @@ -401,6 +417,7 @@ else fi gravity_Whitelist gravity_Blacklist +gravity_Wildcard gravity_hostFormat gravity_blackbody From 06873fe69e74e52b8cd723ad718d0ea4e9ac13f1 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 29 Jan 2017 13:54:39 +0100 Subject: [PATCH 4/7] Remove misplaced start of string expression. Fixes #1191 --- advanced/Scripts/list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index c916e021..e8cfdc6b 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -66,7 +66,7 @@ HandleOther(){ domain=$(sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" <<< "$1") #check validity of domain - validDomain=$(echo "${domain}" | perl -lne 'print if /^(?!.*[^a-z0-9-\.].*)\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)*[a-z]{2,63}\b/') + validDomain=$(echo "${domain}" | perl -lne 'print if /(?!.*[^a-z0-9-\.].*)\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)*[a-z]{2,63}\b/') if [ -z "${validDomain}" ]; then echo "::: $1 is not a valid argument or domain name" else From f8944177a046f5aae36e77b44750ef395dffd8d6 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sun, 29 Jan 2017 13:32:48 -0500 Subject: [PATCH 5/7] Fix chronometer interpreting summaryRaw --- advanced/Scripts/chronometer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 93b0cbb1..3dce9c3e 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -22,7 +22,7 @@ function GetJSONValue { retVal=$(echo $1 | sed 's/\\\\\//\//g' | \ sed 's/[{}]//g' | \ awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | \ - sed 's/\"\:\"/\|/g' | \ + sed 's/\"\:/\|/g' | \ sed 's/[\,]/ /g' | \ sed 's/\"//g' | \ grep -w $2) From 8b22f435adff664c1bc7361137a3bf0fe6f0c8bb Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 29 Jan 2017 19:58:53 +0100 Subject: [PATCH 6/7] Change how user and group are stored in the logrotate config file (necessary on Ubuntu 16.04.1) --- advanced/logrotate | 1 + automated install/basic-install.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/advanced/logrotate b/advanced/logrotate index e9be016d..570e7548 100644 --- a/advanced/logrotate +++ b/advanced/logrotate @@ -1,4 +1,5 @@ /var/log/pihole.log { + # su # daily copytruncate rotate 5 diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9fed0bca..94f26be9 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -949,7 +949,7 @@ installLogrotate() { # the local properties of the /var/log directory logusergroup="$(stat -c '%U %G' /var/log)" if [[ ! -z $logusergroup ]]; then - echo "su ${logusergroup}" >> /etc/pihole/logrotate + sed -i "s/# su #/su ${logusergroup}/" /etc/pihole/logrotate fi echo " done!" } From 3d4516dc9550e7721811c447094d3bf1e5f81252 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 29 Jan 2017 20:27:20 +0100 Subject: [PATCH 7/7] Improve regex --- advanced/Scripts/list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index e8cfdc6b..7cbe6beb 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -66,7 +66,7 @@ HandleOther(){ domain=$(sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" <<< "$1") #check validity of domain - validDomain=$(echo "${domain}" | perl -lne 'print if /(?!.*[^a-z0-9-\.].*)\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)*[a-z]{2,63}\b/') + validDomain=$(echo "${domain}" | perl -lne 'print if /(?!.*[^a-z0-9-\.].*)^((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9-]+\.)*[a-z]{2,63}/') if [ -z "${validDomain}" ]; then echo "::: $1 is not a valid argument or domain name" else