Skip to content
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

cmd: fix cli when admin endpoint uses new unix socket permission format #5696

Merged
merged 3 commits into from
Aug 6, 2023

Conversation

emilylange
Copy link
Member

Fixes #5694, a bug where the following Caddyfile

{
	admin unix/admin.sock|0660
}

and caddy reload --config Caddyfile
would throw the following error instead of reloading it:

INFO    using provided configuration    {"config_file": "Caddyfile", "config_adapter": ""}
Error: sending configuration to instance: performing request: Post "http://127.0.0.1/load": dial unix admin.sock|0660: connect: no such file or directory
[ERROR] exit status 1

This bug also affected caddy start and caddy stop.

Fixes a bug where the following Caddyfile

```Caddyfile
{
	admin unix/admin.sock|0660
}
```

and `caddy reload --config Caddyfile`
would throw the following error instead of reloading it:

```
INFO    using provided configuration    {"config_file": "Caddyfile", "config_adapter": ""}
Error: sending configuration to instance: performing request: Post "http://127.0.0.1/load": dial unix admin.sock|0660: connect: no such file or directory
[ERROR] exit status 1
```

---

This bug also affected `caddy start` and `caddy stop`.
Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Makes sense to me.

I'll let Matt merge when he's ready.

@francislavoie francislavoie added the bug 🐞 Something isn't working label Aug 5, 2023
@francislavoie francislavoie added this to the v2.7.4 milestone Aug 5, 2023
listeners.go Outdated Show resolved Hide resolved
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks -- I too forgot about this code path with unix sockets.

LGTM, but I like Mohammed's idea!

listeners.go Outdated Show resolved Hide resolved
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just went ahead and moved it and verified it is hidden as internal, tests pass, etc. Will merge soon. :) Thank you @emilylange !!

@mholt mholt enabled auto-merge (squash) August 6, 2023 00:01
@mholt mholt merged commit 8d304a4 into caddyserver:master Aug 6, 2023
19 checks passed
@francislavoie francislavoie modified the milestones: v2.7.4, v2.7.3 Aug 6, 2023
@emilylange emilylange deleted the cmd-unix-perms branch August 6, 2023 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

admin api unix socket permissions cause config reload to fail
4 participants