Skip to content

Security

github-actions[bot] edited this page Dec 1, 2026 · 2 revisions

Security

JMX can run arbitrary code in the JVM it manages, so write access is shell access. The defaults are tight:

  • listens on 127.0.0.1 only;
  • always asks for sign-in (--auth none is refused off loopback);
  • read-only (--allow-write is opt-in, and per-user roles can limit it further);
  • only the JVMs you list or that run locally (--allow-connect is opt-in).

Choosing an authentication mode

You have Use
just yourself token (default)
a handful of users form with --users-file (create hashes with jconsole-web hash-password)
a directory form or basic with --ldap-url and --ldap-dn-template (use ldaps://)
an SSO provider (Keycloak, Entra ID, Okta, ...) oidc
SAML, Kerberos, mTLS or another proxy-side login header behind that proxy, with --trusted-proxy

Behind a reverse proxy

  • Terminate TLS at the proxy; give jconsole-web --public-url https://... so cookies are Secure and OIDC redirects are right.
  • Keep the original Host (proxy_set_header Host $host) and add it with --allowed-host, or list the origin with --allowed-origin.
  • Turn response buffering off for /api/vms/*/stream (server-sent events).
  • Have the proxy append to X-Forwarded-For (proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; in nginx) and list it in --trusted-proxy: failed sign-ins are rate limited per client address, taken from the right-most entry that is not a trusted proxy. A proxy that forwards the client's header unchanged lets a client choose its address.
  • In header mode the proxy must overwrite the user header, never forward the client's, and must be the only way to reach the port (--trusted-proxy enforces the peer address).

OpenID Connect

Register https://your-host/oidc/callback as a redirect URI, give the client id with --oidc-client-id and the secret (if any) in JCONSOLE_WEB_OIDC_CLIENT_SECRET. Always restrict who may sign in (--allowed-group, --allowed-email-domain, --allowed-user): without a restriction every account of the provider would get in, so the server refuses to start. An e-mail address counts only when the ID token says email_verified: true (absent means not verified); for providers that never send it use groups or --oidc-user-claim.

Roles and sessions

With --allow-write an explicit admin / viewer in the users file wins over --admin-user for that name, also when LDAP accepted the password. A form session follows the users file: a removed user, a new password or a new role applies on the next request.

Token links

The printed link is http://host:port/#token=.... The token is in the URL fragment, which is never sent to the server or a proxy, and the page removes it from the address bar before it signs in. /?token=... is not accepted.

Docker and Kubernetes secrets

Prefer files over environment variables for secrets: JCONSOLE_WEB_TOKEN_FILE, JCONSOLE_WEB_JMX_PASSWORD_FILE, JCONSOLE_WEB_OIDC_CLIENT_SECRET_FILE (mount the secret at /run/secrets/..., or a Kubernetes secret volume). The value then appears in neither docker inspect, /proc/*/environ nor the process list. Every other option is a JCONSOLE_WEB_* variable too, so a container needs no command line.

Audit log

Standard error carries one line per sign-in, failed sign-in, write and refused write (... audit event=write user=alice ip=203.0.113.7 vm=app action=invoke mbean=... operation=gc). Ship it with your container logs. Written values are never logged.

Passwords and secrets

Never put secrets in argv where you can avoid it: use JCONSOLE_WEB_TOKEN, --token-file, JCONSOLE_WEB_JMX_PASSWORD, JCONSOLE_WEB_OIDC_CLIENT_SECRET. Passwords in the users file are PBKDF2-HMAC-SHA256 (600,000 iterations), plain text is rejected.

Reporting a vulnerability

Use GitHub's private vulnerability reporting, see SECURITY.md.