#1898

fix(nginx): write vhost conf files with 0644 mode for unprivileged workers (#1724)

OpenYK-03wants to merge intofrom

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) assigns 0o644 to .conf files and 0o600 to .route.json sidecars (preserving credential privacy for verifiers, salts, and session keys).
  • Updated NginxProvider.updateConfig to write with the expected mode and verify mode in isPendingChange.
  • Updated deleteRoute rollback to restore .conf with 0o644 and sidecars with 0o600.
  • Added unit tests verifying .conf files are written and restored with 0o644 while .route.json files retain 0o600.