openresty / openresty/docker-openresty

Move default writable paths to a dedicated directory

Open
#119 18 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dockerfile
Stars
1k
Forks
536
Avg merge
1d 32m
Merged PRs (30d)
1

Description

Currently, if you try to run openresty in a K8S cluster that is configured for higher security[0], perhaps runAsUser and/or readOnlyRootFilesystem, you'll get startup errors when openresty attempts to create /usr/local/openresty/nginx/client_body_temp (and etc). To start, you'd need to mount a read-write partition into /usr/local/openresty/nginx, which would override everything there, including the binaries. Even if you were to copy the existing files into the RW mount, you'd open yourself up to bad actors modifying files that they shouldn't.

Ideally, all writable files would be in a dedicated directory, something like /var/run/openresty. That'd include all of the *_temp directories, pid, and possibly logs. Then we can ensure that nobody can replace /usr/local/openresty/nginx/** at runtime.

[0] https://kubernetes.io/blog/2018/07/18/11-ways-not-to-get-hacked/#8-run-containers-as-a-non-root-user

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting how the Docker image configures OpenResty’s writable paths, including /usr/local/openresty/nginx/client_body_temp, the other *_temp directories, pid, and logs. Verify the result in a non-root Kubernetes setup with a read-only root filesystem: writable files should use a dedicated directory such as /var/run/openresty while the installation tree remains protected.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, kubernetes
Domain
infrastructure, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.