#1898
fix(nginx): write vhost conf files with 0644 mode for unprivileged workers (#1724)
Fixes #1724 and #1604.
Problem
When running OpenResty/Nginx worker processes under an unprivileged user (such as nobody or www-data), openresty -t or openresty -s reload fails with:
nginx: [emerg] open() "/etc/nginx/sites-enabled/<domain>.conf" failed (13: Permission denied)
because NginxProvider previously wrote all route files (including .conf vhosts) with mode 0600 (ROUTE_FILE_MODE). Unprivileged workers cannot read 0600 root-owned files or bind mounts.
Changes
- Distinguish vhost configuration files (
VHOST_FILE_MODE = 0o644) from private route state files (ROUTE_STATE_FILE_MODE = 0o600). - Helper
routeConfigFileMode(path)assigns0o644to.conffiles and0o600to.route.jsonsidecars (preserving credential privacy for verifiers, salts, and session keys). - Updated
NginxProvider.updateConfigto write with the expected mode and verify mode inisPendingChange. - Updated
deleteRouterollback to restore.confwith0o644and sidecars with0o600. - Added unit tests verifying
.conffiles are written and restored with0o644while.route.jsonfiles retain0o600.