-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
As I've described in the comments of #4675, it can in some scenarios be useful to set the ownership, primarily the owning group, of a Unix listener created by Caddy, to narrow down the processes/users that are allowed to connect to them.
At the current time, listeners created by Caddy are owned by the Caddy process' primary UID/GID. Granting the caddy group to other services might be undesirable, however, since, even though all of Caddy's state, certs, etc. have no group permissions, it could be used to protect configuration files containing sensitive data: /etc/caddy/Caddyfile might contain basic auth password hashes, so the "usual" way of securing it would be changing the ownership to root:caddy and the file mode to 0640.
While this issue can be worked around by changing Caddy's primary group (e.g. Group= in case of systemd) to the group that should own the sockets and then adding the caddy group as a supplementary group (e.g. using SupplementaryGroups=), there is still the problem that all sockets are owned by the same group. This can be problematic, especially for the admin socket, as there might be Caddy sites one wants to expose to specific applications without permitting access to others.