From b79ff05e29a7a007a6d607ccdd0f679a9706a5a3 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Fri, 27 Jul 2018 15:21:25 -0700 Subject: [PATCH] Move template files to own subdir. Include pihole-FTL.conf in templates. Signed-off-by: Dan Schaper --- advanced/{ => Templates}/logrotate | 0 advanced/Templates/pihole-FTL.conf | 78 +++++++++++++++++++++ advanced/{ => Templates}/pihole-FTL.service | 0 advanced/{ => Templates}/pihole.cron | 0 advanced/{ => Templates}/pihole.sudo | 0 automated install/basic-install.sh | 13 ++-- 6 files changed, 87 insertions(+), 4 deletions(-) rename advanced/{ => Templates}/logrotate (100%) create mode 100644 advanced/Templates/pihole-FTL.conf rename advanced/{ => Templates}/pihole-FTL.service (100%) rename advanced/{ => Templates}/pihole.cron (100%) rename advanced/{ => Templates}/pihole.sudo (100%) diff --git a/advanced/logrotate b/advanced/Templates/logrotate similarity index 100% rename from advanced/logrotate rename to advanced/Templates/logrotate diff --git a/advanced/Templates/pihole-FTL.conf b/advanced/Templates/pihole-FTL.conf new file mode 100644 index 00000000..f855cf19 --- /dev/null +++ b/advanced/Templates/pihole-FTL.conf @@ -0,0 +1,78 @@ +## Listen only for local socket connections or permit all connections +## Options: localonly, all + +#SOCKET_LISTENING=localonly + +## Display all queries? Set to no to hide query display +## Options: yes, no + +#QUERY_DISPLAY=yes + +## Allow FTL to analyze AAAA queries from pihole.log? +## Options: yes, no + +#AAAA_QUERY_ANALYSIS=yes + +## Should FTL try to resolve IPv6 addresses to host names? +## Options: yes, no + +#RESOLVE_IPV6=yes + +## Should FTL try to resolve IPv4 addresses to host names? +## Options: yes, no + +#RESOLVE_IPV4=yes + +## How long should queries be stored in the database [days]? +## Setting this to 0 disables the database +## See: https://docs.pi-hole.net/ftldns/database/ +## Options: number of days + +#MAXDBDAYS=365 + +## How often do we store queries in FTL's database [minutes]? +## See: https://docs.pi-hole.net/ftldns/database/ +## Options: number of minutes + +#DBINTERVAL=1.0 + +## Specify path and filename of FTL's SQLite3 long-term database. +## Setting this to DBFILE= disables the database altogether +## See: https://docs.pi-hole.net/ftldns/database/ +## Option: path to db file + +#DBFILE=/etc/pihole/pihole-FTL.db + +## Up to how many hours of queries should be imported from the database and logs [hours]? +## Maximum is 744 (31 days) +## Options: number of days + +#MAXLOGAGE=24.0 + +## On which port should FTL be listening? +## Options: tcp port + +#FTLPORT=4711 + +## Which privacy level is used? +## See: https://docs.pi-hole.net/ftldns/privacylevels/ +## Options: 0, 1, 2, 3 + +#PRIVACYLEVEL=0 + +## Should FTL ignore queries coming from the local machine? +## Options: yes, no + +#IGNORE_LOCALHOST=no + +## How should FTL reply to blocked queries? +## See: https://docs.pi-hole.net/ftldns/blockingmode/ +## Options: NULL, IP-AAAA-NODATA, IP, NXDOMAIN + +#BLOCKINGMODE=NULL + +## Controls if FTLDNS should print extended details about regex matching into pihole-FTL.log. +## See: https://docs.pi-hole.net/ftldns/regex/overview/ +## Options: true, false + +#REGEX_DEBUGMODE=false diff --git a/advanced/pihole-FTL.service b/advanced/Templates/pihole-FTL.service similarity index 100% rename from advanced/pihole-FTL.service rename to advanced/Templates/pihole-FTL.service diff --git a/advanced/pihole.cron b/advanced/Templates/pihole.cron similarity index 100% rename from advanced/pihole.cron rename to advanced/Templates/pihole.cron diff --git a/advanced/pihole.sudo b/advanced/Templates/pihole.sudo similarity index 100% rename from advanced/pihole.sudo rename to advanced/Templates/pihole.sudo diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 79e8e1ae..45954693 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1553,7 +1553,7 @@ installPiholeWeb() { # Make the .d directory if it doesn't exist mkdir -p /etc/sudoers.d/ # and copy in the pihole sudoers file - cp ${PI_HOLE_LOCAL_REPO}/advanced/pihole.sudo /etc/sudoers.d/pihole + cp ${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole.sudo /etc/sudoers.d/pihole # Add lighttpd user (OS dependent) to sudoers file echo "${LIGHTTPD_USER} ALL=NOPASSWD: /usr/local/bin/pihole" >> /etc/sudoers.d/pihole @@ -1575,7 +1575,7 @@ installCron() { echo "" echo -ne " ${INFO} ${str}..." # Copy the cron file over from the local repo - cp ${PI_HOLE_LOCAL_REPO}/advanced/pihole.cron /etc/cron.d/pihole + cp ${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole.cron /etc/cron.d/pihole # Randomize gravity update time sed -i "s/59 1 /$((1 + RANDOM % 58)) $((3 + RANDOM % 2))/" /etc/cron.d/pihole # Randomize update checker time @@ -1699,7 +1699,7 @@ installLogrotate() { echo "" echo -ne " ${INFO} ${str}..." # Copy the file over from the local repo - cp ${PI_HOLE_LOCAL_REPO}/advanced/logrotate /etc/pihole/logrotate + cp ${PI_HOLE_LOCAL_REPO}/advanced/Templates/logrotate /etc/pihole/logrotate # Different operating systems have different user / group # settings for logrotate that makes it impossible to create # a static logrotate file that will work with e.g. @@ -2023,7 +2023,12 @@ FTLinstall() { pushd "$(mktemp -d)" > /dev/null || { echo "Unable to make temporary directory for FTL binary download"; return 1; } # Always replace pihole-FTL.service - install -T -m 0755 "${PI_HOLE_LOCAL_REPO}/advanced/pihole-FTL.service" "/etc/init.d/pihole-FTL" + install -T -m 0755 "${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole-FTL.service" "/etc/init.d/pihole-FTL" + + # Install template if it does not exist + if [[ ! -f /etc/pihole/pihole-FTL.conf ]]; then + install -o "${USER}" -Dm644 -t "${PI_HOLE_INSTALL_DIR}/advanced/Templates/pihole-FTL.conf" "/etc/pihole/pihole-FTL.conf" + fi local ftlBranch local url