From 94dd5b1ebe74c673fc56ed27d3c890dc3b7496dd Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 10 Oct 2016 11:05:29 -0700 Subject: [PATCH 1/5] More CentOS fixes. --- automated install/basic-install.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 6875cf2f..ae04af57 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -81,6 +81,7 @@ if [ -x "$(command -v apt-get)" ];then LIGHTTPD_USER="www-data" LIGHTTPD_GROUP="www-data" LIGHTTPD_CFG="lighttpd.conf.debian" + DNSMASQ_USER="dnsmasq" package_check_install() { dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed" || ${PKG_INSTALL} "$1" } @@ -101,6 +102,7 @@ elif [ -x "$(command -v rpm)" ];then LIGHTTPD_USER="lighttpd" LIGHTTPD_GROUP="lighttpd" LIGHTTPD_CFG="lighttpd.conf.fedora" + DNSMASQ_USER="nobody" package_check_install() { rpm -qa | grep ^"$1"- > /dev/null || ${PKG_INSTALL} "$1" } @@ -702,7 +704,7 @@ CreateLogFile() { if [ ! -f /var/log/pihole.log ]; then touch /var/log/pihole.log chmod 644 /var/log/pihole.log - chown dnsmasq:root /var/log/pihole.log + chown "${DNSMASQ_USER}":root /var/log/pihole.log echo " done!" else echo " already exists!" @@ -839,21 +841,13 @@ configureSelinux() { package_check_install "selinux-policy-devel" > /dev/null echo " installed!" printf "::: Enabling httpd server side includes (SSI).. " - setsebool -P httpd_ssi_exec on - if [ $? -eq 0 ]; then - echo -n "Success" - fi + setsebool -P httpd_ssi_exec on &> /dev/null && echo "Success" || echo "SELinux not enabled" printf "\n:::\tCompiling Pi-Hole SELinux policy..\n" checkmodule -M -m -o /etc/pihole/pihole.mod /etc/.pihole/advanced/selinux/pihole.te semodule_package -o /etc/pihole/pihole.pp -m /etc/pihole/pihole.mod semodule -i /etc/pihole/pihole.pp rm -f /etc/pihole/pihole.mod - semodule -l | grep pihole > /dev/null - if [ $? -eq 0 ]; then - printf "::: Successfully installed Pi-Hole SELinux policy\n" - else - printf "::: Warning: Pi-Hole SELinux policy did not install correctly!\n" - fi + semodule -l | grep pihole &> /dev/null && echo "::: Installed Pi-Hole SELinux policy" || echo "::: Warning: Pi-Hole SELinux policy did not install." fi } From 570611fc099a54615cacd322ee27fe551f7571f1 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 10 Oct 2016 11:30:15 -0700 Subject: [PATCH 2/5] CentOS Firewall fix --- automated install/basic-install.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index ae04af57..13b6cafd 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -764,14 +764,8 @@ create_pihole_user(){ configureFirewall() { # Allow HTTP and DNS traffic if [ -x "$(command -v firewall-cmd)" ]; then - firewall-cmd --state > /dev/null - if [[ $? -eq 0 ]]; then - echo "::: Configuring firewalld for httpd and dnsmasq.." - firewall-cmd --permanent --add-port=80/tcp - firewall-cmd --permanent --add-port=53/tcp - firewall-cmd --permanent --add-port=53/udp - firewall-cmd --reload - fi + firewall-cmd --state &> /dev/null && ( echo "::: Configuring firewalld for httpd and dnsmasq.." && firewall-cmd --permanent --add-port=80/tcp && firewall-cmd --permanent --add-port=53/tcp \ + && firewall-cmd --permanent --add-port=53/udp && firewall-cmd --reload) || echo "::: FirewallD not enabled" elif [ -x "$(command -v iptables)" ]; then echo "::: Configuring iptables for httpd and dnsmasq.." iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT From 4418ca9e9f9cfdc2ce55c9fd1253918b25f31c5d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 10 Oct 2016 11:41:29 -0700 Subject: [PATCH 3/5] Missing quote replacement. --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index c78af899..604778e3 100755 --- a/gravity.sh +++ b/gravity.sh @@ -254,7 +254,7 @@ function gravity_hostFormat() { echo "::: Error: Unable to determine fully qualified domain name of host" fi # If there is a value in the $piholeIPv6, then IPv6 will be used, so the awk command modified to create a line for both protocols - if [[ -n ${IPv6_address} ]];then + if [[ -n $"{IPv6_address}" ]];then # Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin) echo -e "$IPv4addr $hostname\n$IPv6_address $hostname\n$IPv4addr pi.hole\n$IPv6_address pi.hole" > ${piholeDir}/${accretionDisc} cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPv4addr" -v ipv6addr="$IPv6_address" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} From 4f35aac6dd967c2c2f1edb8713f581f3c90c6c86 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 10 Oct 2016 22:32:30 +0100 Subject: [PATCH 4/5] transpose `$` and `"` --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 604778e3..bcfcc9ee 100755 --- a/gravity.sh +++ b/gravity.sh @@ -254,7 +254,7 @@ function gravity_hostFormat() { echo "::: Error: Unable to determine fully qualified domain name of host" fi # If there is a value in the $piholeIPv6, then IPv6 will be used, so the awk command modified to create a line for both protocols - if [[ -n $"{IPv6_address}" ]];then + if [[ -n "${IPv6_address}" ]];then # Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin) echo -e "$IPv4addr $hostname\n$IPv6_address $hostname\n$IPv4addr pi.hole\n$IPv6_address pi.hole" > ${piholeDir}/${accretionDisc} cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPv4addr" -v ipv6addr="$IPv6_address" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} From aa23fb1d56adf297be2491b8448809ada108b7b1 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 10 Oct 2016 22:34:12 +0100 Subject: [PATCH 5/5] choose* --- 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 13b6cafd..945fa1e1 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -398,14 +398,14 @@ function valid_ip() } setDNS(){ - DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider. To use your own, select Custom." ${r} ${c} 6) + DNSChooseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider. To use your own, select Custom." ${r} ${c} 6) DNSChooseOptions=(Google "" on OpenDNS "" off Level3 "" off Norton "" off Comodo "" off Custom "" off) - DNSchoices=$("${DNSChoseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) + DNSchoices=$("${DNSChooseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) if [[ $? = 0 ]];then case ${DNSchoices} in Google) @@ -860,7 +860,7 @@ View the web interface at http://pi.hole/admin or http://${IPv4_address%/*}/admi update_dialogs(){ - UpdateCmd=$(whiptail --title "Existing Install Detected!" --menu "\n\nWe have detected an existing install.\n\nPlease chose from the following options:" ${r} ${c} 2 \ + UpdateCmd=$(whiptail --title "Existing Install Detected!" --menu "\n\nWe have detected an existing install.\n\nPlease choose from the following options:" ${r} ${c} 2 \ "Update" "Update install will retain existing settings." \ "Install" "Install will allow you to enter new settings." 3>&2 2>&1 1>&3)