summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authormax.bra2016-01-13 13:51:47 +0100
committermax.bra2016-01-13 13:51:47 +0100
commit63917ca5abb9e956c85aa5daad638f2068f06782 (patch)
treeb9ca130e851650d3bd25b9d7edd4d1d45abe1c1d
downloadaur-63917ca5abb9e956c85aa5daad638f2068f06782.tar.gz
Initial import. Version 2.2
-rw-r--r--.SRCINFO42
-rw-r--r--PKGBUILD70
-rw-r--r--blacklist.txt1
-rw-r--r--configuration65
-rw-r--r--dnsmasq.complete50
-rw-r--r--dnsmasq.include5
-rw-r--r--lighttpd.conf68
-rw-r--r--pi-hole-daily.cron3
-rw-r--r--pi-hole-server.install20
-rw-r--r--pi-hole-weekly.cron3
-rw-r--r--pi-hole.tmpfile1
-rw-r--r--whitelist.txt1
12 files changed, 329 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..48c488903542
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,42 @@
+# Generated by mksrcinfo v8
+# Wed Jan 13 12:50:39 UTC 2016
+pkgbase = pi-hole-server
+ pkgdesc = The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server.
+ pkgver = 2.2
+ pkgrel = 1
+ url = https://github.com/jacobsalmela/pi-hole
+ install = pi-hole-server.install
+ arch = any
+ license = GPL2
+ depends = cron
+ depends = dnsmasq
+ depends = lighttpd
+ depends = php-cgi
+ conflicts = pi-hole-server
+ source = https://github.com/jacobsalmela/pi-hole/archive/v2.2.tar.gz
+ source = https://github.com/jacobsalmela/AdminLTE/archive/master.zip
+ source = https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html
+ source = configuration
+ source = dnsmasq.include
+ source = dnsmasq.complete
+ source = lighttpd.conf
+ source = pi-hole.tmpfile
+ source = pi-hole-daily.cron
+ source = pi-hole-weekly.cron
+ source = whitelist.txt
+ source = blacklist.txt
+ md5sums = 8387d55bc37b661827ad614701157b19
+ md5sums = 807c8cd98cfba066dac9b16ff0e08c8e
+ md5sums = 58d5c6d200e4bdf990e04d7dbfc3cf57
+ md5sums = c01b982f3ef13c5fe140cc242a3b627b
+ md5sums = fd607f890103e97e480d814a5dfbee5b
+ md5sums = 06bb49cf66cc1db8be5e476a54b1e933
+ md5sums = 4f5f6076d358c1375525e6ab481dfb7d
+ md5sums = 564f47c5cfab0a1b7b010ddbcf8e3b84
+ md5sums = 8f99cfaae99f1542788dfbd7a39b5603
+ md5sums = a2d0530954e8eb19592f686e29c24c45
+ md5sums = 534de24fb56acfd3b451cf4b1b382218
+ md5sums = 534de24fb56acfd3b451cf4b1b382218
+
+pkgname = pi-hole-server
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..72c52c49f420
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,70 @@
+# Maintainer: max.bra <max dot bra at alice dot it>
+
+pkgname=pi-hole-server
+_pkgname=pi-hole
+pkgver=2.2
+pkgrel=1
+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/jacobsalmela/pi-hole"
+depends=('cron' 'dnsmasq' 'lighttpd' 'php-cgi')
+conflicts=('pi-hole-server')
+install=$pkgname.install
+
+source=(https://github.com/jacobsalmela/$_pkgname/archive/v$pkgver.tar.gz
+ https://github.com/jacobsalmela/AdminLTE/archive/master.zip
+ https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html
+ configuration
+ dnsmasq.include
+ dnsmasq.complete
+ lighttpd.conf
+ pi-hole.tmpfile
+ $_pkgname-daily.cron
+ $_pkgname-weekly.cron
+ whitelist.txt
+ blacklist.txt)
+
+md5sums=('8387d55bc37b661827ad614701157b19'
+ '807c8cd98cfba066dac9b16ff0e08c8e'
+ '58d5c6d200e4bdf990e04d7dbfc3cf57'
+ 'c01b982f3ef13c5fe140cc242a3b627b'
+ 'fd607f890103e97e480d814a5dfbee5b'
+ '06bb49cf66cc1db8be5e476a54b1e933'
+ '4f5f6076d358c1375525e6ab481dfb7d'
+ '564f47c5cfab0a1b7b010ddbcf8e3b84'
+ '8f99cfaae99f1542788dfbd7a39b5603'
+ 'a2d0530954e8eb19592f686e29c24c45'
+ '534de24fb56acfd3b451cf4b1b382218'
+ '534de24fb56acfd3b451cf4b1b382218')
+
+prepare() {
+ # modify service management
+ sed -i 's|^ sudo service dnsmasq start| systemctl start dnsmasq|' "$srcdir"/$_pkgname-$pkgver/gravity.sh
+
+ # change log location in admin php interface
+ sed -i 's|/var/log/pihole.log|/run/log/pihole.log|' "$srcdir"/AdminLTE-master/index.php
+ sed -i 's|/var/log/pihole.log|/run/log/pihole.log|' "$srcdir"/AdminLTE-master/api.php
+}
+
+package() {
+ cd "$srcdir"
+ install -Dm755 ./$_pkgname-$pkgver/gravity.sh "$pkgdir"/usr/bin/gravity.sh || return 1
+ install -Dm755 $_pkgname-daily.cron "$pkgdir"/etc/cron.daily/$_pkgname-daily || return 1
+ install -Dm755 $_pkgname-weekly.cron "$pkgdir"/etc/cron.weekly/$_pkgname-weekly || return 1
+ install -Dm644 pi-hole.tmpfile "$pkgdir"/etc/tmpfiles.d/pi-hole.conf || return 1
+
+ install -dm777 "$pkgdir"/etc/pihole
+ install -dm755 "$pkgdir"/etc/pihole/configs
+ install -Dm644 whitelist.txt "$pkgdir"/etc/pihole/whitelist.txt || return 1
+ install -Dm644 blacklist.txt "$pkgdir"/etc/pihole/blacklist.txt || return 1
+ install -Dm644 dnsmasq.complete "$pkgdir"/etc/pihole/configs/dnsmasq.complete || return 1
+ install -Dm644 dnsmasq.include "$pkgdir"/etc/pihole/configs/dnsmasq.include || 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 index.html "$pkgdir"/srv/http/pihole/index.html || return 1
+ cp -dpr --no-preserve=ownership AdminLTE-master/* "$pkgdir"/srv/http/pihole/admin/
+}
+
diff --git a/blacklist.txt b/blacklist.txt
new file mode 100644
index 000000000000..ba4561648acb
--- /dev/null
+++ b/blacklist.txt
@@ -0,0 +1 @@
+# one domain per line
diff --git a/configuration b/configuration
new file mode 100644
index 000000000000..98273143bcc8
--- /dev/null
+++ b/configuration
@@ -0,0 +1,65 @@
+Pi-hole Archlinux configuration instructions
+Server version
+rev. 0.1
+
+Pi-Hole Web server admin page: http://<server-ip>/admin
+
+
+Instructions below assume ArchLinux default system config files are untouched or modified only by removing comments (#)
+
+
+
+*** 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/pihole.conf
+
+2) 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
+
+*** end if
+
+
+
+*** if you installed dnsmasq with this package for the first time
+
+3) backup original dnsmasq config file and copy pi-hole one
+
+# cp /etc/dnsmasq.conf /etc/dnsmasq.orig
+# cp /etc/pihole/configs/dnsmasq.complete /etc/dnsmasq.conf
+
+*** end if
+
+
+
+4) 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
+
+# systemctl reenable dnsmasq.service
+# systemctl restart dnsmasq.service
+
+6) enable and start lighttpd service
+
+# systemctl enable lighttpd.service
+# systemctl start lighttpd.service
+
+7) FUNDAMENTAL: point dns resolution of your lan clients to this machine
+
+
+UNINSTALL steps
+
+# systemctl stop dnsmasq.service
+# 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.complete b/dnsmasq.complete
new file mode 100644
index 000000000000..71feaf8b222d
--- /dev/null
+++ b/dnsmasq.complete
@@ -0,0 +1,50 @@
+# If you want dnsmasq to read another file, as well as /etc/hosts, use
+# this.
+addn-hosts=/etc/pihole/gravity.list
+
+# 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.
+#interface=eth0
+# Or which to listen on by address (remember to include 127.0.0.1 if
+# you use this.)
+#listen-address=127.0.0.1
+
+# Set the cachesize here.
+cache-size=10000
+
+# For debugging purposes, log each DNS query as it passes through
+# dnsmasq.
+log-queries
+log-facility=/run/log/pihole.log
+
+# 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
+
+# This allows it to continue functioning without being blocked by syslog, and allows syslog to use dnsmasq for DNS queries without risking deadlock
+log-async
diff --git a/dnsmasq.include b/dnsmasq.include
new file mode 100644
index 000000000000..4fb1c1a8984f
--- /dev/null
+++ b/dnsmasq.include
@@ -0,0 +1,5 @@
+addn-hosts=/etc/pihole/gravity.list
+cache-size=10000
+log-queries
+log-facility=/run/log/pihole.log
+log-async
diff --git a/lighttpd.conf b/lighttpd.conf
new file mode 100644
index 000000000000..98d96fbe8e46
--- /dev/null
+++ b/lighttpd.conf
@@ -0,0 +1,68 @@
+server.modules = (
+ "mod_access",
+ "mod_accesslog",
+ "mod_expire",
+ "mod_compress",
+ "mod_redirect",
+ "mod_setenv",
+ "mod_rewrite",
+ "mod_fastcgi"
+)
+
+mimetype.assign = (
+ ".html" => "text/html",
+ ".txt" => "text/plain",
+ ".css" => "text/css",
+ ".js" => "application/x-javascript",
+ ".jpg" => "image/jpeg",
+ ".jpeg" => "image/jpeg",
+ ".gif" => "image/gif",
+ ".png" => "image/png",
+ "" => "application/octet-stream"
+ )
+
+fastcgi.server = (
+ ".php" => (
+ "localhost" => (
+ "bin-path" => "/usr/bin/php-cgi",
+ "socket" => "/tmp/php-fastcgi.sock",
+ "broken-scriptfilename" => "enable",
+ "max-procs" => 4,
+ "bin-environment" => (
+ "PHP_FCGI_CHILDREN" => "1" # default value
+ )
+ )
+ )
+)
+
+server.document-root = "/srv/http/pihole"
+server.error-handler-404 = "index.html"
+server.username = "http"
+server.groupname = "http"
+server.port = 80
+
+index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
+url.access-deny = ( "~", ".inc" )
+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!" )
+}
+
+# If the URL does not start with /admin, then it is a query for an ad domain
+$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." )
+
+ # Set the cache to 1 day for better performance
+ expire.url = ("" => "access plus 1 days")
+
+ # Send the query into the black hole
+ url.rewrite = (".*" => "index.html" )
+}
+
diff --git a/pi-hole-daily.cron b/pi-hole-daily.cron
new file mode 100644
index 000000000000..1e995ded7789
--- /dev/null
+++ b/pi-hole-daily.cron
@@ -0,0 +1,3 @@
+#!/bin/bash
+truncate -s 0 /run/log/pihole.log > /dev/null
+
diff --git a/pi-hole-server.install b/pi-hole-server.install
new file mode 100644
index 000000000000..910aa0c435ad
--- /dev/null
+++ b/pi-hole-server.install
@@ -0,0 +1,20 @@
+post_install() {
+ cat <<- EOF
+ ==> please read configuration instructions at /usr/share/doc/pihole/configuration
+ ==> first install/update run...
+EOF
+ chown -R http.http /srv/http/pihole
+ touch /run/log/pihole.log
+ chmod 644 /run/log/pihole.log
+ chown dnsmasq.root /run/log/pihole.log
+ /usr/bin/gravity.sh > /dev/null
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ rm -R /etc/pihole/
+ rm /run/log/pihole.log
+}
diff --git a/pi-hole-weekly.cron b/pi-hole-weekly.cron
new file mode 100644
index 000000000000..d909b7ffccd1
--- /dev/null
+++ b/pi-hole-weekly.cron
@@ -0,0 +1,3 @@
+#!/bin/bash
+/usr/bin/gravity.sh > /dev/null
+
diff --git a/pi-hole.tmpfile b/pi-hole.tmpfile
new file mode 100644
index 000000000000..25a7fb6af1a9
--- /dev/null
+++ b/pi-hole.tmpfile
@@ -0,0 +1 @@
+f /run/log/pihole.log 0644 dnsmasq root - -
diff --git a/whitelist.txt b/whitelist.txt
new file mode 100644
index 000000000000..ba4561648acb
--- /dev/null
+++ b/whitelist.txt
@@ -0,0 +1 @@
+# one domain per line