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 /agent/pprof endpoint #6496

Closed
schmichael opened this issue Oct 15, 2019 · 3 comments
Closed

Add /agent/pprof endpoint #6496

schmichael opened this issue Oct 15, 2019 · 3 comments
Assignees
Labels
Milestone

Comments

@schmichael
Copy link
Member

Summary

Add /agent/pprof endpoint which is the equivalent of Go's /debug/pprof endpoint but is:

  1. Enabled by default when ACLs are enabled and enable_debug is not explicitly set to false.
  2. Protected by agent:write ACL
  3. Supports ?node=... routing to client nodes via RPC (same as nomad monitor CLI #6365)

ACL

While agent:read is the most obvious choice for this API, due to its power and low-level access it should require a higher level of access than other agent:read endpoints like agent/members.

This also helps protect against future changes to the underlying Go package exposes more information than we currently expect.

As it's very difficult to determine all of the ways this Go runtime data could be used by an attacker, using a high access level is appropriate.

Default behavior

The default behavior is unfortunately confusing but seeks to maximize security, backward compatibility, and still allow debug access by default when possible. Disabling the debug endpoint by default makes it unavailable when operators need it most: when encountering an unexpected and hard to diagnose issue.

Endpoint enable_debug ACLs Available?
/debug/pprof unset n/a no
/debug/pprof true n/a yes
/debug/pprof false n/a no
/agent/pprof unset off no
/agent/pprof unset on yes
/agent/pprof true off yes
/agent/pprof false n/a no

Deprecating old endpoint behavior

The old endpoint is insecure and its use should be discouraged. However, it is useful in Nomad development scenarios where -dev is used or ACLs are disabled. A new configuration parameter should be added to control /debug/pprof:

insecure_enable_debug = true # defaults to false

In 0.11 setting enable_debug = true should log an INFO line pointing to this future behavior change:

In 0.12 setting enable_debug = true will no longer enable the unauthenticated /debug/pprof endpoint.

Consul & Vault

In Vault 1.3 the endpoint will be enabled by default but behind ACLs (which are always enabled in Vault).

Consul does not enable the endpoint by default but always requires an ACL.

@drewbailey
Copy link
Contributor

drewbailey commented Dec 10, 2019

@schmichael for the table of scenarios /s /debug/pprof with /v1/agent/pprof/ and /insecure_enable_debug controls the old agent only /debug/pprof endpoint?

@drewbailey
Copy link
Contributor

@schmichael schmichael modified the milestones: 0.11.0, 0.10.4 Apr 6, 2020
@github-actions
Copy link

github-actions bot commented Nov 9, 2022

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants