mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-26 01:00:33 +00:00
Move template files to own subdir. Include pihole-FTL.conf in templates.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
32cf94fc74
commit
b79ff05e29
6 changed files with 87 additions and 4 deletions
21
advanced/Templates/logrotate
Normal file
21
advanced/Templates/logrotate
Normal file
|
@ -0,0 +1,21 @@
|
|||
/var/log/pihole.log {
|
||||
# su #
|
||||
daily
|
||||
copytruncate
|
||||
rotate 5
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
nomail
|
||||
}
|
||||
|
||||
/var/log/pihole-FTL.log {
|
||||
# su #
|
||||
weekly
|
||||
copytruncate
|
||||
rotate 3
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
nomail
|
||||
}
|
78
advanced/Templates/pihole-FTL.conf
Normal file
78
advanced/Templates/pihole-FTL.conf
Normal file
|
@ -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
|
101
advanced/Templates/pihole-FTL.service
Normal file
101
advanced/Templates/pihole-FTL.service
Normal file
|
@ -0,0 +1,101 @@
|
|||
#!/bin/bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: pihole-FTL
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: pihole-FTL daemon
|
||||
# Description: Enable service provided by pihole-FTL daemon
|
||||
### END INIT INFO
|
||||
|
||||
FTLUSER=pihole
|
||||
PIDFILE=/var/run/pihole-FTL.pid
|
||||
|
||||
get_pid() {
|
||||
pidof "pihole-FTL"
|
||||
}
|
||||
|
||||
is_running() {
|
||||
ps "$(get_pid)" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
# Start the service
|
||||
start() {
|
||||
if is_running; then
|
||||
echo "pihole-FTL is already running"
|
||||
else
|
||||
touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
|
||||
mkdir -p /var/run/pihole
|
||||
mkdir -p /var/log/pihole
|
||||
chown pihole:pihole /var/run/pihole /var/log/pihole
|
||||
rm /var/run/pihole/FTL.sock 2> /dev/null
|
||||
chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port
|
||||
chown pihole:pihole /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log
|
||||
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
|
||||
setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN+eip "$(which pihole-FTL)"
|
||||
echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.piholeFTL
|
||||
su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER"
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
# Stop the service
|
||||
stop() {
|
||||
if is_running; then
|
||||
/sbin/resolvconf -d lo.piholeFTL
|
||||
kill "$(get_pid)"
|
||||
for i in {1..5}; do
|
||||
if ! is_running; then
|
||||
break
|
||||
fi
|
||||
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
|
||||
if is_running; then
|
||||
echo "Not stopped; may still be shutting down or shutdown may have failed, killing now"
|
||||
kill -9 "$(get_pid)"
|
||||
exit 1
|
||||
else
|
||||
echo "Stopped"
|
||||
fi
|
||||
else
|
||||
echo "Not running"
|
||||
fi
|
||||
echo
|
||||
}
|
||||
|
||||
# Indicate the service status
|
||||
status() {
|
||||
if is_running; then
|
||||
echo "[ ok ] pihole-FTL is running"
|
||||
exit 0
|
||||
else
|
||||
echo "[ ] pihole-FTL is not running"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
### main logic ###
|
||||
case "$1" in
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
start|restart|reload|condrestart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|reload|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
34
advanced/Templates/pihole.cron
Normal file
34
advanced/Templates/pihole.cron
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Updates ad sources every week
|
||||
#
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
#
|
||||
#
|
||||
#
|
||||
# This file is under source-control of the Pi-hole installation and update
|
||||
# scripts, any changes made to this file will be overwritten when the softare
|
||||
# is updated or re-installed. Please make any changes to the appropriate crontab
|
||||
# or other cron file snippets.
|
||||
|
||||
# Pi-hole: Update the ad sources once a week on Sunday at a random time in the
|
||||
# early morning. Download any updates from the adlists
|
||||
59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity
|
||||
|
||||
# Pi-hole: Flush the log daily at 00:00
|
||||
# The flush script will use logrotate if available
|
||||
# parameter "once": logrotate only once (default is twice)
|
||||
# parameter "quiet": don't print messages
|
||||
00 00 * * * root PATH="$PATH:/usr/local/bin/" pihole flush once quiet
|
||||
|
||||
@reboot root /usr/sbin/logrotate /etc/pihole/logrotate
|
||||
|
||||
# Pi-hole: Grab local version and branch every 10 minutes
|
||||
*/10 * * * * root PATH="$PATH:/usr/local/bin/" pihole updatechecker local
|
||||
|
||||
# Pi-hole: Grab remote version every 24 hours
|
||||
59 17 * * * root PATH="$PATH:/usr/local/bin/" pihole updatechecker remote
|
||||
@reboot root PATH="$PATH:/usr/local/bin/" pihole updatechecker remote reboot
|
9
advanced/Templates/pihole.sudo
Normal file
9
advanced/Templates/pihole.sudo
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Allows the WebUI to use Pi-hole commands
|
||||
#
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
#
|
Loading…
Add table
Add a link
Reference in a new issue