Commit graph

2197 commits

Author SHA1 Message Date
Adam Warner
cacc934300
Force nodateext so rotated log names don't depend on invocation path
If the system's /etc/logrotate.conf has dateext enabled (the upstream
default, carried by most distros), our stanzas would inherit it when
the system's scheduled logrotate reads them via that file - but our
own forced runs invoke /etc/logrotate.d/pihole directly, bypassing
logrotate.conf entirely, so they'd still use numeric suffixes. Same
config, two different rotated filenames depending on who rotated it
first.

Set nodateext explicitly in each of our stanzas (scoped to just our
own blocks, so it can't leak into other packages' logrotate.d entries)
to keep this deterministic. Numeric suffixes also match what
piholeLogFlush.sh's manual flush path already assumes (it looks for
logfile.1 specifically).

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-07-07 14:34:01 +01:00
Adam Warner
340b37ab51
Stop double-rotating logs now that pihole is in /etc/logrotate.d
Our config moved into /etc/logrotate.d/pihole a while back, so the
system's own scheduled logrotate now picks it up too. Our nightly and
@reboot forced runs were still using a private state file though, so
the system's run and ours each rotated the same logs independently,
unaware of each other.

Drop the private state file and use logrotate's default one instead,
so both sides agree on what's already been rotated. Also clean up the
now-stale /etc/pihole/logrotate and private state file left behind by
older installs.

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-07-07 13:40:38 +01:00
darkexplosiveqwx
cd29a71d89
avoid copytruncate in logrotate
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-07-06 21:19:21 +02:00
Christian König
88b47a280a
Use /etc/logrotate.d/pihole for logrotate file instead of /etc/pihole/logrotate
Signed-off-by: Christian König <github@yubiuser.dev>
2026-05-13 08:38:31 +02:00
Adam Warner
b4af3f3ead
We can also hardcode the PID file location in utils.sh
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-04-25 10:51:55 +01:00
Adam Warner
b065830df0
Merge commit from fork
hardcode PID file path in service hooks
2026-04-24 22:10:31 +01:00
darkexplosiveqwx
c65b63b10b
Merge branch 'development' into logrotate
Conflicts resolved: automated install/basic-install.sh

Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-04-20 17:15:49 +02:00
darkexplosiveqwx
145b861552
Clarify comment in pihole.cron
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-04-20 17:14:38 +02:00
Adam Warner
a3ed471d05
security: hardcode PID file path in service hooks
The pihole-FTL-prestart.sh and pihole-FTL-poststop.sh scripts are
executed as root by systemd (via the '+' prefix). Both previously read
the PID file path from pihole.toml via getFTLConfigValue — a file the
pihole user can write to directly. An attacker with pihole-user access
could set files.pid to an arbitrary path and trigger a service restart
to cause root to delete then recreate any file on the system, enabling
local privilege escalation.

Fix by inlining the hardcoded path /run/pihole-FTL.pid directly in
each hook, removing any dependency on user-controlled config. The same
hardening is applied to the SysV init script for consistency.

