Commit Graph

68 Commits

Author SHA1 Message Date
Adam Warner b0878f1750
read pids into an array in case of multiple instances of FTL running. Wait til they are all closed (stop calls killall) and then start another one
Additionally, move the logic from start() into the end of restart(), and have start() call restart, ensures multiple calls of start cannot start multple processes

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-04-11 20:59:07 +01:00
Adam Warner 18e2e11541
Silence FTL output on container run (for now) (again!)
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-04-04 18:07:08 +01:00
Dan Schaper 6b9abc23a0
Apply capabilities to pihole-FTL and notify DHCP wihtout NET_ADMIN.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2022-04-02 11:58:42 -07:00
Adam Warner 4dc9504330
evert pihole-FTL service command to use s6-setuidgid command when running pihole-FTL
Update fix_capabilities to only apply net_admin and sys_nice if they are actually available to the container

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-04-02 10:50:55 +01:00
Adam Warner af0af5a59a
Supress FTL log output (for now)
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-04-01 23:31:00 +01:00
Dan Schaper 54f56a717e
Remove touch from runtime init scripts
co-authored-by: RD WebDesign <github@rdwebdesign.com.br>
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2022-04-01 11:45:16 -07:00
RD WebDesign 3cb043eb10 Use `touch` only if we need to create an absent file
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2022-03-31 15:00:47 -03:00
Dan Schaper a485e238ca
call capsh directly, no need to set uid/gid
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2022-03-28 18:37:03 -07:00
Dan Schaper cf06b7ead3
Allow caps inheritance for raising to ambient.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2022-03-28 16:48:46 -07:00
Dan Schaper 086dd6cc86
Bullseye based `capsh`
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2022-03-28 14:37:13 -07:00
edgd1er 2db09515d7 add suggested changes to send logs to stdout
Signed-off-by: edgd1er <edgd1er@hotmail.com>
2022-01-28 08:12:40 +01:00
edgd1er 06d6b74c63 add finish scripts for logs. prevent duplicate cat processes, lighttpd start loop
Signed-off-by: edgd1er <edgd1er@hotmail.com>
2022-01-27 05:49:59 +01:00
edgd1er 140312b79c Redirect lighttpd logs to stdout
Signed-off-by: edgd1er <edgd1er@hotmail.com>
2022-01-27 04:17:42 +01:00
Adam Warner e6dd028c61
switch from -wU to -wu, as there is nothing set up to notify that the daemon's are ready - effectively supresses a warning message that we don't need to pay attention to
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-01-26 21:41:17 +00:00
Adam Warner 1f3951431b
tweak per https://github.com/pi-hole/docker-pi-hole/pull/991#pullrequestreview-864021964 2022-01-26 21:06:17 +00:00
Adam Warner 2eb9afc350
Touch/chown lighttpd access/error logs on service start. May not be 100% neccasery currently, but could be useful
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-01-26 18:29:14 +00:00
Adam Warner 25539a9c99
Merge pull request #982 from edgd1er/dev_origin
[Experimental] Add ability to change UID / GID for www-data and pihole user.
2022-01-20 17:16:04 +00:00
Adam Warner fe1676b9ed
Move a few things about. Set permissions pihole-FT requires in it's `run` script. remove pihole-FTL test from test-config because nothing exists until it has started for the first time.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-01-17 23:28:02 +00:00
edgd1er 2cec4fa719 change UID / GID for www-data and pihole user.
When mounting volumes, specific rights may be needed to write on mounted volumes on the host.

Signed-off-by: edgd1er <edgd1er@hotmail.com>
2022-01-17 15:28:25 +01:00
Peter Dave Hello b29ac1ec18 Use consistent method to kill process in s6 finish script
If the process does not exist, the error message of `kill` command is a
little bit confusing:

`kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]`

Using `killall` in `/s6/debian-root/etc/services.d/pihole-FTL/finish` to
kill the process, like what we do in `cron/finish` & `lighttpd/finish`,
will make the usage in this project more consistent, and also, the
command `killall` will provide better & friendly output, like:

`pihole-FTL: no process found`

Close #986, cc #973

Signed-off-by: Peter Dave Hello <hsu@peterdavehello.org>
2022-01-17 22:19:23 +08:00
Adam Warner 9deb685cc0
When restarting the service - wait until the old proc has been killed before attempting to start it again. Prevents messages about the usuage of kill in the log.
Remove old comment

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-01-07 23:14:28 +00:00
Adam Warner a5eda6844e
use kill -15 (TERM) instead of 9 to exit FTL a bit more gracefully and save queries to the database
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-01-02 14:30:31 +00:00
Adam Warner 0eb1a60d78
Switch default DNSMASQ_USER to `pihole` from root, and fix permissions on `pihole-FTL.db` to belong to `pihole:pihole`
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-01-02 14:29:54 +00:00
Adam Warner 9a9ee41a45
- Replace PIHOLE_VERSION with PIHOLE_DOCKER_TAG
- reorder some stuff in the main Dockerfile
- Remove the CORE/WEB/FTL_VERSION args/env vars
- tweaks to GHA build script after some hints from @crazy-max
- always checkout dev versions of Pi-hole for nightly build, also make sure we're using dev branch of this repo
- keep pihole checkout enabled for dev and nightly tags

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2021-12-10 20:51:35 +00:00
Adam Warner 3942d9a740
Repalce PIHOLE_TAG with PIHOLE_VERSION, it isn't actually needed after all.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2021-09-12 23:43:59 +01:00
Adam Warner 3865e77c6e
Introduce internal PIHOLE_TAG variable so that we can see what tag the container is...
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2021-08-05 00:59:34 +01:00
Adam Warner 1f1dc03a69
Merge pull request #888 from DistractionRectangle/Set-Phasers-to-Stun
Remove Unneccessary kill -9
2021-08-04 18:43:09 +01:00
D.Rect 408f71a480 Remove Unneccessary kill -9
Since piholeFTL test properly spins down it's no longer
necessary to kill it. He's dead Jim

Merge #300, added `piholeFTL test` to the startup sequence to
replace dnsmasq as a dependency for validate_env and gravity.sh.
kill -9 was kept as a work around to a standing issue that
`piholeFTL test` didn't spin down on it's own. This was fixed
in pi-hole/FTL#1067, landed on Apr 14 2021 and confirmed
working, as evinced by #834 which was filed the same day it
that fix landed.

Signed-off-by: D.Rect <48034372+DistractionRectangle@users.noreply.github.com>
2021-07-25 08:25:35 -07:00
D.Rect 7650896158 Fix gravityDB check
piholeFTL exposes configuration to relocate/rename gravityDB so
we cannot just check a hard coded location. This commit greps
pihole-FTL.conf for a custom location. Since pihole-FTL.conf
will eventually be replaced by TOML, some verbosity is added to
denote what config file is being checked and what location it
ultimately ended up checking.

Signed-off-by: D.Rect <48034372+DistractionRectangle@users.noreply.github.com>
2021-07-24 15:20:38 -07:00
Adam Warner 70c573b69e
Ignore SKIPGRAVITYONBOOT if not gravity.db exists, which will be the case if a fresh container is built with a new (empty) volume mapped to it.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2021-07-21 19:41:35 +01:00
Matt Winter 1633a976a4 Only remove the cron.d file if it exists
Signed-off-by: Matt Winter <MattWinter@gmail.com>
2021-04-16 12:36:13 -04:00
Matt Winter fa771f74fd Change gravity-on-boot so it's run by cron
Proposed solution to #834

I believe the correct way to solve this issue is to change when "Gravity on Boot" is run.

