From bac9e005aed0ac10ea9dfa63123ef1b5a9b7c72d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 21 Apr 2018 23:27:36 +0200 Subject: [PATCH 1/3] Generate gravity.list and black.list in simple domain lists format for FTLDNS. Leave local.list in HOSTS format Signed-off-by: DL6ER --- gravity.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gravity.sh b/gravity.sh index 7fdb2723..f3b98eb2 100755 --- a/gravity.sh +++ b/gravity.sh @@ -512,13 +512,13 @@ gravity_ParseBlacklistDomains() { # Empty $accretionDisc if it already exists, otherwise, create it : > "${piholeDir}/${accretionDisc}" - + if [[ -f "${piholeDir}/${whitelistMatter}" ]]; then - gravity_ParseDomainsIntoHosts "${piholeDir}/${whitelistMatter}" "${piholeDir}/${accretionDisc}" + mv "${piholeDir}/${whitelistMatter}" "${piholeDir}/${accretionDisc}" grep -c "^" "${piholeDir}/${whitelistMatter}" > "${piholeDir}/numBlocked" 2> /dev/null else # There was no whitelist file, so use preEventHorizon instead of whitelistMatter. - gravity_ParseDomainsIntoHosts "${piholeDir}/${preEventHorizon}" "${piholeDir}/${accretionDisc}" + mv "${piholeDir}/${preEventHorizon}" "${piholeDir}/${accretionDisc}" grep -c "^" "${piholeDir}/${preEventHorizon}" > "${piholeDir}/numBlocked" 2> /dev/null fi @@ -538,7 +538,7 @@ gravity_ParseUserDomains() { return 0 fi - gravity_ParseDomainsIntoHosts "${blacklistFile}" "${blackList}.tmp" + mv "${blacklistFile}" "${blackList}.tmp" # Copy the file over as /etc/pihole/black.list so dnsmasq can use it mv "${blackList}.tmp" "${blackList}" 2> /dev/null || \ echo -e "\\n ${CROSS} Unable to move ${blackList##*/}.tmp to ${piholeDir}" From d24b141d8b5aab9f0e20d08331fc094db908b005 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 21 Apr 2018 23:58:42 +0200 Subject: [PATCH 2/3] Get rid of numBlocked file, FTLDNS can now determine number of domains thanks to the new lists format Signed-off-by: DL6ER --- gravity.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/gravity.sh b/gravity.sh index f3b98eb2..44889a60 100755 --- a/gravity.sh +++ b/gravity.sh @@ -515,11 +515,9 @@ gravity_ParseBlacklistDomains() { if [[ -f "${piholeDir}/${whitelistMatter}" ]]; then mv "${piholeDir}/${whitelistMatter}" "${piholeDir}/${accretionDisc}" - grep -c "^" "${piholeDir}/${whitelistMatter}" > "${piholeDir}/numBlocked" 2> /dev/null else # There was no whitelist file, so use preEventHorizon instead of whitelistMatter. mv "${piholeDir}/${preEventHorizon}" "${piholeDir}/${accretionDisc}" - grep -c "^" "${piholeDir}/${preEventHorizon}" > "${piholeDir}/numBlocked" 2> /dev/null fi # Move the file over as /etc/pihole/gravity.list so dnsmasq can use it From 9c29bd627e9b22ca6f16841989fbb0ccb5c89c77 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sat, 21 Apr 2018 23:55:33 +0100 Subject: [PATCH 3/3] fix user blacklisting --- gravity.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gravity.sh b/gravity.sh index 44889a60..4583208c 100755 --- a/gravity.sh +++ b/gravity.sh @@ -535,11 +535,10 @@ gravity_ParseUserDomains() { if [[ ! -f "${blacklistFile}" ]]; then return 0 fi - - mv "${blacklistFile}" "${blackList}.tmp" + # Copy the file over as /etc/pihole/black.list so dnsmasq can use it - mv "${blackList}.tmp" "${blackList}" 2> /dev/null || \ - echo -e "\\n ${CROSS} Unable to move ${blackList##*/}.tmp to ${piholeDir}" + cp "${blacklistFile}" "${blackList}" 2> /dev/null || \ + echo -e "\\n ${CROSS} Unable to move ${blacklistFile##*/} to ${piholeDir}" } # Trap Ctrl-C