Commit graph

7254 commits

Author SHA1 Message Date
Adam Warner
e05dc3f139
fix: never run updatecheck.sh as root
updatecheck.sh writes the versions file into /etc/pihole, which is owned
by the unprivileged pihole user. When it ran as root (the installer,
`pihole -up`, `pihole checkout`, `sudo pihole updatechecker`, the Docker
start-up check, ...) the pihole user could watch the directory, swap the
script's temporary file for a symlink and have root chmod/chown/append
to whatever it pointed at. Reproduced: a root-only file ended up owned by
pihole.

- When started as root, hand over to the pihole user (`su`) and exit
  with its result. This covers every caller, including future ones, and
  the pihole user can only damage what it already owns. The "reboot"
  argument is forwarded.
- Drop the chown of the temporary file; it is no longer needed and was
  the dangerous part.
- Use `mv -fT` so that a symlink to a directory at the target path is
  replaced rather than having the temporary file moved into the
  directory.

Tests (fresh install): started as root the script must do its work as
the pihole user and write a pihole-owned 0644 versions file; a symlink
(to a file or to a directory) at the target path must be replaced rather
than followed.

Note: running as the pihole user needs git to trust the root-owned Core
and Web repositories (safe.directory). The installer sets that up (see
the following commit); other installers of this script, such as the
Docker image, need the equivalent.

Reported-by: Keith Linneman (LinnemanLabs)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-10-15 19:48:02 +01:00
Adam Warner
a360b14b61
fix: run the permission fix-up in prestart as the pihole user
pihole-FTL-prestart.sh runs as root (ExecStartPre=+) and, right after
chown-ing /etc/pihole and /var/log/pihole to the pihole user, walks them
with `find ... -exec chmod`. find only builds a list of paths and chmod
acts on them afterwards, so the pihole user can swap a directory or file
for a symlink in between; root's chmod then follows it and changes the
permissions of a file pihole has no business touching (e.g. 0755 on
/etc/shadow makes it world-readable).

Reproduced against the stock script: with a pihole-owned loop flipping a
directory name between "real directory" and "symlink to a root-only
file", the file went from 0600 to 0755 within a handful of restarts.

Run the three find calls as the pihole user instead. It owns everything
below those directories, and a symlink pointing anywhere else only yields
a permission error. Failure stays non-fatal so it can never stop FTL from
starting.

Add a deterministic test: with the script's chown stubbed out, a
root-owned probe stays untouched only if the fix-up does not run as root.

This is independent of the other changes in this series and applies to
the same pre-existing code on master/development, so it can be
cherry-picked on its own.

Reported-by: Keith Linneman (LinnemanLabs)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-10-15 19:48:02 +01:00
Adam Warner
85de82dd2b
Address review feedback on GHSA-xch2-4qxw-g5vj fix
- updatecheck.sh: reword the publish comment to refer to mv/rename(2) and
  place it directly above the mv call; use chmod 0644
- pihole-FTL-prestart.sh: replace the loop/rm/no-op redirect with a single
  documented su call using touch and chmod

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-10-15 19:48:01 +01:00
Adam Warner
c1062f43b0
fix: don't let root write the version file into pihole-owned /etc/pihole
The `pihole updatechecker` cron job and pihole-FTL-prestart.sh both ran as
root and created/truncated/chmod-ed /etc/pihole/versions on a fixed path
without O_NOFOLLOW. Since the pihole user owns /etc/pihole, a compromised
pihole account could replace `versions` with a symlink to any root-owned
file and have root truncate it, relax its mode, or create it. The chmod
step also allows exposing e.g. /etc/shadow. See GHSA-xch2-4qxw-g5vj.

- pihole.cron: run `updatechecker` as the pihole user (like updateGravity),
  so root no longer writes into /etc/pihole from cron.
- updatecheck.sh: build the file in a mktemp'd temp file and rename() it
  into place; a symlink at the target is replaced, not followed.
- pihole-FTL-prestart.sh: create/permission `versions` (and, same bug
  class, `dhcp.leases`) as the pihole user via `su`, neutralising any
  planted symlink. A symlink to a root-owned file then only yields EPERM.
- basic-install.sh / uninstall.sh: register the root-owned Core and Web
  repos in git's system-wide safe.directory list so the now-unprivileged
  updatechecker can still read local versions.

