Caddy and Xray should be able to access the certs in /home/admin/tls/.
xray user belongs to caddy group. Hence as long as group read and execution permission are given to caddy group, it would be fine.
So far so good, but as soon as Caddy obtains the certificates and stores them in /home/admin/tls/ the new sub-directories/files no longer keep the permissions from the parent directory and xray user loses access to the certs.
In Caddy service I tried to add UMask=0002 under [Service], but it didn’t help. What can I do?
Is there a post-hook where I could run
In general I recommend avoiding the use of /home with webservers. Use something like /opt or /etc/caddy for config/storage (default storage is /var/lib/caddy/.local/share/caddy; what’s wrong with that?), and /srv/ or /var/www for your site contents.
Because I’m using Caddy in combination with Xray-core. The latter needs direct access to the certificates. I suppose I could keep the path to default /var/lib/caddy/.local/share/caddy. But it doesn’t change the permission problem for Xray to access it.
Even though I have given Group Read+Execution access to the path, the moment Caddy obtains a fresh copy for the certificates, it replaces the old permissions, and Xray can no longer access the certificates.