diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 00000000..e1cb3b50 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,3 @@ +engines: + shellcheck: + enabled: true diff --git a/advanced/01-pihole.conf b/advanced/01-pihole.conf index fd8e27f2..f4707ef4 100644 --- a/advanced/01-pihole.conf +++ b/advanced/01-pihole.conf @@ -20,6 +20,12 @@ # OR IN /etc/dnsmasq.conf # ############################################################################### +address=/pi.hole/@IPv4@ +address=/pi.hole/@IPv6@ + +address=/@HOSTNAME@/@IPv4@ +address=/@HOSTNAME@/@IPv6@ + addn-hosts=/etc/pihole/gravity.list domain-needed @@ -33,8 +39,6 @@ server=@DNS2@ interface=@INT@ -listen-address=127.0.0.1 - cache-size=10000 log-queries diff --git a/advanced/lighttpd.conf.debian b/advanced/lighttpd.conf.debian index bf2e5104..15821bc7 100644 --- a/advanced/lighttpd.conf.debian +++ b/advanced/lighttpd.conf.debian @@ -12,6 +12,7 @@ server.modules = ( "mod_access", "mod_accesslog", + "mod_auth", "mod_expire", "mod_compress", "mod_redirect", @@ -60,3 +61,6 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { # Create a response header for debugging using curl -I setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) } + +# Add user chosen options held in external file +include_shell "cat external.conf 2>/dev/null" diff --git a/advanced/lighttpd.conf.fedora b/advanced/lighttpd.conf.fedora index fc00923c..96e1311e 100644 --- a/advanced/lighttpd.conf.fedora +++ b/advanced/lighttpd.conf.fedora @@ -11,6 +11,7 @@ server.modules = ( "mod_access", + "mod_auth", "mod_fastcgi", "mod_accesslog", "mod_expire", @@ -77,3 +78,6 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { # Create a response header for debugging using curl -I setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) } + +# Add user chosen options held in external file +include_shell "cat external.conf 2>/dev/null" diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index a480b855..023a21ed 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -555,6 +555,37 @@ version_check_dnsmasq() { else sed -i '/^server=@DNS2@/d' ${dnsmasq_pihole_01_location} fi + + #sed -i "s/@HOSTNAME@/$hostname/" ${dnsmasq_pihole_01_location} + + if [[ -f /etc/hostname ]]; then + hostname=$( /dev/null + # Check whitelist.txt exists. if [[ -f "${whitelistFile}" ]]; then # Remove anything in whitelist.txt from the Event Horizon numWhitelisted=$(wc -l < "${whitelistFile}") plural=; [[ "$numWhitelisted" != "1" ]] && plural=s echo -n "::: Whitelisting $numWhitelisted domain${plural}..." + #print everything from preEventHorizon into eventHorizon EXCEPT domains in whitelist.txt grep -F -x -v -f ${whitelistFile} ${piholeDir}/${preEventHorizon} > ${piholeDir}/${eventHorizon} echo " done!" else @@ -240,31 +241,20 @@ gravity_unique() { gravity_hostFormat() { # Format domain list as "192.168.x.x domain.com" echo "::: Formatting domains into a HOSTS file..." - if [[ -f /etc/hostname ]]; then - hostname=$( ${piholeDir}/${accretionDisc} cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPv4_address" -v ipv6addr="$IPv6_address" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} elif [[ -n "${IPv4_address}" && -z "${IPv6_address}" ]];then # Only IPv4 - echo -e "$IPv4_address $hostname\n$IPv4_address pi.hole" > ${piholeDir}/${accretionDisc} cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPv4_address" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc} elif [[ -z "${IPv4_address}" && -n "${IPv6_address}" ]];then # Only IPv6 - echo -e "$IPv6_address $hostname\n$IPv6_address pi.hole" > ${piholeDir}/${accretionDisc} cat ${piholeDir}/${eventHorizon} | awk -v ipv6addr="$IPv6_address" '{sub(/\r$/,""); print ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} elif [[ -z "${IPv4_address}" && -z "${IPv6_address}" ]];then