Behaviour change: /etc/pihole/versions is now consistently mode 0644 after
a service (re)start; the find in prestart previously left it 0640, against
the file's own comment and updatecheck.sh's own chmod 644.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-10-15 19:47:57 +01:00
yubiuser
a8461650ec
Bump the github-actions-dependencies group across 1 directory with 2 updates (#6704)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-10-10 15:08:24 +02:00
dependabot[bot]
3b9da8b223
Bump the github-actions-dependencies group across 1 directory with 2 updates
Bumps the github-actions-dependencies group with 2 updates in the / directory: [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) and [trufflesecurity/trufflehog](https://github.com/trufflesecurity/trufflehog).


Updates `redhat-plumbers-in-action/differential-shellcheck` from 5.5.6 to 5.5.7
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](d965e66ec0...f51c7c0d32)

Updates `trufflesecurity/trufflehog` from 3.97.2 to 3.99.0
- [Release notes](https://github.com/trufflesecurity/trufflehog/releases)
- [Commits](cc1fe982af...b2b0a92070)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-version: 5.5.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
- dependency-name: trufflesecurity/trufflehog
  dependency-version: 3.97.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-10 10:02:53 +00:00
Dan Schaper
4109c35cec
Remove Debian 11 from the CI distro matrix (#6696)
Some checks are pending
Check for merge conflicts / main (push) Waiting to run
2026-10-09 12:50:55 -06:00
DL6ER
6951730b3c
Keep Ubuntu 20.04 in the CI distro matrix
`focal` is still served in full and `distro-test (ubuntu_20)` passes, so only Debian 11 goes for now.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2026-10-09 20:36:16 +02:00
Dan Schaper
7e2a4efc82
Keep /etc/pihole/versions readable by all users (#6711)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-10-07 12:59:18 -06:00
candygoogy
d8da51a02d
Keep /etc/pihole/versions readable by all users
pihole-FTL-prestart.sh sets /etc/pihole/versions to 0644 so that
pihole -v works for all users, but the find command that sets every
file in /etc/pihole to 0640 runs right after it and undoes that. After
every FTL start, pihole -v run by a normal user fails with "Permission
denied" and shows N/A for all versions.

Move the chmod after the find commands, and check in the fresh install
test that the file is readable by a user other than pihole.

Signed-off-by: candygoogy <186837547+candygoogy@users.noreply.github.com>
2026-10-06 21:25:49 +02:00
Dominik
1fd0e077a4
send USR2 after logrotate (#6672)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-09-06 21:06:41 +02:00
DL6ER
f6528cddc1
Remove Debian 11 and Ubuntu 20.04 from the CI distro matrix
Debian 11 (bullseye) reached end of life on 2026-08-31. Its security suite is being retired: the pool files still referenced by the `bullseye-security` index return 404 on `deb.debian.org`, and the index itself expires on 2026-09-07. Installing the `pihole-meta` dependency package therefore fails and `distro-test (debian_11)` is red on every pull request. As a required check, it blocks all merges, and there is nothing left to fix on our side.

Ubuntu 20.04 (focal) is out of standard support since 2025-05 and only receives ESM updates. Its archive is still complete, so the job is green today, but it will break the same way once focal moves to `old-releases.ubuntu.com`. Drop it now rather than waiting for the next red matrix.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2026-09-06 20:24:50 +02:00
Dominik
2d4c837a63
Bump the github-actions-dependencies group with 2 updates (#6695)
Some checks are pending
Check for merge conflicts / main (push) Waiting to run
2026-09-06 20:01:41 +02:00
darkexplosiveqwx
6ef87ee2b7
installer: migrate unmodified v6.4.3 logrotate files to the postrotate version
Render both the current template and a v6.4.3 reference with the local su
line substituted before comparing against the installed file, so the
freshness check stops always reporting a difference. On fresh installs the
rendered file is installed directly. Unmodified v6.4.3 files (which lack
the postrotate signal for FTL.log and webserver.log) are replaced with the
current template, and customized files are left alone with a hint naming
the missing postrotate.

Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-09-06 15:32:42 +02:00
dependabot[bot]
fbab77211b
Bump the github-actions-dependencies group with 2 updates
Bumps the github-actions-dependencies group with 2 updates: [trufflesecurity/trufflehog](https://github.com/trufflesecurity/trufflehog) and [editorconfig-checker/action-editorconfig-checker](https://github.com/editorconfig-checker/action-editorconfig-checker).


Updates `trufflesecurity/trufflehog` from 3.97.1 to 3.97.2
- [Release notes](https://github.com/trufflesecurity/trufflehog/releases)
- [Commits](20652fbbde...cc1fe982af)

Updates `editorconfig-checker/action-editorconfig-checker` from 2.2.0 to 3.0.0
- [Release notes](https://github.com/editorconfig-checker/action-editorconfig-checker/releases)
- [Commits](840e866d93...51f63319f5)

---
updated-dependencies:
- dependency-name: trufflesecurity/trufflehog
  dependency-version: 3.97.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
- dependency-name: editorconfig-checker/action-editorconfig-checker
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-09-05 10:02:27 +00:00
yubiuser
f768b7d825
Bump trufflesecurity/trufflehog from 3.97.0 to 3.97.1 in the github-actions-dependencies group (#6694)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-08-31 19:33:35 +02:00
dependabot[bot]
d9c42c8d95
Bump trufflesecurity/trufflehog in the github-actions-dependencies group
Bumps the github-actions-dependencies group with 1 update: [trufflesecurity/trufflehog](https://github.com/trufflesecurity/trufflehog).


Updates `trufflesecurity/trufflehog` from 3.97.0 to 3.97.1
- [Release notes](https://github.com/trufflesecurity/trufflehog/releases)
- [Commits](bcfcf73aaf...20652fbbde)

---
updated-dependencies:
- dependency-name: trufflesecurity/trufflehog
  dependency-version: 3.97.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-29 10:02:38 +00:00
yubiuser
52882a49ab
fix Unquoted Variable Expansion in rm Paths (#6687)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-08-27 11:36:22 +02:00
Michael Woolweaver
2590751930
fix: Unquoted Variable Expansion in rm Paths and ensure all rm calls use -f
Co-authored-by: yubiuser <github@yubiuser.dev>
Signed-off-by: Michael Woolweaver <michael@woolweaver.bid>
2026-08-27 02:23:02 -05:00
yubiuser
3c234ab670
Improve gravity error handling - take II (#6678)
Some checks are pending
Check for merge conflicts / main (push) Waiting to run
2026-08-26 22:30:07 +02:00
yubiuser
c8432b8c97
Bump trufflesecurity/trufflehog from 3.96.0 to 3.97.0 in the github-actions-dependencies group (#6684) 2026-08-22 12:20:25 +02:00
dependabot[bot]
76653a5443
Bump trufflesecurity/trufflehog in the github-actions-dependencies group
Bumps the github-actions-dependencies group with 1 update: [trufflesecurity/trufflehog](https://github.com/trufflesecurity/trufflehog).


Updates `trufflesecurity/trufflehog` from 3.96.0 to 3.97.0
- [Release notes](https://github.com/trufflesecurity/trufflehog/releases)
- [Commits](6f3c981e7b...bcfcf73aaf)

---
updated-dependencies:
- dependency-name: trufflesecurity/trufflehog
  dependency-version: 3.97.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-22 10:02:41 +00:00
yubiuser
fd34ed80e4
Remove deprecated arpflush command in favor of networkflush (#6530) 2026-08-21 22:46:43 +02:00
Adnan Mazharuddin Shaikh
875a936816
Remove deprecated arpflush command
The arpflush command has been deprecated in favor of networkflush.
This commit completes the deprecation cycle by removing:
- arpFunc() function definition
- arpflush case statements in command routing
- All associated comments and references

Users should use 'pihole networkflush' instead.

Signed-off-by: Adnan Mazharuddin Shaikh <adnanmazharuddinshaikh@gmail.com>
2026-08-21 13:16:42 -07:00
darkexplosiveqwx
c609e37d74
logrotate: merge FTL and webserver as they share all options, this
enables sharedscripts

Co-Authored-by: RD WebDesign <github@rdwebdesign.com.br>
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-08-19 22:16:13 +02:00
Adam Warner
ca994f451e
Introduce agents.md (#6676)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-08-04 12:14:32 +01:00
Christian König
3692ca26c7
Fail early
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
Signed-off-by: Christian König <github@yubiuser.dev>
2026-08-03 16:42:57 +02:00
Christian König
af5447e026
Use rm -f to forece remove stray matter
Signed-off-by: Christian König <github@yubiuser.dev>
2026-08-03 15:52:32 +02:00
Christian König
2647ab1d9e
Fix shellcheck warnings
Signed-off-by: Christian König <github@yubiuser.dev>
2026-08-03 13:09:11 +02:00
Christian König
fbb8ef139e
Improve gravity error handling
Signed-off-by: Christian König <github@yubiuser.dev>
2026-08-03 13:08:22 +02:00
yubiuser
b93d9bbcf3
Remove Contributing.md (#6673)
Some checks are pending
Check for merge conflicts / main (push) Waiting to run
2026-08-03 13:06:35 +02:00
Adam Warner
cea6380308
Introduce agents.md
Signed-off-by: Adam Warner <github@promofaux.dev>
2026-08-02 17:48:28 +01:00
yubiuser
87e14a7516
Bump actions/stale from 10.4.0 to 11.0.0 in the github-actions-dependencies group (#6675)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-08-01 12:48:44 +02:00
dependabot[bot]
fcd05aa165
Bump actions/stale in the github-actions-dependencies group
Bumps the github-actions-dependencies group with 1 update: [actions/stale](https://github.com/actions/stale).


Updates `actions/stale` from 10.4.0 to 11.0.0
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](1e223db275...4391f3da66)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: 11.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-01 10:02:47 +00:00
Christian König
0180e6356f
Remove Contributing.md
Signed-off-by: Christian König <github@yubiuser.dev>
2026-07-27 15:46:38 +02:00
yubiuser
9a8446aedf
Bump the github-actions-dependencies group with 2 updates (#6671)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-07-27 09:37:49 +02:00
darkexplosiveqwx
b0eccd1db8
send USR2 after logrotate, since they now utilize a cached FD
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-07-25 12:37:26 +02:00
dependabot[bot]
4394ccd0af
Bump the github-actions-dependencies group with 2 updates
Bumps the github-actions-dependencies group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [trufflesecurity/trufflehog](https://github.com/trufflesecurity/trufflehog).


Updates `actions/checkout` from 7.0.0 to 7.0.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](9c091bb21b...3d3c42e5aa)

Updates `trufflesecurity/trufflehog` from 3.95.9 to 3.96.0
- [Release notes](https://github.com/trufflesecurity/trufflehog/releases)
- [Commits](27b0417c16...6f3c981e7b)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
- dependency-name: trufflesecurity/trufflehog
  dependency-version: 3.96.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-25 10:02:23 +00:00
yubiuser
a0c6e982d3
Bump the github-actions-dependencies group with 2 updates (#6668)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-07-11 16:08:25 +02:00
dependabot[bot]
d7bd3afd96
Bump the github-actions-dependencies group with 2 updates
Bumps the github-actions-dependencies group with 2 updates: [actions/stale](https://github.com/actions/stale) and [trufflesecurity/trufflehog](https://github.com/trufflesecurity/trufflehog).


Updates `actions/stale` from 10.3.0 to 10.4.0
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](eb5cf3af3a...1e223db275)

Updates `trufflesecurity/trufflehog` from 3.95.8 to 3.95.9
- [Release notes](https://github.com/trufflesecurity/trufflehog/releases)
- [Commits](00155c9dc5...27b0417c16)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: 10.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions-dependencies
- dependency-name: trufflesecurity/trufflehog
  dependency-version: 3.95.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-11 10:02:28 +00:00
Adam Warner
0d7a2d7ed5
Remove stale pip dependabot entry (#6666)
Some checks are pending
Check for merge conflicts / main (push) Waiting to run
2026-07-10 22:52:17 +01:00
Adam Warner
af01c607fc
Remove stale pip dependabot entry for /test
Signed-off-by: Adam Warner <github@promofaux.dev>
2026-07-10 18:49:40 +01:00
Adam Warner
41f08787c7
Stop double-rotating logs now that pihole is in /etc/logrotate.d (#6663)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-07-08 15:51:54 +01:00
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
Adam Warner
5e30faad50
Sync master back into development (#6662)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
2026-07-06 23:35:18 +01:00
Adam Warner
f47b8ede5a
v6.4.3 (#6618)
Some checks failed
Check for merge conflicts / main (push) Has been cancelled
Sync Back to Development / Syncing branches (push) Has been cancelled
2026-07-06 21:34:28 +01:00
Adam Warner
e4770a4ee2
avoid copytruncate in logrotate (#6642) 2026-07-06 20:30:38 +01:00
darkexplosiveqwx
ef91b80f55
notify if logrotate file is out of date
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-07-06 21:22:39 +02: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