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

add option to hide /debug/ pages #8596

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [#8574](https://github.com/influxdata/influxdb/pull/8574): Add 'X-Influxdb-Build' to http response headers so users can identify if a response is from an OSS or Enterprise service.
- [#8426](https://github.com/influxdata/influxdb/issues/8426): Add `parse-multivalue-plugin` to allow users to choose how multivalue plugins should be handled by the collectd service.
- [#8548](https://github.com/influxdata/influxdb/issues/8548): Allow panic recovery to be disabled when investigating server issues.
- [#5305](https://github.com/influxdata/influxdb/issues/5305): Add configuration option to disable the `/debug/vars` HTTP API endpoint

### Bugfixes

Expand Down
4 changes: 4 additions & 0 deletions etc/config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@
# troubleshooting and monitoring.
# pprof-enabled = true

# Determines whether the debug endpoint is enabled. This endpoint is used for
# gathering runtime statistics.
# pprof-enabled = true
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be updated to debug-enabled rather than pprof-enabled.


# Determines whether HTTPS is enabled.
# https-enabled = false

Expand Down
1 change: 1 addition & 0 deletions services/httpd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Config struct {
LogEnabled bool `toml:"log-enabled"`
WriteTracing bool `toml:"write-tracing"`
PprofEnabled bool `toml:"pprof-enabled"`
DebugEnabled bool `toml:"debug-enabled"`
Copy link
Contributor

Choose a reason for hiding this comment

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

The default for this should be set to true.

HTTPSEnabled bool `toml:"https-enabled"`
HTTPSCertificate string `toml:"https-certificate"`
HTTPSPrivateKey string `toml:"https-private-key"`
Expand Down
3 changes: 3 additions & 0 deletions services/httpd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ bind-address = ":8080"
auth-enabled = true
log-enabled = true
write-tracing = true
debug-enabled = true
https-enabled = true
https-certificate = "/dev/null"
unix-socket-enabled = true
Expand All @@ -34,6 +35,8 @@ max-body-size = 100
t.Fatalf("unexpected auth enabled: %v", c.AuthEnabled)
} else if c.LogEnabled != true {
t.Fatalf("unexpected log enabled: %v", c.LogEnabled)
} else if c.DebugEnabled != true {
t.Fatalf("unexpected debug enabled: %v", c.DebugEnabled)
} else if c.WriteTracing != true {
t.Fatalf("unexpected write tracing: %v", c.WriteTracing)
} else if c.HTTPSEnabled != true {
Expand Down
4 changes: 2 additions & 2 deletions services/httpd/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {

if strings.HasPrefix(r.URL.Path, "/debug/pprof") && h.Config.PprofEnabled {
h.handleProfiles(w, r)
} else if strings.HasPrefix(r.URL.Path, "/debug/vars") {
} else if strings.HasPrefix(r.URL.Path, "/debug/vars") && h.Config.DebugEnabled {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should setting debug-enabled to false also disable /debug/pprof?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that is what pprof-enabled does.

h.serveExpvar(w, r)
} else if strings.HasPrefix(r.URL.Path, "/debug/requests") {
} else if strings.HasPrefix(r.URL.Path, "/debug/requests") && h.Config.DebugEnabled {
h.serveDebugRequests(w, r)
} else {
h.mux.ServeHTTP(w, r)
Expand Down