FTL correctly creates the cert and especially private key with 0600 mode. But the prestart scripts changes it to 0660.
After removing the dedicated webserver from Pi-hole setups, the pihole group has no purpose anymore, and files should not be writable to any other user than pihole itself, and the private TLS key not reasable to anyone else either.
Additionally, this commit consolidates the chmod calls, applying 0755 to all directories and 0640 to all files, but the TLS key and cert.
Signed-off-by: MichaIng <micha@dietpi.com>
Inspired by: https://github.com/pi-hole/pi-hole/pull/2112
A pre-start and a post-stop script are added to reduce doubled setup and cleanup code.
Since systemd services do not natively support dynamic users, test once whether capabilities are supported during install/update, and remove User=pihole otherwise.
Signed-off-by: MichaIng <micha@dietpi.com>
Co-authored-by: DL6ER <dl6er@dl6er.de>