Skip to content

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

Open
YK-03 wants to merge 1 commit into
oblien:mainfrom
YK-03:fix/1724-nginx-vhost-file-permissions
Open

YK-03 wants to merge 1 commit into
oblien:mainfrom
YK-03:fix/1724-nginx-vhost-file-permissions

Conversation

@YK-03

@YK-03 YK-03 commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

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.

…rkers (oblien#1724)

Signed-off-by: Yash Kaushik <yash005kaushik@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edge vhost configuration files written with 0600 mode cause Nginx permission denied on reload

1 participant