In the test, openbao service creates a unix socket at /run/openbao/openbao.sock, and caddy reverse proxies to it. For security reasons, the openbao service uses DynamicUser = true.
I configured the service to have supplementary groups including openbao and instructed openbao to set the socket group to caddy, but this leads to
A solution here is to set RuntimeDirectoryMode = "0777" or something permissive, but it would allow other users to access the /run/openbao directory. Another solution is to not use a dynamic user.
Is there a solution that does not require a runtime directory of 0777/0755, has DynamicUser = true, and where caddy can reverse proxy to the socket?
This requires that openbao is capable of receiving a socket either as a file descriptor or via the systemd API; unfortunately good support for unix sockets is pretty rare these days, it’s a rather niche use case since for the most part everything is hosted via https in kubernetes clusters, or at least in docker containers, so few projects care about monolithic hosts.
Enabling services with DynamicUser to access sockets without setting groups is still an issue, too, as that issue says.
You can of course also just create the socket manually in a different location that is group accessible.
Yes, you’re supposed to let systemd choose a directory that has g+x permissions.
You can try e.g. /run/openbao.sock - systemd will forward the socket via fd, so the cgroup settings won’t interfere. I suspect openbao won’t know what to do with the socket file descriptor though.
You can submit an upstream issue about this. Other projects end up adding a special fd transport so that you can change the listener to something like fd://3.
In the meantime, you have no option but to make openbao create the socket. You’ll have to add something like systemd.services.openbao.serviceConfig.ReadWritePaths = "/run/openbao.sock";.