See: GHSA-6w8x-p785-6pm4

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-04-19 16:42:58 +01:00
Adam Warner
fb8afcd22a
FTL can create its logfiles on its own (#6601) 2026-04-18 21:26:53 +01:00
yubiuser
dca5d882f6
Apply suggestions from code review
Co-authored-by: Adam Warner <github@adamwarner.co.uk>
Signed-off-by: yubiuser <github@yubiuser.dev>
2026-04-17 17:13:01 +02:00
Christian König
ed3b6cb776
Set versions in /etc/pihole/versions to null if script fails
Signed-off-by: Christian König <github@yubiuser.dev>
2026-04-17 17:13:01 +02:00
Christian König
f424dd028b
FTL can create its logfiles on its own
Signed-off-by: Christian König <github@yubiuser.dev>
2026-04-14 10:06:48 +02:00
darkexplosiveqwx
1c7154d5da
fix comment
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-04-10 20:49:58 +02:00
darkexplosiveqwx
f88e3e2893
Remove reference to /usr/local/bin/COL_TABLE
This was most likely added accidentally (during a refactor in 2017)
Both the 2017 and current version use /opt/pihole/COL_TABLE, as defined earlier and sourced earlier in the code.
Remove PIHOLE_COLTABLE_FILE from REQUIRED_FILES since /usr/local/bin as well as /opt/pihole are never checked

Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-04-10 20:49:54 +02:00
Adam Warner
1cb17cdcf9
Wipe version file before creating a new one (#6538) 2026-04-03 23:15:33 +01:00
Adam Warner
3c3952a60e
Merge commit from fork
Refactor version loading to enhance security and prevent shell injection
2026-04-03 16:53:17 +01:00
Adam Warner
2aa38f4fd7
Return 0 instead of 1 to make compatibile with set -e
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-03-24 18:43:32 +00:00
Christian König
2f8fa724f2
Prevent exiting due to set -e
Signed-off-by: Christian König <github@yubiuser.dev>
2026-03-22 10:01:11 +01:00
Christian König
300cdb71b8
Fix return status capture of FTL check_download exists
Signed-off-by: Christian König <github@yubiuser.dev>
2026-03-22 09:49:54 +01:00
Adam Warner
e001c87479
Refactor version loading to enhance security and prevent shell injection
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-03-18 21:41:36 +00:00
RD WebDesign
36601eef3a
Remove readonly from piholeNetworkFlush.sh to avoid error message
This is a quick fix to avoid the error when api.sh tries to set the
variable again.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-03-01 17:29:19 -03:00
Christian König
f28233729c
Remove additional ':' from debug log system time output
Signed-off-by: Christian König <github@yubiuser.dev>
2026-02-24 08:51:07 +01:00
Christian König
4125bcccdc
Files should be created before calling addOrEditKeyValPair
Signed-off-by: Christian König <github@yubiuser.dev>
2026-02-18 09:25:10 +01:00
Christian König
ac37014628
Truncate version file instead of removing and creating freshly
Signed-off-by: Christian König <github@yubiuser.dev>
2026-02-18 09:22:11 +01:00
Christian König
d765ce768f
Wipe version file before creating a new one
Signed-off-by: yubiuser <github@yubiuser.dev>
2026-02-16 20:11:17 +01:00
darkexplosiveqwx
55a7a54313
Run weekly gravityUpdate as pihole
Gravity is ran as pihole when invoked via FTL

Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-01-29 21:22:50 +01:00
darkexplosiveqwx
32b37668cf
add logrotate to DEB and RPM dependencies
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-01-29 21:22:50 +01:00
Dan Schaper
7442623f2f
Debug log - Add colors to gravity tables (#6485) 2025-12-04 12:52:07 -07:00
RD WebDesign
1f4ed9b518
Replace some strings with their colored equivalents
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-11-30 18:43:40 -03:00
RD WebDesign
95ae51bbdb
Use more specific strings on the tables to match only desired text
- use `--no---` and `--yes---` to make sure the strings won't match user
comments or parts of domains
- also use `-ALLOW-` and `-BLOCK-`

Also reduce the domain column to 90 characters

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-11-30 18:42:02 -03:00
RD WebDesign
247b0c506b
Remove custom FTL FirewallD zone checks from debug log
Removed checks for custom FTL FirewallD zone in piholeDebug.sh.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-11-26 23:46:43 -03:00
Adam Warner
d4db2dca22
Improve gravity tables presentation on the debug log (#6460) 2025-11-25 18:59:04 +00:00
RD WebDesign
8c6bb3f8da
Use text colums instead of number codes on gravity tables
- Domains table ("type" column): replace 0, 1, 2 and 3 with
  "exact-allow", "exact-deny", "regex-allow" and "regex-deny"
- All tables: use yes/no for "enabled" columns

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-11-20 16:46:38 -03:00
RD WebDesign
987a59f7e5
Show "Block" and "Allow" instead of 0 and 1
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-11-19 16:35:39 -03:00
darkexplosiveqwx
1dc8bfc950
Use port from dns.port in piholeDebug.sh
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2025-11-16 16:35:05 +01:00
yubiuser
1110f26329
debug - speed up processing and display of file contents and services (#6469) 2025-11-12 22:23:49 +01:00
Rob Gill
bf41c3dded
debug - speed up processing and display of file contents and services
Use bash-internal globs and parameter expasion in preference to
assignment from output of ls or basename per file/directory.

When displaying file contents, call sed once and preprocesses the entire
file (eg pihole.toml), rather than spawning a new sed process for every
line of the file.

When checking services, call awk once to extract all data for each ip:port
pair, rather than three times.

Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2025-11-10 14:33:07 +10:00
yubiuser
3d25d20e86
systemd service - don't use deprecated PermissionsStartOnly (#6465) 2025-11-09 10:44:21 +01:00
Rob Gill
7452c95080
systemd service - don't use deprecated PermissionsStartOnly
- elevate Prestart and Poststop script permissions using "+" prefix instead,
as per https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#Command%20lines

( PermissionsStartOnly was deprecated in systemd 241 and no longer appears in
documentation since 2018 https://github.com/systemd/systemd/pull/10802 )

Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2025-11-08 15:35:10 +10:00
RD WebDesign
40aa986af1
Add list "type" (block/allow) to the debug log table
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-11-03 17:39:36 -03:00
Sparronator9999
4ff250edac
Fix libcap capabilities not being granted on OpenRC distros
Created on behalf of @mgziminsky - see this issue comment: https://github.com/pi-hole/pi-hole/issues/6454#issuecomment-3476576177

Signed-off-by: Sparronator9999 <86388887+Sparronator9999@users.noreply.github.com>
2025-11-02 07:29:20 +11:00
Adam Warner
1d6b3cd894
Add log file path variables and ensure log files are created if missing (#6441) 2025-10-28 13:40:00 +00:00
Yannick7777
72e3699265
Add log file path variables and ensure log files are created if missing
Signed-off-by: Yannick7777 <admin@eyer.life>
2025-10-26 15:19:56 +01:00
casperklein
1818e7e59e
Ensure 'versions' file exist on first start
Signed-off-by: casperklein <casperklein@users.noreply.github.com>
2025-10-26 12:05:13 +01:00
casperklein
9e8e360591
add missing local variable
Signed-off-by: casperklein <casperklein@users.noreply.github.com>
2025-10-15 04:37:19 +02:00
Dominik
106b999054
Rename views, upgrade gravity database and bump gravity databae version (#6386) 2025-10-05 20:33:30 +02:00
Michael Ziminsky (Z)
4bf67a3c79
Alpine: Add some additional dependencies and minor script fixes
Signed-off-by: Michael Ziminsky (Z) <mgziminsky@users.noreply.github.com>
2025-08-16 21:47:55 +00:00
Michael Ziminsky (Z)
0db48383ae
Add support for alpine
Signed-off-by: Michael Ziminsky (Z) <mgziminsky@users.noreply.github.com>
2025-08-16 21:47:54 +00:00
DL6ER
9e258e7005
Rename views, upgrade gravity database and bump gravity databae version
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-08-15 19:39:21 +02:00