I expected that the CADDY_ADMIN environment variable, added in #5317, would be able to be used to disable the admin interface.
Reproducer
Setting the variable to the value off, as mentioned by https://caddyserver.com/docs/caddyfile/options#admin, results in the address http://off being used, preventing server startup (lookup off on 8.8.8.8:53: no such host).
$ cat Caddyfile.test
{
http_port 8080
auto_https off
skip_install_trust
}
:8080 {
respond 200 "Success"
}
$ CADDY_ADMIN=off caddy run --config Caddyfile.test
2024/04/28 23:05:28.451 INFO using provided configuration {"config_file": "Caddyfile.test", "config_adapter": ""}
Error: loading initial config: loading new config: starting caddy administration endpoint: listen tcp: lookup off on 8.8.8.8:53: no such host
Impact
This is a minor security annoyance when deploying to a remote hosting environment on which the interface will never be accessed (except maliciously by an intruder) but needs not to be disabled by hardcoding admin off in the Caddyfile. e.g. if the Caddyfile needs to be promoted, unchanged, from a testing environment in which the admin interface is required.
Versions
$ caddy version; uname -smv
v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=
Linux #1 SMP PREEMPT_DYNAMIC Sat, 17 Feb 2024 21:12:19 +0000 x86_64
The only reason this env var exists is to allow package managers to set a different default (e.g. unix socket file). The intent is not to make it cover the various options, including turning off admin.
Expectation
I expected that the
CADDY_ADMIN
environment variable, added in #5317, would be able to be used to disable the admin interface.Reproducer
Setting the variable to the value
off
, as mentioned by https://caddyserver.com/docs/caddyfile/options#admin, results in the addresshttp://off
being used, preventing server startup (lookup off on 8.8.8.8:53: no such host
).Impact
This is a minor security annoyance when deploying to a remote hosting environment on which the interface will never be accessed (except maliciously by an intruder) but needs not to be disabled by hardcoding
admin off
in the Caddyfile. e.g. if the Caddyfile needs to be promoted, unchanged, from a testing environment in which the admin interface is required.Versions
Related
6281