The s6 init system has different stages. Currently, "gravity on boot" is run during Stage 2.ii: cont-init.d. One instance of pihole-FTL is started during cont-init, but it is only there to check the validity of the config files; it exits soon after starting. The final "service mode" instance of pihole-FTL is not started until Stage 2.iii, when the supervisor starts doing work.

If gravity.sh is counting on FTL to do its DNS lookups, then we should not run gravity until the supervised instance of FTL is running. We can accomplish this by moving "Gravity on Boot" to a @reboot line in /etc/cron.d/gravity-on-boot, and making that file's existence dependent on the value of SKIPGRAVITYONBOOT.

This will work because cron isn't started until we've reached Stage 2.iii.

Signed-off-by: Matt Winter <MattWinter@gmail.com>
2021-04-16 10:58:14 -04:00
Adam Warner abdf9f1130
remove shared memory files before starting the FTL process. Mimics bare metal service script (to an extent) (#796)
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2021-02-16 23:09:49 +00:00
Athrogate 8770b9789b Update 20-start.sh
Signed-off-by: Tyler Spires <shadrach145@gmail.com>
2020-08-22 18:17:17 -04:00
Athrogate 7248b3c915 Update 20-start.sh
Signed-off-by: Tyler Spires <shadrach145@gmail.com>
2020-08-22 18:17:17 -04:00
Athrogate e15017d69a Update 20-start.sh
Signed-off-by: Tyler Spires <shadrach145@gmail.com>
2020-08-22 18:17:17 -04:00
Adam Hill 4c4e9c3bc9 Beta v5.0
Signed-off-by: Adam Hill <adam@diginc.us>
2020-02-03 23:39:03 -06:00
Adam Hill fca7769b33
remove ServerIP requirement, simpler example commands
Signed-off-by: Adam Hill <adam@diginc.us>
2019-02-07 19:51:15 -06:00
Mathieu Hofman 6629aff889 Allow running pihole-FTL as non-root
- Add a new container environment variable allowing to specify the user to run the pihole-FTL process as. Defaults to root.
- Set inherited capabilities attributes on the pihole-FTL file to automatically grant runtime permitted capabilities when available in the bounding set. This allows dropping root before starting pihole-FTL without failing with a permission error if the capabilities are not available to the container (the process may still error out if performing an operation requiring the capability).
- Add some information on capabilities to the Readme file.

Signed-off-by: Mathieu Hofman <86499+mhofman@users.noreply.github.com>
2019-02-06 02:31:33 -08:00
Adam Hill 2336174036
comment tweak
Signed-off-by: Adam Hill <adam@diginc.us>
2019-01-01 14:21:53 -06:00
Adam Hill d9ca4187b9
new pihole dev 2019-01-01 13:51:33 -06:00
Adam Hill d7a125a706
Version 4.1
Signed-off-by: Adam Hill <adam@diginc.us>
2018-12-12 20:43:08 -06:00
Adam Hill 187c1d3f29
stop using pihole init.d stop, may be going away
Signed-off-by: Adam Hill <adam@diginc.us>
2018-08-04 10:30:51 -05:00
Adam Hill e7ae12a94c
Add fixes for config permissions, deprection notice 2018-08-02 22:50:01 -05:00
Adam Hill 0e7ab463fa
add finish scripts to restart cleanly
Signed-off-by: Adam Hill <adam@diginc.us>
2018-07-19 22:57:05 -05:00
diginc 3877a171da fix startup 53 port conflict and test error 2018-07-04 14:11:18 -05:00
diginc ad6b4be403 Fixes to the startup, services, and dnsmasq references 2018-07-03 00:19:01 -05:00
diginc 041ef30d42 Merge remote-tracking branch 'origin/dev' into prerelease 2018-07-02 20:50:51 -05:00
diginc d45bccf9b4 remove dnsmasq service for new pihole-FTL service 2018-07-02 20:50:31 -05:00
StefanSchoof 002c8349d2 remove extra set from debugging 2018-07-02 18:18:01 +00:00