-
-
Notifications
You must be signed in to change notification settings - Fork 204
docs: mention file placeholder for secrets #543
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -821,4 +821,16 @@ For example, if you have the [`caddy-dns/cloudflare` plugin <img src="/old/resou | |
| } | ||
| ``` | ||
|
|
||
| Environment variables are convenient, but sensitive values in a process environment can be exposed by process inspection, child process inheritance, logs, crash dumps, or platform diagnostics. | ||
|
|
||
| For secrets, prefer your platform's secret management mechanism when available. If the secret is provided as a file, you can use the [global `{file.*}` placeholder](/docs/conventions#placeholders) in config fields which support placeholders: | ||
|
|
||
| ```caddy | ||
| { | ||
| acme_dns cloudflare {file./run/secrets/cloudflare_api_token} | ||
| } | ||
| ``` | ||
|
|
||
| This does not make the secret inaccessible to Caddy; the Caddy process still needs permission to read the file. It avoids placing the secret value in the process-wide environment. | ||
|
|
||
| If you're running Caddy as a systemd service, see [these instructions](/docs/running#overrides) for setting service overrides to define your environment variables. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section is still talking about env vars, so it's weird that the |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,7 +97,7 @@ The following placeholders are always available (global): | |
| Placeholder | Description | ||
| ------------|------------- | ||
| `{env.*}` | Environment variable; example: `{env.HOME}` | ||
| `{file.*}` | Contents from a file; example: `{file./path/to/secret.txt}` | ||
| `{file.*}` | Contents from a file, useful when a secret is supplied as a file; example: `{file./path/to/secret.txt}` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this change is necessary, it's redundant - the example has I want to be careful on the length of the description mainly for visual reasons, line wrapping etc. |
||
| `{system.hostname}` | The system's local hostname | ||
| `{system.slash}` | The system's filepath separator | ||
| `{system.os}` | The system's OS | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line feels weird, because it's like "well everything you just read? forget about it because this and this and that." It's strange to have something criticize the use of env vars, in the env vars section of the docs (I don't disagree with the content though, it's true).
I don't have a specific answer to this, but it needs some rethinking of where exactly this fits into the docs.