#1724

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

Openchbndrhnnsopened 23d ago

Problem

In NginxProvider.updateConfig(), virtual host configuration files (sites-enabled/<slug>.conf) are written with file mode 0o600:

for (const { path, content } of changes) {
  if (content === null) await this._rm(path);
  else await this._writeFile(path, content, 0o600);
}

When OpenResty/Nginx runs on self-hosted or remote hosts under the openship-edge container, worker processes execute as unprivileged user nobody (or www-data), while files created by the executor on host bind mounts are owned by root or the deployment user.

When nginx -t or nginx -s reload runs, worker processes are unable to read the 0600 config files:

[emerg] open() "/usr/local/openresty/nginx/conf/sites-enabled/<domain>.conf" failed (13: Permission denied) in /usr/local/openresty/nginx/conf/nginx.conf

This causes domain routing and certificate provisioning to fail on deploy or reload.

Solution

Write vhost config files and their sidecars with 0o644 (-rw-r--r--) so unprivileged Nginx workers can read them, while private keys continue to be protected with 0o600.

Activity

0

No activity yet.