diff options
author | max.bra | 2017-01-03 12:37:07 +0100 |
---|---|---|
committer | max.bra | 2017-01-03 12:37:07 +0100 |
commit | 2518a1c02d8329fda3430c6fd7b4fe362120e2ec (patch) | |
tree | 0d012d08e8b40a65a5e3a964683a9c8553b6dafb | |
parent | dad6b74e19c3f9a3c22a106fd819f105b3e644aa (diff) | |
download | aur-2518a1c02d8329fda3430c6fd7b4fe362120e2ec.tar.gz |
v. 2.11 and web v. 2.3
-rw-r--r-- | .SRCINFO | 27 | ||||
-rw-r--r-- | PKGBUILD | 133 | ||||
-rw-r--r-- | configuration | 21 | ||||
-rw-r--r-- | dnsmasq.include | 30 | ||||
-rw-r--r-- | dnsmasq.local | 5 | ||||
-rw-r--r-- | dnsmasq.main | 28 | ||||
-rw-r--r-- | lighttpd.conf | 16 | ||||
-rw-r--r-- | mimic_setupVars.conf.sh | 16 | ||||
-rw-r--r-- | pi-hole-server.install | 21 |
9 files changed, 161 insertions, 136 deletions
@@ -1,7 +1,7 @@ pkgbase = pi-hole-server pkgdesc = The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server. - pkgver = 2.9.5 - pkgrel = 5 + pkgver = 2.11 + pkgrel = 1 url = https://github.com/pi-hole/pi-hole install = pi-hole-server.install arch = any @@ -9,17 +9,17 @@ pkgbase = pi-hole-server depends = dnsmasq depends = lighttpd depends = php-cgi - depends = libmariadbclient depends = bc depends = perl conflicts = pi-hole-standalone backup = etc/pihole/whitelist.txt backup = etc/pihole/blacklist.txt - source = https://github.com/pi-hole/pi-hole/archive/v2.9.5.tar.gz - source = https://github.com/pi-hole/AdminLTE/archive/v1.4.4.2.tar.gz + source = https://github.com/pi-hole/pi-hole/archive/v2.11.tar.gz + source = https://github.com/pi-hole/AdminLTE/archive/v2.3.tar.gz source = configuration - source = dnsmasq.include source = dnsmasq.main + source = dnsmasq.include + source = dnsmasq.local source = lighttpd.conf source = pi-hole.tmpfile source = pi-hole-gravity.service @@ -29,12 +29,13 @@ pkgbase = pi-hole-server source = whitelist.txt source = blacklist.txt source = mimic_setupVars.conf.sh - md5sums = b383a2741e556a3680b3ae312a18cfba - md5sums = fe8c5814aa6570085825bc055f8e85b9 - md5sums = 6e6ab264586c16350ad2a5a800ab03e7 - md5sums = 8b2d15c5e7d152e9207bd82db3ca144d - md5sums = dc1f4fc9d475f08d2b3ccaaed47a52c2 - md5sums = 82ce6717056c7a680fd2dd09bf6f6ff4 + md5sums = 212239c4425dc55941fdca24409d6b18 + md5sums = 7c14f32fc84787daa6107d84cadda39e + md5sums = ec7c89571c280c48b47bd7d6a9548989 + md5sums = 3f1aeea43af0b192edb36b9e5484ff87 + md5sums = f39fa3e607ff7346e93febfa2d0e565e + md5sums = 2d10140f19f54015e6ab2807267e8aaf + md5sums = d67496cb0b6447d98a3e1309df319b3a md5sums = 990b8abd0bfbba23a7ce82c59f2e3d64 md5sums = 047f13d4ac97877f724f87b002aaee63 md5sums = d42a864f88299998f8233c0bc0dd093d @@ -42,7 +43,7 @@ pkgbase = pi-hole-server md5sums = 291d3c95e445fe65caf40c3605efd186 md5sums = d41d8cd98f00b204e9800998ecf8427e md5sums = d41d8cd98f00b204e9800998ecf8427e - md5sums = d6af5c9b54af57b395e53c27aa2d750e + md5sums = 302102fdaf6f59d232c552ee10c4a229 pkgname = pi-hole-server @@ -2,15 +2,15 @@ pkgname=pi-hole-server _pkgname=pi-hole -pkgver=2.9.5 -pkgrel=5 +pkgver=2.11 +pkgrel=1 _wwwpkgname=AdminLTE -_wwwpkgver=1.4.4.2 +_wwwpkgver=2.3 pkgdesc='The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server.' arch=('any') license=('GPL2') url="https://github.com/pi-hole/pi-hole" -depends=('dnsmasq' 'lighttpd' 'php-cgi' 'libmariadbclient' 'bc' 'perl') +depends=('dnsmasq' 'lighttpd' 'php-cgi' 'bc' 'perl') conflicts=('pi-hole-standalone') install=$pkgname.install backup=('etc/pihole/whitelist.txt' 'etc/pihole/blacklist.txt') @@ -18,8 +18,9 @@ backup=('etc/pihole/whitelist.txt' 'etc/pihole/blacklist.txt') source=(https://github.com/$_pkgname/$_pkgname/archive/v$pkgver.tar.gz https://github.com/$_pkgname/$_wwwpkgname/archive/v$_wwwpkgver.tar.gz configuration - dnsmasq.include dnsmasq.main + dnsmasq.include + dnsmasq.local lighttpd.conf $_pkgname.tmpfile $_pkgname-gravity.service @@ -30,12 +31,13 @@ source=(https://github.com/$_pkgname/$_pkgname/archive/v$pkgver.tar.gz blacklist.txt mimic_setupVars.conf.sh) -md5sums=('b383a2741e556a3680b3ae312a18cfba' - 'fe8c5814aa6570085825bc055f8e85b9' - '6e6ab264586c16350ad2a5a800ab03e7' - '8b2d15c5e7d152e9207bd82db3ca144d' - 'dc1f4fc9d475f08d2b3ccaaed47a52c2' - '82ce6717056c7a680fd2dd09bf6f6ff4' +md5sums=('212239c4425dc55941fdca24409d6b18' + '7c14f32fc84787daa6107d84cadda39e' + 'ec7c89571c280c48b47bd7d6a9548989' + '3f1aeea43af0b192edb36b9e5484ff87' + 'f39fa3e607ff7346e93febfa2d0e565e' + '2d10140f19f54015e6ab2807267e8aaf' + 'd67496cb0b6447d98a3e1309df319b3a' '990b8abd0bfbba23a7ce82c59f2e3d64' '047f13d4ac97877f724f87b002aaee63' 'd42a864f88299998f8233c0bc0dd093d' @@ -43,19 +45,11 @@ md5sums=('b383a2741e556a3680b3ae312a18cfba' '291d3c95e445fe65caf40c3605efd186' 'd41d8cd98f00b204e9800998ecf8427e' 'd41d8cd98f00b204e9800998ecf8427e' - 'd6af5c9b54af57b395e53c27aa2d750e') + '302102fdaf6f59d232c552ee10c4a229') prepare() { _ssc="/tmp/sedcontrol" - # sudoers setup - sed -i "s/www-data/http/w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/pihole.sudo - if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudoers setup 1" && return 1 ; fi - sed -i "s|/usr/local/bin|/usr/bin|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/pihole.sudo - if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudoers setup 2" && return 1 ; fi - -# ----------------- - # setting up and securing pihole wrapper script sed -n "/debugFunc() {/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 1" && return 1 ; fi @@ -91,12 +85,6 @@ prepare() { # ----------------- - # adlists.default is already there - sed -i "s/cp \/etc\/.pihole\/adlists.default \/etc\/pihole\/adlists.default//w $_ssc" "$srcdir"/$_pkgname-$pkgver/gravity.sh - if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: adlists.default is already there" && return 1 ; fi - -# ----------------- - # arch useless sed -n "/#ensure \/etc\/dnsmasq\.d\//w $_ssc" "$srcdir"/$_pkgname-$pkgver/gravity.sh if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: arch useless 1" && return 1 ; fi @@ -104,6 +92,12 @@ prepare() { # ----------------- + # change log location to pihole script + sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location to pihole script" && return 1 ; fi + +# ----------------- + # change log location to piholeLogFlush.sh sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/piholeLogFlush.sh if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location to piholeLogFlush.sh" && return 1 ; fi @@ -116,37 +110,73 @@ prepare() { # ----------------- - # little arch changes to chronometer.sh - sed -i "s|.*ifconfig eth0.*|NICDEV=\$\(ip route get 8.8.8.8 \| awk '{for\(i=1;i<=NF;i++\)if\(\$\i~/dev/\)print $\(i+1\)}'\)\n&|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/chronometer.sh - if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: little arch changes to chronometer.sh 1" && return 1 ; fi - sed -i "s|\$(ifconfig eth0 \||\$(ifconfig \$NICDEV \||w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/chronometer.sh - if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: little arch changes to chronometer.sh 2" && return 1 ; fi - sed -i "s|/inet addr/|/inet /|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/chronometer.sh - if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: little arch changes to chronometer.sh 3" && return 1 ; fi - -# ----------------- - # change log location in admin php interface - sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/data.php - if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location in admin php interface" && return 1 ; fi + sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/data.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location in admin php interface 1" && return 1 ; fi + sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/settings.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location in admin php interface 2" && return 1 ; fi # ----------------- # since we don't directly install from git... - sed -n "/\$piholeVersion =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/footer.php + sed -n "/\$piholeVersion =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 1" && return 1 ; fi - sed -i 's/\$piholeVersion =.*$/\$piholeVersion = "'"$pkgver"'";/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/footer.php - sed -n "/\$webVersion =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/footer.php + sed -i 's/\$piholeVersion =.*$/\$piholeVersion = "'"$pkgver"'";/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php + sed -n "/\$webVersion =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 2" && return 1 ; fi - sed -i 's/\$webVersion =.*$/\$webVersion = "'"$_wwwpkgver"'";/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/footer.php + sed -i 's/\$webVersion =.*$/\$webVersion = "'"$_wwwpkgver"'";/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php - sed -n "/piholeVersion=.*$/w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh + sed -n "/\$piholeBranch =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 3" && return 1 ; fi + sed -i 's/\$piholeBranch =.*$/\$piholeBranch = "master";/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php + sed -n "/\$webBranch =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 4" && return 1 ; fi + sed -i 's/\$webBranch =.*$/\$webBranch = "master";/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php + + sed -n "/\$piholeCommit =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 3" && return 1 ; fi + sed -i 's/\$piholeCommit =.*$/\$piholeCommit = NULL;/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php + sed -n "/\$webCommit =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 4" && return 1 ; fi + sed -i 's/\$webCommit =.*$/\$webCommit = NULL;/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php + + sed -n "/piholeVersion=.*$/w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 5" && return 1 ; fi sed -i 's/piholeVersion=.*$/piholeVersion="'"$pkgver"'";/' "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh sed -n "/webVersion=.*$/w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh - if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 4" && return 1 ; fi + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 6" && return 1 ; fi sed -i 's/webVersion=.*$/webVersion="'"$_wwwpkgver"'";/' "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh +# ----------------- + + # sudo pihole full path (php-fpm compatibility) + sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/api.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 1" && return 1 ; fi + sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/header.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 2" && return 1 ; fi + sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/queryads.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 3" && return 1 ; fi + sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/savesettings.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 4" && return 1 ; fi + sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/sub.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 5" && return 1 ; fi + sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/add.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 6" && return 1 ; fi + sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/gravity.sh.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 7" && return 1 ; fi + sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/loginpage.php + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 8" && return 1 ; fi + +# ----------------- + + # webpage.sh: line 139: ProcessDnsmasqSettings: command not found + sed -i "s|ProcessDnsmasqSettings|ProcessDHCPSettings|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/webpage.sh + if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: webpage.sh: line 139: ProcessDnsmasqSettings: command not found" && return 1 ; fi + +# ----------------- + + # pi-hole sudoers file is now populated by install script + echo "http ALL=NOPASSWD: /usr/bin/pihole" >> ./$_pkgname-$pkgver/advanced/pihole.sudo } package() { @@ -159,11 +189,12 @@ package() { install -Dm755 ./$_pkgname-$pkgver/advanced/Scripts/piholeLogFlush.sh "$pkgdir"/opt/pihole/piholeLogFlush.sh || return 1 install -Dm755 ./$_pkgname-$pkgver/advanced/Scripts/chronometer.sh "$pkgdir"/opt/pihole/chronometer.sh || return 1 install -Dm755 ./$_pkgname-$pkgver/advanced/Scripts/list.sh "$pkgdir"/opt/pihole/list.sh || return 1 + install -Dm755 ./$_pkgname-$pkgver/advanced/Scripts/webpage.sh "$pkgdir"/opt/pihole/webpage.sh || return 1 install -Dm755 mimic_setupVars.conf.sh "$pkgdir"/opt/pihole/mimic_setupVars.conf.sh || return 1 install -dm750 "$pkgdir"/etc/sudoers.d - install -Dm644 ./$_pkgname-$pkgver/advanced/pihole.sudo "$pkgdir"/etc/sudoers.d/pihole || return 1 + install -Dm440 ./$_pkgname-$pkgver/advanced/pihole.sudo "$pkgdir"/etc/sudoers.d/pihole || return 1 install -Dm644 pi-hole.tmpfile "$pkgdir"/etc/tmpfiles.d/pi-hole.conf || return 1 @@ -180,14 +211,18 @@ package() { install -Dm644 ./$_pkgname-$pkgver/adlists.default "$pkgdir"/etc/pihole/adlists.default || return 1 install -Dm644 whitelist.txt "$pkgdir"/etc/pihole/whitelist.txt || return 1 install -Dm644 blacklist.txt "$pkgdir"/etc/pihole/blacklist.txt || return 1 + + install -Dm644 configuration "$pkgdir"/usr/share/doc/pihole/configuration || return 1 + install -Dm644 dnsmasq.main "$pkgdir"/etc/pihole/configs/dnsmasq.main || return 1 - install -Dm644 dnsmasq.include "$pkgdir"/etc/pihole/configs/dnsmasq.include || return 1 + install -Dm644 dnsmasq.include "$pkgdir"/etc/dnsmasq.d/01-pihole.conf || return 1 + install -Dm644 dnsmasq.local "$pkgdir"/etc/dnsmasq.d/02-pihole.conf || return 1 install -Dm644 lighttpd.conf "$pkgdir"/etc/pihole/configs/lighttpd.conf || return 1 - install -Dm644 configuration "$pkgdir"/usr/share/doc/pihole/configuration || return 1 install -dm755 "$pkgdir"/srv/http/pihole/admin || return 1 - install -Dm644 ./$_pkgname-$pkgver/advanced/index.html "$pkgdir"/srv/http/pihole/index.html || return 1 - install -Dm644 ./$_pkgname-$pkgver/advanced/index.js "$pkgdir"/srv/http/pihole/index.js || return 1 + install -Dm644 ./$_pkgname-$pkgver/advanced/index.php "$pkgdir"/srv/http/pihole/pihole/index.php || return 1 + install -Dm644 ./$_pkgname-$pkgver/advanced/index.js "$pkgdir"/srv/http/pihole/pihole/index.js || return 1 + install -Dm644 ./$_pkgname-$pkgver/advanced/blockingpage.css "$pkgdir"/srv/http/pihole/pihole/blockingpage.css || return 1 cp -dpr --no-preserve=ownership $_wwwpkgname-$_wwwpkgver/* "$pkgdir"/srv/http/pihole/admin/ } diff --git a/configuration b/configuration index 6beeb8c060bf..5fc1bc7cd9e1 100644 --- a/configuration +++ b/configuration @@ -12,12 +12,7 @@ A) First install steps *** if you already use dnsmasq and it's functional - 1) copy pi-hole include config lines in right place - - # mkdir /etc/dnsmasq.d - # cp /etc/pihole/configs/dnsmasq.include /etc/dnsmasq.d/01-pihole.conf - - 2) edit your /etc/dnsmasq.conf to uncomment last line (including new pi-hole config lines) + 1) edit your /etc/dnsmasq.conf to uncomment last line (including new pi-hole config lines) # sed -i 's|#conf-dir=/etc/dnsmasq.d/,\*.conf|conf-dir=/etc/dnsmasq.d/,\*.conf|' /etc/dnsmasq.conf @@ -25,31 +20,29 @@ A) First install steps *** if you installed dnsmasq with this package for the first time - 3) backup original dnsmasq config file and copy pi-hole main and include files + 2) backup original dnsmasq config file and copy pi-hole main and include files # cp /etc/dnsmasq.conf /etc/dnsmasq.orig # cp /etc/pihole/configs/dnsmasq.main /etc/dnsmasq.conf - # mkdir /etc/dnsmasq.d - # cp /etc/pihole/configs/dnsmasq.include /etc/dnsmasq.d/01-pihole.conf *** end if - 4) lighttpd need port 80 to be free. backup original config file and copy pi-hole one + 3) lighttpd need port 80 to be free. backup original config file and copy pi-hole one # cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.orig # cp /etc/pihole/configs/lighttpd.conf /etc/lighttpd/lighttpd.conf - 5) enable and start dnsmasq service + 4) enable and start dnsmasq service # systemctl reenable dnsmasq.service # systemctl restart dnsmasq.service - 6) enable and start lighttpd service + 5) enable and start lighttpd service # systemctl reenable lighttpd.service # systemctl restart lighttpd.service - 7) FUNDAMENTAL: point dns resolution of your lan clients to this machine + 6) FUNDAMENTAL: point dns resolution of your lan clients to this machine B) Upgrade steps @@ -58,7 +51,6 @@ B) Upgrade steps 1) update dnsmasq conf file - # [ -f /etc/dnsmasq.d/pihole.conf ] && cp /etc/pihole/configs/dnsmasq.include /etc/dnsmasq.d/pihole.conf # [ -f /etc/dnsmasq.orig ] && cp /etc/pihole/configs/dnsmasq.complete /etc/dnsmasq.conf 2) update lighttpd conf file @@ -81,7 +73,6 @@ C) Uninstall steps # systemctl disable dnsmasq.service # systemctl stop lighttpd.service # systemctl disable lighttpd.service - # [ -f /etc/dnsmasq.d/pihole.conf ] && rm /etc/dnsmasq.d/pihole.conf # [ -f /etc/dnsmasq.orig ] && cp /etc/dnsmasq.orig /etc/dnsmasq.conf # [ -f /etc/lighttpd/lighttpd.orig ] && cp /etc/lighttpd/lighttpd.orig /etc/lighttpd/lighttpd.conf diff --git a/dnsmasq.include b/dnsmasq.include index 79f2db62ff6f..7749fdadc3e3 100644 --- a/dnsmasq.include +++ b/dnsmasq.include @@ -1,12 +1,32 @@ -address=/pi.hole/@IPv4@ -address=/pi.hole/@IPv6@ +# Pi-hole: A black hole for Internet advertisements +# (c) 2015, 2016 by Jacob Salmela +# Network-wide ad blocking via your Raspberry Pi +# http://pi-hole.net +# dnsmasq config for Pi-hole +# +# Pi-hole is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. -address=/@HOSTNAME@/@IPv4@ -address=/@HOSTNAME@/@IPv6@ +############################################################################### +# FILE AUTOMATICALLY POPULATED BY PI-HOLE INSTALL/UPDATE PROCEDURE. # +# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE # +# # +# IF YOU WISH TO CHANGE THE UPSTREAM SERVERS, CHANGE THEM IN: # +# /etc/pihole/setupVars.conf # +# # +# ANY OTHER CHANGES SHOULD BE MADE IN A SEPERATE CONFIG FILE # +# OR IN /etc/dnsmasq.conf # +############################################################################### addn-hosts=/etc/pihole/gravity.list - +addn-hosts=/etc/pihole/local.list +domain-needed +bogus-priv +no-resolv cache-size=10000 log-queries log-facility=/run/log/pihole/pihole.log +local-ttl=300 log-async diff --git a/dnsmasq.local b/dnsmasq.local new file mode 100644 index 000000000000..9303809460c1 --- /dev/null +++ b/dnsmasq.local @@ -0,0 +1,5 @@ +address=/pi.hole/@IPv4@ +address=/pi.hole/@IPv6@ + +address=/@HOSTNAME@/@IPv4@ +address=/@HOSTNAME@/@IPv6@ diff --git a/dnsmasq.main b/dnsmasq.main index 684bfe17c8cb..9b71a43f56a1 100644 --- a/dnsmasq.main +++ b/dnsmasq.main @@ -1,24 +1,3 @@ -# The following two options make you a better netizen, since they -# tell dnsmasq to filter out queries which the public DNS cannot -# answer, and which load the servers (especially the root servers) -# unnecessarily. If you have a dial-on-demand link they also stop -# these requests from bringing up the link unnecessarily. - -# Never forward plain names (without a dot or domain part) -domain-needed -# Never forward addresses in the non-routed address spaces. -bogus-priv - -# If you don't want dnsmasq to read /etc/resolv.conf or any other -# file, getting its servers from this file instead (see below), then -# uncomment this. -no-resolv - -# Add other name servers here, with domain specs if they are for -# non-public domains. -server=8.8.8.8 -server=8.8.4.4 - # If you want dnsmasq to listen for DHCP and DNS requests only on # specified interfaces (and the loopback) give the name of the # interface (eg eth0) here. @@ -27,13 +6,6 @@ server=8.8.4.4 # you use this.) #listen-address=127.0.0.1 -# Normally responses which come from /etc/hosts and the DHCP lease -# file have Time-To-Live set as zero, which conventionally means -# do not cache further. If you are happy to trade lower load on the -# server for potentially stale date, you can set a time-to-live (in -# seconds) here. -local-ttl=300 - # Include all files in a directory which end in .conf conf-dir=/etc/dnsmasq.d/,*.conf diff --git a/lighttpd.conf b/lighttpd.conf index 19e26a0f779f..02f710543568 100644 --- a/lighttpd.conf +++ b/lighttpd.conf @@ -1,7 +1,6 @@ server.modules = ( "mod_access", "mod_accesslog", - "mod_auth", "mod_expire", "mod_compress", "mod_redirect", @@ -26,7 +25,7 @@ mimetype.assign = ( fastcgi.server = ( ".php" => ( "localhost" => ( - "bin-path" => "/usr/bin/php-cgi -d open_basedir=/srv/http/pihole:/etc/pihole:/etc/hosts:/etc/hostname:/run/log/pihole:/run/pihole -d session.save_path=/run/pihole", + "bin-path" => "/usr/bin/php-cgi -d open_basedir=/srv/http/pihole:/run/log/pihole:/run/pihole:/etc/pihole:/etc/hosts:/etc/hostname:/proc/meminfo:/sys/class/hwmon:/sys/class/thermal -d session.save_path=/run/pihole", "socket" => "/tmp/php-fastcgi.sock", "broken-scriptfilename" => "enable", "max-procs" => 4, @@ -38,7 +37,7 @@ fastcgi.server = ( ) server.document-root = "/srv/http/pihole" -server.error-handler-404 = "index.html" +server.error-handler-404 = "/pihole/index.php" server.username = "http" server.groupname = "http" server.port = 80 @@ -50,6 +49,15 @@ static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) compress.cache-dir = "/var/cache/lighttpd/compress/" compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" ) +# If the URL starts with /admin, it is the Web interface +$HTTP["url"] =~ "^/admin/" { + # Create a response header for debugging using curl -I + setenv.add-response-header = ( + "X-Pi-hole" => "The Pi-hole Web interface is working!", + "X-Frame-Options" => "DENY" + ) +} + # Rewite js requests, must be out of $HTTP block due to bug #2526 url.rewrite = ( "^(?!/admin/).*\.js$" => "pihole/index.js" ) @@ -59,3 +67,5 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { 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/mimic_setupVars.conf.sh b/mimic_setupVars.conf.sh index 45ac7eb30ae8..62c8e4d2c782 100644 --- a/mimic_setupVars.conf.sh +++ b/mimic_setupVars.conf.sh @@ -2,13 +2,6 @@ setupVars=/etc/pihole/setupVars.conf -getDNSs() -{ - dnsmasqdns=(`grep server= /etc/pihole/configs/dnsmasq.main | awk -F "=" '{print $2}'`) - piholeDNS1=${dnsmasqdns[0]} - piholeDNS2=${dnsmasqdns[1]} -} - # official pihole basic-install.sh code here getIPv4stuff() { @@ -31,15 +24,12 @@ finalExports() { rm ${setupVars} fi { - echo "piholeInterface=${IPv4dev}" - echo "IPv4_address=${IPv4_address}" - echo "IPv6_address=${IPv6_address}" - echo "piholeDNS1=${piholeDNS1}" - echo "piholeDNS2=${piholeDNS2}" + echo "PIHOLE_INTERFACE=${IPv4dev}" + echo "IPV4_ADDRESS=${IPv4_address}" + echo "IPV6_ADDRESS=${IPv6_address}" }>> "${setupVars}" } -getDNSs getIPv4stuff getIPv6stuff finalExports diff --git a/pi-hole-server.install b/pi-hole-server.install index 5fe2f9688b9a..fc0a97edff2b 100644 --- a/pi-hole-server.install +++ b/pi-hole-server.install @@ -1,13 +1,11 @@ post_install() { echo -e "\e[1;33m==>\e[0m Please read configuration instructions at /usr/share/doc/pihole/configuration" - echo -e "\e[1;33m==>\e[0m \e[1;31mVer. 2.9.5-1\e[0m: dnsmasq and lighttpd conf files are changed" - echo -e "\e[1;33m==>\e[0m \e[1;31mVer. 2.9.5-4\e[0m: dnsmasq.include conf file is changed again" - echo -e "\e[1;33m==>\e[0m \e[1;31mVer. 2.9.5-5\e[0m: dnsmasq.main conf file is changed again and again -_-" - echo -e "\e[1;33m==>\e[0m \e[1;31mAttention\e[0m: dnsmasq config files used are now two and both mandatory." - echo -e "\e[1;33m==>\e[0m Pay attention to the name of the destination dnsmasq include config file" + echo -e "\e[1;33m==>\e[0m \e[1;31mVer. 2.11-1\e[0m: dnsmasq and lighttpd conf files are changed" + echo -e "\e[1;33m==>\e[0m Pay attention: this package now manage all dnsmasq.d include files" echo -e "\e[1;33m==>\e[0m Please follow configuration upgrade steps" echo -e "\e[1;33m==>\e[0m Neutrino emissions detected..." [ -e /proc/net/if_inet6 ] && touch /etc/pihole/.useIPv6 #this will be obsoleted soon + touch /etc/dnsmasq.d/02-pihole-dhcp.conf chown -R http.http /srv/http/pihole systemd-tmpfiles --create pi-hole.conf /opt/pihole/mimic_setupVars.conf.sh @@ -15,6 +13,8 @@ post_install() { _dnsmasq_address_setup /usr/bin/pihole updateGravity > /dev/null + /usr/bin/pihole -a setdns 8.8.8.8 8.8.4.4 > /dev/null + systemctl daemon-reload > /dev/null systemctl is-active pi-hole-logtruncate.timer 2>&1 >/dev/null || systemctl start pi-hole-logtruncate.timer systemctl is-active pi-hole-gravity.timer 2>&1 >/dev/null || systemctl start pi-hole-gravity.timer @@ -28,12 +28,13 @@ post_upgrade() { post_remove() { rm -R /etc/pihole/ - rm /run/log/pihole.log + [ -e /run/log/pihole.log ] && rm /run/log/pihole.log + [ -e /etc/dnsmasq.d/02-pihole-dhcp.conf ] && rm /etc/dnsmasq.d/02-pihole-dhcp.conf } _dnsmasq_address_setup() { # official code here . /etc/pihole/setupVars.conf - dnsmasq_pihole_01_location=/etc/pihole/configs/dnsmasq.include + dnsmasq_pihole_01_location=/etc/dnsmasq.d/02-pihole.conf if [[ -f /etc/hostname ]]; then hostname=$(</etc/hostname) @@ -42,15 +43,15 @@ _dnsmasq_address_setup() { # official code here fi #Replace IPv4 and IPv6 tokens in 01-pihole.conf for pi.hole resolution. - if [[ "${IPv4_address}" != "" ]]; then - tmp=${IPv4_address%/*} + if [[ "${IPV4_ADDRESS}" != "" ]]; then + tmp=${IPV4_ADDRESS%/*} sed -i "s/@IPv4@/$tmp/" ${dnsmasq_pihole_01_location} else sed -i '/^address=\/pi.hole\/@IPv4@/d' ${dnsmasq_pihole_01_location} sed -i '/^address=\/@HOSTNAME@\/@IPv4@/d' ${dnsmasq_pihole_01_location} fi - if [[ "${IPv6_address}" != "" ]]; then + if [[ "${IPV6_ADDRESS}" != "" ]]; then sed -i "s/@IPv6@/$IPv6_address/" ${dnsmasq_pihole_01_location} else sed -i '/^address=\/pi.hole\/@IPv6@/d' ${dnsmasq_pihole_01_location} |