-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: Caddy 2.9.0 log writer requires existing directory path #6766
Comments
Alternative steps to reproduceMy initial steps used Docker as that was quickest for me to test and capture on a server, but the following should also work easily on a Linux or macOS desktop (I verified on macOS):
Caddyfile
|
Hey @mattgarber I want to work on this issue . Can you assign this issue to me ? |
We don't generally assign issues. If you want to work on it, just open a PR. |
Should be an easy fix. What will the permissions on the directory(ies) be? I was thinking 0700. |
@mholt That's a good question… I believe that the previous behavior (through v2.8.4) was based on the If you think that permissions should start to be a bit more restrictive on log locations by default, permissions of 0700 on the containing directory/ies (and 0600 on the file) would make sense, too. |
People were apparently surprised with the tighter permissions on the log files in 2.9 (which, I don't think I realized we had changed them -- maybe a dependency changed the defaults?, anyway...), but I don't think, if the directory doesn't even exist yet, it would inconvenience anyone. If they cared, they'd have made the directory already. So maybe 0700 would be a conservative default, and we can go from there. Caddy makes it, Caddy owns it. ✊ |
I think that sounds very reasonable:
|
Ok, sounds good. MkdirAll with 0700 permission. If a PR shows up in the next day or so I'll review it; otherwise I'll just push a commit myself. |
Overview
Using Caddy 2.8.4, an output log file could be specified such as
output file /var/log/caddy/access.log
, and Caddy would create thecaddy
subdirectory path in/var/log
if it was missing before creating/opening theaccess.log
file – assuming proper ownership and permissions, e.g., Caddy running asroot
.Under Caddy 2.9.0, if the
/var/log/caddy
directory path doesn't already exist when Caddy starts, it will exit with a log writer error rather than creating the necessary containing directory for the log file:After looking through recent activity, I had a guess it might be related to the FileWriter changes (#6314) and chmod improvements within the past few days (#6761), although reproduced the same regression with
v2.9.1-0.20250103220605-010cd982731b
built withxcaddy
against that latest commit (010cd98).To Reproduce
Use the following two Dockerfiles (for v2.8.4 and v2.9.0) with identical Caddyfile to test the regression in behavior. (The v2.9.0 Dockerfile will require the
/var/log/caddy
directory to be created before Caddy starts, commented at first to show the error being thrown.)Dockerfile (v2.8.4)
Dockerfile (v2.9.0)
Dockerfile (commit 010cd98)
Caddyfile
The text was updated successfully, but these errors were encountered: