varnish / hitch

A scalable TLS proxy by Varnish Software.
https://www.varnish-software.com/
Other
1.87k stars 157 forks source link

Static fchown instead of permission check #371

Closed alkuzad closed 1 year ago

alkuzad commented 2 years ago

Expected Behavior

Logfile can be set to /dev/stdout

Current Behavior

Instead of doing fchown every time, check permissions and do it if needed. This breaks using /dev/stdout which is root owned but it's 777

https://github.com/varnish/hitch/blob/c8033c38c202010e4f42b24a377ae36f5b8e2188/src/hitch.c#L4192

Possible Solution

Do fchown only if write is not possible

Steps to Reproduce (for bugs)

  1. Set logfile config to /dev/stdout
  2. Start hitch

Context

This makes it hard to make sure container logs to stdout instead of stderr

Your Environment

Docker container - alpine:3.11, run as non-priviledged user