From 9c8526db49bccbf2fd8443ee7cdda9c91e379f7d Mon Sep 17 00:00:00 2001 From: Loganaden Velvindron Date: Mon, 20 Nov 2017 22:05:41 +0400 Subject: [PATCH 01/38] Add secondary quad9 server --- automated install/basic-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 61d759ff..e90bb396 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -809,6 +809,7 @@ setDNS() { Quad9) echo "Quad9 servers" PIHOLE_DNS_1="9.9.9.9" + PIHOLE_DNS_2="149.112.112.112" ;; Custom) # Until the DNS settings are selected, From 5c2dcb5e74f464e2ef5ec1afd67b569ea180acde Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 21 Dec 2017 16:42:55 +0100 Subject: [PATCH 02/38] Enable dnsmasq's extra logging feature Signed-off-by: DL6ER --- advanced/01-pihole.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/01-pihole.conf b/advanced/01-pihole.conf index f7b78ab0..85d260b2 100644 --- a/advanced/01-pihole.conf +++ b/advanced/01-pihole.conf @@ -39,7 +39,7 @@ interface=@INT@ cache-size=10000 -log-queries +log-queries=extra log-facility=/var/log/pihole.log local-ttl=2 From 8ed75dd176dcbf1e7d1935f7c532172145787bc0 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 23 Dec 2017 00:42:41 +0100 Subject: [PATCH 03/38] Add extra entry to the end of the saved branches and versions such that PHP's explode() subroutine can correctly disentangle the first three entries and does not get confused by the newline character at the end of the FTL version/branch... Signed-off-by: DL6ER --- advanced/Scripts/updatecheck.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/updatecheck.sh b/advanced/Scripts/updatecheck.sh index 04f210a2..07e8178f 100755 --- a/advanced/Scripts/updatecheck.sh +++ b/advanced/Scripts/updatecheck.sh @@ -47,7 +47,7 @@ if [[ "$2" == "remote" ]]; then GITHUB_WEB_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null)")" GITHUB_FTL_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/FTL/releases/latest' 2> /dev/null)")" - echo "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION}" > "/etc/pihole/GitHubVersions" + echo "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION} X" > "/etc/pihole/GitHubVersions" else @@ -55,12 +55,12 @@ else WEB_BRANCH="$(get_local_branch /var/www/html/admin)" FTL_BRANCH="$(pihole-FTL branch)" - echo "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH}" > "/etc/pihole/localbranches" + echo "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH} X" > "/etc/pihole/localbranches" CORE_VERSION="$(get_local_version /etc/.pihole)" WEB_VERSION="$(get_local_version /var/www/html/admin)" FTL_VERSION="$(pihole-FTL version)" - echo "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION}" > "/etc/pihole/localversions" + echo "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION} X" > "/etc/pihole/localversions" fi From d15a5ad5c16892c662c019b79612f13a9d0b79b6 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 23 Dec 2017 00:46:51 +0100 Subject: [PATCH 04/38] Add required documentation in the source code Signed-off-by: DL6ER --- advanced/Scripts/updatecheck.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/advanced/Scripts/updatecheck.sh b/advanced/Scripts/updatecheck.sh index 07e8178f..851cd0ce 100755 --- a/advanced/Scripts/updatecheck.sh +++ b/advanced/Scripts/updatecheck.sh @@ -47,6 +47,7 @@ if [[ "$2" == "remote" ]]; then GITHUB_WEB_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null)")" GITHUB_FTL_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/FTL/releases/latest' 2> /dev/null)")" + # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 echo "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION} X" > "/etc/pihole/GitHubVersions" else @@ -55,12 +56,14 @@ else WEB_BRANCH="$(get_local_branch /var/www/html/admin)" FTL_BRANCH="$(pihole-FTL branch)" + # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 echo "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH} X" > "/etc/pihole/localbranches" CORE_VERSION="$(get_local_version /etc/.pihole)" WEB_VERSION="$(get_local_version /var/www/html/admin)" FTL_VERSION="$(pihole-FTL version)" + # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 echo "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION} X" > "/etc/pihole/localversions" fi From cca841292185a742c6913ae2f9dda8981c223caf Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 23 Dec 2017 11:52:27 +0100 Subject: [PATCH 05/38] Use "echo -n" to avoid haveing newlines in the files Signed-off-by: DL6ER --- advanced/Scripts/updatecheck.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/updatecheck.sh b/advanced/Scripts/updatecheck.sh index 851cd0ce..16938a3a 100755 --- a/advanced/Scripts/updatecheck.sh +++ b/advanced/Scripts/updatecheck.sh @@ -47,8 +47,7 @@ if [[ "$2" == "remote" ]]; then GITHUB_WEB_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null)")" GITHUB_FTL_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/FTL/releases/latest' 2> /dev/null)")" - # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 - echo "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION} X" > "/etc/pihole/GitHubVersions" + echo -n "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION}" > "/etc/pihole/GitHubVersions" else @@ -56,14 +55,12 @@ else WEB_BRANCH="$(get_local_branch /var/www/html/admin)" FTL_BRANCH="$(pihole-FTL branch)" - # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 - echo "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH} X" > "/etc/pihole/localbranches" + echo -n "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH}" > "/etc/pihole/localbranches" CORE_VERSION="$(get_local_version /etc/.pihole)" WEB_VERSION="$(get_local_version /var/www/html/admin)" FTL_VERSION="$(pihole-FTL version)" - # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 - echo "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION} X" > "/etc/pihole/localversions" + echo -n "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION}" > "/etc/pihole/localversions" fi From b80edfb9968266b9754c9a9709ad5a159c6fc117 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 23 Dec 2017 17:48:15 -0800 Subject: [PATCH 06/38] Add more informative link for Git Signoff Signed-off-by: Dan Schaper --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 96ce4ba5..7a59c163 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -10,7 +10,7 @@ - [] I give this submission freely and claim no ownership. - [] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1) - [] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)) -- [] I have Signed Off all commits. ([`git commit --signoff`](https://git-scm.com/docs/git-commit#git-commit---signoff)) +- [] I have Signed Off all commits. ([`git commit --signoff`](https://github.com/pi-hole/pi-hole/wiki/How-to-signoff-your-commits.)) --- From 95e5baa967baeef799f4cba5163ca93ef32e8bd8 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 24 Dec 2017 13:09:45 +0000 Subject: [PATCH 07/38] Source setup vars before we attempt to do anything on an update/repair Signed-off-by: Adam Warner --- automated install/basic-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 832fd77b..1cb690d5 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -2032,12 +2032,12 @@ main() { # Install and log everything to a file installPihole | tee ${tmpLog} else + # Source ${setupVars} to use predefined user variables in the functions + source ${setupVars} + # Clone/Update the repos clone_or_update_repos - # Source ${setupVars} for use in the rest of the functions - source ${setupVars} - # Install packages used by the Pi-hole if [[ "${INSTALL_WEB}" == true ]]; then # Install the Web dependencies From 8e0d76b63bd8e7de6af862ced3fc62e655387c72 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 24 Dec 2017 13:26:32 +0000 Subject: [PATCH 08/38] initiated -> initialized Signed-off-by: Adam Warner --- advanced/Scripts/piholeDebug.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 64334241..212ec15b 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -215,14 +215,14 @@ copy_to_debug_log() { sed 's/\[[0-9;]\{1,5\}m//g' > "${PIHOLE_DEBUG_LOG_SANITIZED}" <<< cat "${PIHOLE_DEBUG_LOG}" } -initiate_debug() { +initialize_debug() { # Clear the screen so the debug log is readable clear show_disclaimer # Display that the debug process is beginning log_write "${COL_PURPLE}*** [ INITIALIZING ]${COL_NC}" # Timestamp the start of the log - log_write "${INFO} $(date "+%Y-%m-%d:%H:%M:%S") debug log has been initiated." + log_write "${INFO} $(date "+%Y-%m-%d:%H:%M:%S") debug log has been initialized." } # This is a function for visually displaying the curent test that is being run. @@ -1149,7 +1149,7 @@ upload_to_tricorder() { # Run through all the functions we made make_temporary_log -initiate_debug +initialize_debug # setupVars.conf needs to be sourced before the networking so the values are # available to the other functions source_setup_variables From 677033afcae14738116f1080a4dc08031b72eb62 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 28 Dec 2017 18:41:22 +0100 Subject: [PATCH 09/38] Force update of "remote" part in th update checker (may take up to 24hrs for new installs otherwise) Signed-off-by: DL6ER --- automated install/basic-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 1cb690d5..6bd188b5 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -2101,6 +2101,7 @@ main() { # Force an update of the updatechecker . /opt/pihole/updatecheck.sh + . /opt/pihole/updatecheck.sh x remote # if [[ "${useUpdateVars}" == false ]]; then From afa2e9c2f7f030e3f2a7c1374fc0e50048281b3b Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 30 Dec 2017 17:44:59 +0100 Subject: [PATCH 10/38] Exchange hard-coded domain "localhost" by hard-coded address "127.0.0.1" Signed-off-by: DL6ER --- advanced/Scripts/chronometer.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 8599e995..13d743a8 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -15,7 +15,7 @@ pihole-FTL() { ftl_port=$(cat /var/run/pihole-FTL.port 2> /dev/null) if [[ -n "$ftl_port" ]]; then # Open connection to FTL - exec 3<>"/dev/tcp/localhost/$ftl_port" + exec 3<>"/dev/tcp/127.0.0.1/$ftl_port" # Test if connection is open if { "true" >&3; } 2> /dev/null; then @@ -122,13 +122,13 @@ get_init_stats() { } # Convert seconds to human-readable format - hrSecs() { + hrSecs() { day=$(( $1/60/60/24 )); hrs=$(( $1/3600%24 )) mins=$(( ($1%3600)/60 )); secs=$(( $1%60 )) [[ "$day" -ge "2" ]] && plu="s" [[ "$day" -ge "1" ]] && days="$day day${plu}, " || days="" printf "%s%02d:%02d:%02d\\n" "$days" "$hrs" "$mins" "$secs" - } + } # Set Colour Codes coltable="/opt/pihole/COL_TABLE" @@ -199,7 +199,7 @@ get_init_stats() { # Test existence of temperature file if [[ -f "/sys/class/thermal/thermal_zone0/temp" ]]; then temp_file="/sys/class/thermal/thermal_zone0/temp" - elif [[ -f "/sys/class/hwmon/hwmon0/temp1_input" ]]; then + elif [[ -f "/sys/class/hwmon/hwmon0/temp1_input" ]]; then temp_file="/sys/class/hwmon/hwmon0/temp1_input" else temp_file="" @@ -531,7 +531,7 @@ chronoFunc() { sleep 5 fi fi - + done } From 01625dfd49f00aab528a50d0e89eab064f4a5c39 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 30 Dec 2017 10:33:41 -0800 Subject: [PATCH 11/38] JetBrains new codestyle storage location --- .idea/codeStyles/Project.xml | 13 +++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 +++++ 2 files changed, 18 insertions(+) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..7704aeaa --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..79ee123c --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file From 494340fe679190dec3ca13774bc0e7a5b0f02b98 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 30 Dec 2017 10:37:17 -0800 Subject: [PATCH 12/38] Add other JetBrains stuff to ignore --- .gitignore | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/.gitignore b/.gitignore index 0e0d4b99..c7cbbc6f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,69 @@ *.swp __pycache__ .cache + +# Created by https://www.gitignore.io/api/jetbrains+iml + +### JetBrains+iml ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Ruby plugin and RubyMine +/.rakeTasks + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +### JetBrains+iml Patch ### +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# End of https://www.gitignore.io/api/jetbrains+iml From 81e8ef5c400193165ff04f2b7fa827bf1bda9158 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 30 Dec 2017 12:23:46 -0800 Subject: [PATCH 13/38] Just ignore the whole .idea directory, execpt for the codeStyles and the legacy codeStyelSettings.xml. Signed-off-by: Dan Schaper --- .gitignore | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index c7cbbc6f..73f14ae3 100644 --- a/.gitignore +++ b/.gitignore @@ -10,10 +10,11 @@ __pycache__ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 -# User-specific stuff: -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/dictionaries +# All idea files, with execptions +.idea +!.idea/codeStyles/* +!.idea/codeStyleSettings.xml + # Sensitive or high-churn files: .idea/**/dataSources/ @@ -64,7 +65,6 @@ fabric.properties # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 *.iml -modules.xml .idea/misc.xml *.ipr From 4efb533d2eea6ea2b40729a6c4d59be411b1dc9e Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 1 Jan 2018 11:26:03 +0100 Subject: [PATCH 14/38] Create directories /etc/{var,log}/pihole on startup of pihole-FTL and set proper ownership Signed-off-by: DL6ER --- advanced/pihole-FTL.service | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/advanced/pihole-FTL.service b/advanced/pihole-FTL.service index b7def22c..959b7794 100644 --- a/advanced/pihole-FTL.service +++ b/advanced/pihole-FTL.service @@ -26,6 +26,10 @@ start() { echo "pihole-FTL is already running" else touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log + mkdir -p /var/run/pihole + mkdir -p /var/log/pihole + chown pihole:pihole /var/run/pihole /var/log/pihole + rm /var/run/pihole/FTL.sock chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER" From 62a6a878d4c964993c4914ec331f4d861ca50eb4 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 3 Jan 2018 16:20:57 -0800 Subject: [PATCH 15/38] Link to DCO wiki entry. Signed-off-by: Dan Schaper --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8cb7ccb9..2b7fae5d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,6 +28,7 @@ When requesting or submitting new features, first consider whether it might be u - Check the codebase to ensure that your feature doesn't already exist. - Check the pull requests to ensure that another person hasn't already submitted the feature or fix. +- Read and understand the [DCO guidelines](https://github.com/pi-hole/pi-hole/wiki/Contributing-to-the-project) for the project. ## Technical Requirements From db62afbb6497b29633cd62e388b95d8dcc1f5396 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 6 Jan 2018 07:28:26 -0800 Subject: [PATCH 16/38] Update PULL_REQUEST_TEMPLATE.md Signed-off-by: Dan Schaper --- .github/PULL_REQUEST_TEMPLATE.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7a59c163..2620d7ec 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,5 @@ -**By submitting this pull request, I confirm the following:** `{please fill any appropriate checkboxes, e.g: [X]}` - -`{Please ensure that your pull request is for the 'development' branch!}` +**By submitting this pull request, I confirm the following:** +`{please fill any appropriate checkboxes, e.g: [X]}` - [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template. - [] I have made only one major change in my proposed changes. @@ -10,7 +9,8 @@ - [] I give this submission freely and claim no ownership. - [] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1) - [] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)) -- [] I have Signed Off all commits. ([`git commit --signoff`](https://github.com/pi-hole/pi-hole/wiki/How-to-signoff-your-commits.)) + +Please make sure you [Sign Off](https://github.com/pi-hole/pi-hole/wiki/How-to-signoff-your-commits.) all commits. Pi-hole enforces the [DCO](https://github.com/pi-hole/pi-hole/wiki/Contributing-to-the-project) --- @@ -27,6 +27,7 @@ `{A detailed list of any necessary changes}` > * `{Please delete this quoted section when opening your pull request}` -> * You must follow the template instructions. Failure to do so will result in your issue being closed. -> * Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time. -> * Detail helps us understand an issue quicker, but please ensure it's relevant. + +* You must follow the template instructions. Failure to do so will result in your issue being closed. +* Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time. +* Detail helps us understand an issue quicker, but please ensure it's relevant. From 9d50f52bb24213f603d822cd130d622bc335487c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 7 Jan 2018 14:34:02 +0100 Subject: [PATCH 17/38] Add fallback interface for DNS listening behavior in case PIHOLE_INTERFACE is not set in setupVars.conf Signed-off-by: DL6ER --- advanced/Scripts/webpage.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index c5081fd5..3bfdcf0b 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -175,7 +175,13 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 add_dnsmasq_setting "local-service" else # Listen only on one interface - add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}" + interface=$(grep 'PIHOLE_INTERFACE=' /etc/pihole/setupVars.conf | sed "s/.*=//") + # Use eth0 as fallback interface if interface is missing in setupVars.conf + if [ -z "${interface}" ]; then + interface="eth0" + fi + + add_dnsmasq_setting "interface" "${interface}" fi } From 793bdd9743c76d7015e06e2bb0176b5ad163dded Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 7 Jan 2018 14:36:03 +0100 Subject: [PATCH 18/38] No need for cat | sed here as we source setupVars.conf, so we can use interface="${PIHOLE_INTERFACE}" Signed-off-by: DL6ER --- advanced/Scripts/webpage.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 3bfdcf0b..588a88ae 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -175,13 +175,12 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 add_dnsmasq_setting "local-service" else # Listen only on one interface - interface=$(grep 'PIHOLE_INTERFACE=' /etc/pihole/setupVars.conf | sed "s/.*=//") # Use eth0 as fallback interface if interface is missing in setupVars.conf - if [ -z "${interface}" ]; then - interface="eth0" + if [ -z "${PIHOLE_INTERFACE}" ]; then + PIHOLE_INTERFACE="eth0" fi - add_dnsmasq_setting "interface" "${interface}" + add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}" fi } @@ -247,7 +246,7 @@ ProcessDHCPSettings() { source "${setupVars}" if [[ "${DHCP_ACTIVE}" == "true" ]]; then - interface=$(grep 'PIHOLE_INTERFACE=' /etc/pihole/setupVars.conf | sed "s/.*=//") + interface="${PIHOLE_INTERFACE}" # Use eth0 as fallback interface if [ -z ${interface} ]; then From 8b80aaebf55b232a8f424ca5844c500bef67efbc Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 7 Jan 2018 22:54:53 +0100 Subject: [PATCH 19/38] Update README.md Adding DNS-Swapper Project back after it was accidently removed --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6d15f43..59dbefc2 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ While quite outdated at this point, [this original blog post about Pi-hole](http - [Pi-hole metrics](https://github.com/nlamirault/pihole_exporter) exporter for [Prometheus](https://prometheus.io/) - [Magic Mirror with DNS Filtering](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware) - [Pi-hole Droid: Android client](https://github.com/friimaind/pi-hole-droid) - +- [Windows DNS Swapper](https://github.com/roots84/DNS-Swapper), see [#1400](https://github.com/pi-hole/pi-hole/issues/1400) ----- ## Coverage From cc47bf8f6cb9b23a01b62359d78fd796b122705d Mon Sep 17 00:00:00 2001 From: bcambl Date: Sun, 7 Jan 2018 22:21:04 -0600 Subject: [PATCH 20/38] Fix epel-release install for CentOS Signed-off-by: bcambl --- automated install/basic-install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d22775c4..7ab01ea3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -210,7 +210,8 @@ elif command -v rpm &> /dev/null; then INSTALLER_DEPS=(dialog git iproute net-tools newt procps-ng) PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils nmap-ncat sudo unzip wget libidn2 psmisc) PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php php-common php-cli php-pdo) - if ! grep -q 'Fedora' /etc/redhat-release; then + # EPEL (https://fedoraproject.org/wiki/EPEL) is required for lighttpd on CentOS + if grep -qi 'centos' /etc/redhat-release; then INSTALLER_DEPS=("${INSTALLER_DEPS[@]}" "epel-release"); fi LIGHTTPD_USER="lighttpd" From 939806f021c323c408166de1e7194413e3caa2eb Mon Sep 17 00:00:00 2001 From: Vasilis Gerakaris Date: Fri, 12 Jan 2018 02:17:31 +0200 Subject: [PATCH 21/38] piholeDebug.sh: Correct typo mistake Signed-off-by: Vasilis Gerakaris **By submitting this pull request, I confirm the following:** `{please fill any appropriate checkboxes, e.g: [X]}` - [x] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template. - [x] I have made only one major change in my proposed changes. - [] I have commented my proposed changes within the code. - [] I have tested my proposed changes, and have included unit tests where possible. - [] I am willing to help maintain this change if there are issues with it later. - [x] I give this submission freely and claim no ownership. - [x] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1) - [x] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)) --- advanced/Scripts/piholeDebug.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 212ec15b..b668af94 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -547,7 +547,7 @@ detect_ip_addresses() { log_write "" else # If there are no IPs detected, explain that the protocol is not configured - log_write "${CROSS} ${COL_RED}No IPv${protocol} address(es) found on the ${PIHOLE_INTERFACE}${COL_NC} interace.\n" + log_write "${CROSS} ${COL_RED}No IPv${protocol} address(es) found on the ${PIHOLE_INTERFACE}${COL_NC} interface.\n" return 1 fi # If the protocol is v6 From 80307a3bcdb42952a86484c4ca265b6d9a76440f Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 12 Jan 2018 15:43:15 +0000 Subject: [PATCH 22/38] Remove update line from cron Signed-off-by: Adam Warner --- advanced/pihole.cron | 3 --- 1 file changed, 3 deletions(-) diff --git a/advanced/pihole.cron b/advanced/pihole.cron index 64837197..02a63b74 100644 --- a/advanced/pihole.cron +++ b/advanced/pihole.cron @@ -18,9 +18,6 @@ # early morning. Download any updates from the adlists 59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity -# Pi-hole: Update Pi-hole! Uncomment to enable auto update -#30 2 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updatePihole - # Pi-hole: Flush the log daily at 00:00 # The flush script will use logrotate if available # parameter "once": logrotate only once (default is twice) From ebff9654146c67d6837b0471d76e8c66918605a3 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 7 Jan 2018 22:54:53 +0100 Subject: [PATCH 23/38] Update README.md Adding DNS-Swapper Project back after it was accidently removed Signed-off-by: roots84 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6d15f43..59dbefc2 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ While quite outdated at this point, [this original blog post about Pi-hole](http - [Pi-hole metrics](https://github.com/nlamirault/pihole_exporter) exporter for [Prometheus](https://prometheus.io/) - [Magic Mirror with DNS Filtering](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware) - [Pi-hole Droid: Android client](https://github.com/friimaind/pi-hole-droid) - +- [Windows DNS Swapper](https://github.com/roots84/DNS-Swapper), see [#1400](https://github.com/pi-hole/pi-hole/issues/1400) ----- ## Coverage From 876170767c72d3db9b319214593d0a8921773a78 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sat, 13 Jan 2018 16:43:20 +0000 Subject: [PATCH 24/38] Print actual domain instead of grep output of "Binary file /etc/pihole/list.preEventHorizon matches" when a domain with a unicode char is in a source list. Signed-off-by: Adam Warner --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 40debd61..536cad27 100755 --- a/gravity.sh +++ b/gravity.sh @@ -449,7 +449,7 @@ gravity_Whitelist() { echo -ne " ${INFO} ${str}..." # Print everything from preEventHorizon into whitelistMatter EXCEPT domains in $whitelistFile - grep -F -x -v -f "${whitelistFile}" "${piholeDir}/${preEventHorizon}" > "${piholeDir}/${whitelistMatter}" + comm -23 "${piholeDir}/${preEventHorizon}" <(sort "${whitelistFile}") > "${piholeDir}/${whitelistMatter}" echo -e "${OVER} ${INFO} ${str}" } From f1956119fb9ba899cab7c4829ef223b8f9cf4693 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 14 Jan 2018 20:38:39 +0000 Subject: [PATCH 25/38] proposed gravity function renames Signed-off-by: Adam Warner --- gravity.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/gravity.sh b/gravity.sh index 40debd61..af0e2278 100755 --- a/gravity.sh +++ b/gravity.sh @@ -68,7 +68,7 @@ if [[ -r "${piholeDir}/pihole.conf" ]]; then fi # Determine if DNS resolution is available before proceeding -gravity_DNSLookup() { +gravity_CheckDNSResolutionAvailable() { local lookupDomain="pi.hole" # Determine if $localList does not exist @@ -120,11 +120,11 @@ gravity_DNSLookup() { done # Try again - gravity_DNSLookup + gravity_CheckDNSResolutionAvailable } # Retrieve blocklist URLs and parse domains from adlists.list -gravity_Collapse() { +gravity_GetBlocklistUrls() { echo -e " ${INFO} ${COL_BOLD}Neutrino emissions detected${COL_NC}..." # Determine if adlists file needs handling @@ -165,7 +165,7 @@ gravity_Collapse() { } # Define options for when retrieving blocklists -gravity_Supernova() { +gravity_SetDownloadOptions() { local url domain agent cmd_ext str echo "" @@ -190,7 +190,7 @@ gravity_Supernova() { if [[ "${skipDownload}" == false ]]; then echo -e " ${INFO} Target: ${domain} (${url##*/})" - gravity_Pull "${url}" "${cmd_ext}" "${agent}" + gravity_DownloadBlocklistFromUrl "${url}" "${cmd_ext}" "${agent}" echo "" fi done @@ -198,7 +198,7 @@ gravity_Supernova() { } # Download specified URL and perform checks on HTTP status and file content -gravity_Pull() { +gravity_DownloadBlocklistFromUrl() { local url="${1}" cmd_ext="${2}" agent="${3}" heisenbergCompensator="" patternBuffer str httpCode success="" # Create temp file to store content on disk instead of RAM @@ -365,7 +365,7 @@ gravity_ParseFileIntoDomains() { } # Create (unfiltered) "Matter and Light" consolidated list -gravity_Schwarzschild() { +gravity_ConsolidateDownloadedBlocklists() { local str lastLine str="Consolidating blocklists" @@ -393,7 +393,7 @@ gravity_Schwarzschild() { } # Parse consolidated list into (filtered, unique) domains-only format -gravity_Filter() { +gravity_SortAndFilterConsolidatedList() { local str num str="Extracting domains from blocklists" @@ -418,7 +418,7 @@ gravity_Filter() { } # Whitelist unique blocklist domain sources -gravity_WhitelistBLD() { +gravity_WhitelistBlocklistSourceUrls() { local uniqDomains str echo "" @@ -563,7 +563,7 @@ gravity_Cleanup() { rm ${piholeDir}/*.tmp 2> /dev/null rm /tmp/*.phgpb 2> /dev/null - # Ensure this function only runs when gravity_Supernova() has completed + # Ensure this function only runs when gravity_SetDownloadOptions() has completed if [[ "${gravity_Blackbody:-}" == true ]]; then # Remove any unused .domains files for file in ${piholeDir}/*.${domainsExtension}; do @@ -625,12 +625,12 @@ fi # Determine which functions to run if [[ "${skipDownload}" == false ]]; then # Gravity needs to download blocklists - gravity_DNSLookup - gravity_Collapse - gravity_Supernova - gravity_Schwarzschild - gravity_Filter - gravity_WhitelistBLD + gravity_CheckDNSResolutionAvailable + gravity_GetBlocklistUrls + gravity_SetDownloadOptions + gravity_ConsolidateDownloadedBlocklists + gravity_SortAndFilterConsolidatedList + gravity_WhitelistBlocklistSourceUrls else # Gravity needs to modify Blacklist/Whitelist/Wildcards echo -e " ${INFO} Using cached Event Horizon list..." From 094bd49f3593982356c936a7d9fee8f0344739fe Mon Sep 17 00:00:00 2001 From: Deathbybandaid Date: Sun, 14 Jan 2018 20:29:20 -0500 Subject: [PATCH 26/38] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 59dbefc2..b7f4f249 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ While quite outdated at this point, [this original blog post about Pi-hole](http - [CHiP-hole: Network-wide Ad-blocker](https://www.hackster.io/jacobsalmela/chip-hole-network-wide-ad-blocker-98e037) - [Chrome Extension: Pi-Hole List Editor](https://chrome.google.com/webstore/detail/pi-hole-list-editor/hlnoeoejkllgkjbnnnhfolapllcnaglh) ([Source Code](https://github.com/packtloss/pihole-extension)) - [Splunk: Pi-hole Visualiser](https://splunkbase.splunk.com/app/3023/) -- [Adblocking with P-hole and Ubuntu 14.04 on VirtualBox](https://hbalagtas.blogspot.com.au/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html) +- [Adblocking with Pi-hole and Ubuntu 14.04 on VirtualBox](https://hbalagtas.blogspot.com.au/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html) - [Pi-hole stats in your Mac's menu bar](https://getbitbar.com/plugins/Network/pi-hole.1m.py) - [Pi-hole unRAID Template](https://forums.lime-technology.com/topic/36810-support-spants-nodered-mqtt-dashing-couchdb/) - [Copernicus: Windows Tray Application](https://github.com/goldbattle/copernicus) From b75dd5ff73e7a7898753d2cb851f42379a30b9f1 Mon Sep 17 00:00:00 2001 From: Deathbybandaid Date: Mon, 15 Jan 2018 08:04:27 -0500 Subject: [PATCH 27/38] needed sign-off Signed-off-by: --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b7f4f249..a4d7a682 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ If you are going to be presenting Pi-hole at a conference, meetup or even a scho ----- + ## Getting in touch with us While we are primarily reachable on our Discourse User Forum, we can also be found on a variety of social media outlets. **Please be sure to check the FAQ's** before starting a new discussion, as we do not have the spare time to reply to every request for assistance. From 657bc4edcd1178cfd578f1082d382f6fa414afbe Mon Sep 17 00:00:00 2001 From: Deathbybandaid Date: Mon, 15 Jan 2018 08:05:43 -0500 Subject: [PATCH 28/38] Update README.md Signed-off-by: deathbybandaid --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index a4d7a682..b7f4f249 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,6 @@ If you are going to be presenting Pi-hole at a conference, meetup or even a scho ----- - ## Getting in touch with us While we are primarily reachable on our Discourse User Forum, we can also be found on a variety of social media outlets. **Please be sure to check the FAQ's** before starting a new discussion, as we do not have the spare time to reply to every request for assistance. From 52cc8e2fcf556a8f7612b28450e60ff72606c7b5 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 16 Jan 2018 22:10:27 +0100 Subject: [PATCH 29/38] Use "lan" as fallback TLD for DHCP generated domains Signed-off-by: DL6ER --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 588a88ae..27b3de5d 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -254,7 +254,7 @@ ProcessDHCPSettings() { fi if [[ "${PIHOLE_DOMAIN}" == "" ]]; then - PIHOLE_DOMAIN="local" + PIHOLE_DOMAIN="lan" change_setting "PIHOLE_DOMAIN" "${PIHOLE_DOMAIN}" fi From 448495a4a3170513b97b333ea48bf1e279490fda Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Tue, 16 Jan 2018 14:56:15 -0800 Subject: [PATCH 30/38] Remove references to issues. Modify code blocks to italics and reformat the layout. Signed-off-by: Dan Schaper --- .github/PULL_REQUEST_TEMPLATE.md | 34 +++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 2620d7ec..41564b65 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,33 +1,31 @@ **By submitting this pull request, I confirm the following:** -`{please fill any appropriate checkboxes, e.g: [X]}` +*please fill any appropriate checkboxes, e.g: [X]* -- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template. -- [] I have made only one major change in my proposed changes. -- [] I have commented my proposed changes within the code. -- [] I have tested my proposed changes, and have included unit tests where possible. -- [] I am willing to help maintain this change if there are issues with it later. -- [] I give this submission freely and claim no ownership. -- [] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1) -- [] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)) +- [ ] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template. +- [ ] I have made only one major change in my proposed changes. +- [ ] I have commented my proposed changes within the code. +- [ ] I have tested my proposed changes, and have included unit tests where possible. +- [ ] I am willing to help maintain this change if there are issues with it later. +- [ ] I give this submission freely and claim no ownership. +- [ ] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1) +- [ ] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)) -Please make sure you [Sign Off](https://github.com/pi-hole/pi-hole/wiki/How-to-signoff-your-commits.) all commits. Pi-hole enforces the [DCO](https://github.com/pi-hole/pi-hole/wiki/Contributing-to-the-project) +Please make sure you [Sign Off](https://github.com/pi-hole/pi-hole/wiki/How-to-signoff-your-commits.) all commits. Pi-hole enforces the [DCO](https://github.com/pi-hole/pi-hole/wiki/Contributing-to-the-project). --- - **What does this PR aim to accomplish?:** +*A detailed description, screenshots (if necessary), as well as links to any relevant GitHub issues* -`{A detailed description, screenshots (if necessary), as well as links to any relevant GitHub issues}` **How does this PR accomplish the above?:** +*A detailed description (such as a changelog) and screenshots (if necessary) of the implemented fix* -`{A detailed description (such as a changelog) and screenshots (if necessary) of the implemented fix}` **What documentation changes (if any) are needed to support this PR?:** +*A detailed list of any necessary changes* -`{A detailed list of any necessary changes}` -> * `{Please delete this quoted section when opening your pull request}` - -* You must follow the template instructions. Failure to do so will result in your issue being closed. +--- +* You must follow the template instructions. Failure to do so will result in your pull request being closed. * Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time. -* Detail helps us understand an issue quicker, but please ensure it's relevant. + From d7dde06552785bca11702290706fea147121c1ec Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 18 Jan 2018 17:08:46 +0100 Subject: [PATCH 31/38] Add "pihole logging off noflush" command Signed-off-by: DL6ER --- pihole | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pihole b/pihole index e4d6215c..4421cb87 100755 --- a/pihole +++ b/pihole @@ -444,13 +444,17 @@ Specify whether the Pi-hole log should be used Options: on Enable the Pi-hole log at /var/log/pihole.log - off Disable the Pi-hole log at /var/log/pihole.log" + off Disable and flush the Pi-hole log at /var/log/pihole.log + off noflush Disable the Pi-hole log at /var/log/pihole.log" exit 0 elif [[ "${1}" == "off" ]]; then # Disable logging sed -i 's/^log-queries/#log-queries/' /etc/dnsmasq.d/01-pihole.conf sed -i 's/^QUERY_LOGGING=true/QUERY_LOGGING=false/' /etc/pihole/setupVars.conf - pihole -f + if [[ "${2}" != "noflush" ]]; then + # Flush logs + pihole -f + fi echo -e " ${INFO} Disabling logging..." local str="Logging has been disabled!" elif [[ "${1}" == "on" ]]; then From bb3b1bc6bac4c57635385b61a3e6c567faf2b1a3 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 20 Jan 2018 05:13:55 -0800 Subject: [PATCH 32/38] Move ascii berry to after root check, stops the double berry for the sudo refire. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d22775c4..7d8dbae9 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1897,8 +1897,6 @@ FTLdetect() { main() { ######## FIRST CHECK ######## - # Show the Pi-hole logo so people know it's genuine since the logo and name are trademarked - show_ascii_berry # Must be root to install local str="Root user check" echo "" @@ -1907,6 +1905,8 @@ main() { if [[ "${EUID}" -eq 0 ]]; then # they are root and all is good echo -e " ${TICK} ${str}" + # Show the Pi-hole logo so people know it's genuine since the logo and name are trademarked + show_ascii_berry # Otherwise, else # They do not have enough privileges, so let the user know From b2eb364a4b8302e312c31ffa8069881a3f558e8a Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 20 Jan 2018 05:29:38 -0800 Subject: [PATCH 33/38] Update header Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 7d8dbae9..125333ca 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -2,7 +2,7 @@ # shellcheck disable=SC1090 # Pi-hole: A black hole for Internet advertisements -# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# (c) 2017-2018 Pi-hole, LLC (https://pi-hole.net) # Network-wide ad blocking via your own hardware. # # Installs and Updates Pi-hole @@ -14,7 +14,7 @@ # # Install with this command (from your Linux machine): # -# curl -L install.pi-hole.net | bash +# curl -sSL https://install.pi-hole.net | bash # -e option instructs bash to immediately exit if any command [1] has a non-zero exit status # We do not want users to end up with a partially working install, so we exit the script From a7f0137e5f3d2fa0452c5e60092b7fd7c872e2e7 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 20 Jan 2018 05:55:48 -0800 Subject: [PATCH 34/38] Use more secure installation log process. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 125333ca..9befba87 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -28,8 +28,7 @@ set -e # Local variables will be in lowercase and will exist only within functions # It's still a work in progress, so you may see some variance in this guideline until it is complete -# We write to a temporary file before moving the log to the pihole folder -tmpLog=/tmp/pihole-install.log +# Location for final installation log storage instalLogLoc=/etc/pihole/install.log # This is an important file as it contains information specific to the machine it's being installed on setupVars=/etc/pihole/setupVars.conf @@ -1891,8 +1890,24 @@ FTLdetect() { # Install FTL FTLinstall "${binary}" || return 1 fi +} +make_temporary_log() { + # Create a random temporary file for the log + TEMPLOG=$(mktemp /tmp/pihole_temp.XXXXXX) + # Open handle 3 for templog + # https://stackoverflow.com/questions/18460186/writing-outputs-to-log-file-and-console + exec 3>"$TEMPLOG" + # Delete templog, but allow for addressing via file handle + # This lets us write to the log without having a temporary file on the drive, which + # is meant to be a security measure so there is not a lingering file on the drive during the debug process + rm "$TEMPLOG" +} +copy_to_install_log() { + # Copy the contents of file descriptor 3 into the install log + # Since we use color codes such as '\e[1;33m', they should be removed + cat /proc/$$/fd/3 | sed 's/\[[0-9;]\{1,5\}m//g' > "${installLogLoc}" } main() { @@ -2031,7 +2046,7 @@ main() { fi # Install and log everything to a file - installPihole | tee ${tmpLog} + installPihole | tee ${TEMPLOG} else # Source ${setupVars} to use predefined user variables in the functions source ${setupVars} @@ -2058,11 +2073,11 @@ main() { LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true) fi - updatePihole | tee ${tmpLog} + updatePihole | tee ${TEMPLOG} fi # Move the log file into /etc/pihole for storage - mv ${tmpLog} ${instalLogLoc} + copy_to_install_log if [[ "${INSTALL_WEB}" == true ]]; then # Add password to web UI if there is none From cacfe4d38716b4919c8e3efa6764ef3de4711c95 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 20 Jan 2018 06:20:06 -0800 Subject: [PATCH 35/38] Linting changes Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9befba87..1c035d2e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -29,7 +29,7 @@ set -e # It's still a work in progress, so you may see some variance in this guideline until it is complete # Location for final installation log storage -instalLogLoc=/etc/pihole/install.log +installLogLoc=/etc/pihole/install.log # This is an important file as it contains information specific to the machine it's being installed on setupVars=/etc/pihole/setupVars.conf # Pi-hole uses lighttpd as a Web server, and this is the config file for it @@ -1900,14 +1900,14 @@ make_temporary_log() { exec 3>"$TEMPLOG" # Delete templog, but allow for addressing via file handle # This lets us write to the log without having a temporary file on the drive, which - # is meant to be a security measure so there is not a lingering file on the drive during the debug process + # is meant to be a security measure so there is not a lingering file on the drive during the install process rm "$TEMPLOG" } copy_to_install_log() { # Copy the contents of file descriptor 3 into the install log # Since we use color codes such as '\e[1;33m', they should be removed - cat /proc/$$/fd/3 | sed 's/\[[0-9;]\{1,5\}m//g' > "${installLogLoc}" + sed 's/\[[0-9;]\{1,5\}m//g' < /proc/$$/fd/3 > "${installLogLoc}" } main() { @@ -1922,6 +1922,7 @@ main() { echo -e " ${TICK} ${str}" # Show the Pi-hole logo so people know it's genuine since the logo and name are trademarked show_ascii_berry + make_temporary_log # Otherwise, else # They do not have enough privileges, so let the user know @@ -2046,7 +2047,7 @@ main() { fi # Install and log everything to a file - installPihole | tee ${TEMPLOG} + installPihole | tee -a /proc/$$/fd/3 else # Source ${setupVars} to use predefined user variables in the functions source ${setupVars} @@ -2072,11 +2073,10 @@ main() { # Value will either be 1, if true, or 0 LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true) fi - - updatePihole | tee ${TEMPLOG} + updatePihole | tee -a /proc/$$/fd/3 fi - # Move the log file into /etc/pihole for storage + # Copy the temp log file into final log location for storage copy_to_install_log if [[ "${INSTALL_WEB}" == true ]]; then @@ -2154,7 +2154,7 @@ main() { fi # Display where the log file is - echo -e "\\n ${INFO} The install log is located at: /etc/pihole/install.log + echo -e "\\n ${INFO} The install log is located at: ${INSTALL_LOG_LOC} ${COL_LIGHT_GREEN}${INSTALL_TYPE} Complete! ${COL_NC}" } From 954320361052e93cab2802fde6be02297befeba5 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 20 Jan 2018 08:45:41 -0800 Subject: [PATCH 36/38] Echo the right location for the log. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 1c035d2e..be5621a7 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -2154,7 +2154,7 @@ main() { fi # Display where the log file is - echo -e "\\n ${INFO} The install log is located at: ${INSTALL_LOG_LOC} + echo -e "\\n ${INFO} The install log is located at: ${installLogLoc} ${COL_LIGHT_GREEN}${INSTALL_TYPE} Complete! ${COL_NC}" } From 2b6d9c34c9f0150f1ddef271b91b6c392a50e7bc Mon Sep 17 00:00:00 2001 From: Elias Ojala Date: Sat, 27 Jan 2018 14:36:11 +0200 Subject: [PATCH 37/38] Fixed a typo Signed-off-by: Elias Ojala --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 550f26ad..c87d00a6 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1929,7 +1929,7 @@ main() { # They do not have enough privileges, so let the user know echo -e " ${CROSS} ${str} ${COL_LIGHT_RED}Script called with non-root privileges${COL_NC} - The Pi-hole requires elevated privleges to install and run + The Pi-hole requires elevated privileges to install and run Please check the installer for any concerns regarding this requirement Make sure to download this script from a trusted source\\n" echo -ne " ${INFO} Sudo utility check" From 55e10d8287df8721a325d42761c9a04823c0b9db Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 28 Jan 2018 00:50:15 +0000 Subject: [PATCH 38/38] replace another grep -F as pointed out by @StarPicard Signed-off-by: Adam Warner --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 536cad27..d83d271a 100755 --- a/gravity.sh +++ b/gravity.sh @@ -330,7 +330,7 @@ gravity_ParseFileIntoDomains() { }' "${source}" > "${destination}.exceptionsFile.tmp" # Remove exceptions - grep -F -x -v -f "${destination}.exceptionsFile.tmp" "${destination}" > "${source}" + comm -23 "${destination}" <(sort "${destination}.exceptionsFile.tmp") > "${source}" mv "${source}" "${destination}" fi