Restricting access to the Keycloak admin console

Keep the Keycloak admin console and Admin REST API off the public internet with a separate admin hostname, proxy path rules, network limits, administrator MFA and a locked-down master realm.

On this page

Why restricting Keycloak admin console access comes first

If your production Keycloak serves its admin console and Administration REST API on the same public hostname as your login pages, the admin surface should be reachable only from controlled networks, and every administrator should authenticate strongly. Those two controls come before most other hardening work because they decide who can change realms, clients, identity providers and signing keys if a credential is phished or a session is misused. The Keycloak production guide calls for TLS on all communication, a reverse proxy with path restrictions, and exposing the admin console and Administration REST API on a different hostname or context path from public frontend URLs. Until that separation exists, the path to administrative functions is the same path that anonymous internet users reach for sign-in.

The admin console is the browser interface for managing a realm, its users, clients, roles and identity providers. The Administration REST API exposes the same management functions to scripts, automation and other tooling, so an endpoint that is hidden in the console can still be reachable directly over HTTP. Both need to be placed behind the reverse proxy with explicit path rules, so that only the paths your public applications need are forwarded to the public hostname. Confirm which paths your proxy currently forwards, and check whether the admin paths answer from outside your management network, using the production guide's guidance as the reference for your Keycloak version.

Teams usually start this work in one of three situations: before a go-live, after an internal exposure review finds the admin paths reachable from the internet, or ahead of an internal audit that will ask who can reach administrative functions and how those users sign in. The earlier this is done, the less reconfiguration of client redirect URIs and login flows is needed later, because the public hostname and the admin hostname are chosen at the start. Before you begin, list every person and automated job that uses the admin console or the Administration REST API today, since those users will need a route into the restricted network and their own accounts.

How admin exposure differs by deployment model

On a virtual machine or a single container host, administrators usually reach Keycloak through a reverse proxy that terminates TLS and forwards traffic to the Keycloak process. The proxy is the main control point. Keycloak's production guide calls for a reverse proxy with path restrictions and for exposing the admin console and Administration REST API on a different hostname or context path from public frontend URLs, so the proxy must reject admin paths that arrive on the public hostname. Because the application server itself does not decide who may reach the admin path from the public side, a missing proxy rule leaves the console reachable.

  • Separate admin hostname: Serve the admin console and Admin REST API on a hostname that resolves only inside the management network, and keep the public hostname free of admin routes.
  • Path denial on the public listener: Return a not-found or forbidden response for admin paths on the public hostname, and test each path from outside the network.
  • Source restriction: Allow admin hostname traffic only from named administrative networks or a jump host, using firewall rules in front of the proxy.
  • Management interface: Keep the management port used for health and /metrics off the public network, since it is separate from the public HTTP listener.
  • Proxy headers: Confirm which forwarded headers the proxy sets and trusts, because the configuration keys for proxy headers and hostname settings differ between Keycloak releases.

Confirm the exact proxy and hostname configuration keys against the Keycloak version you run before you write the rules, and verify each rule with requests from an outside network.

Which admin access control fits which situation

This table compares the common ways to keep the Keycloak admin console and Admin REST API off the public internet, with what each option protects, when it fits and what it costs to operate. Read each row against your own operator workflow and your break-glass plan, because most production setups combine two or three of these controls rather than picking one.

ControlWhat it protectsWhen it fitsTrade-off to plan for
Separate admin hostnameKeeps admin paths on a hostname that public frontend URLs never reference, so routing and certificate rules can differ from the login pages.Almost every production realm, as the base layer before any network control.Requires DNS, TLS certificate and proxy configuration for a second hostname, and every operator client must be updated to use it.
Proxy path blocking on the public hostnameReturns an error for admin console and Admin REST API paths arriving from the internet, so a request that reaches the public edge cannot reach admin functions.Public deployments where the same hostname serves login and applications and you need a second guard against misrouting.Path rules must be reviewed after each upgrade because admin paths and static resources can change, and a missed path can leave an admin route open.
Network allowlistsLimits which source addresses can open a connection to admin paths, regardless of credentials.Fixed office or data center egress ranges, and teams that can present a known network identity.Breaks when operators work from home or mobile networks, and allowlists need owner review as IP ranges change.
VPN or bastion accessRequires operators to join a managed network path before they can reach the admin hostname, which keeps the console off the open internet.Organizations that already run a VPN or privileged access broker and want admin traffic to pass through it.Adds a login step for every administrative session and creates one more system that needs patching, logging and on-call coverage.
Administrator MFA through the master realm browser flowRequires a second factor for administrator sign-in, so a stolen password alone does not open the console.Any deployment with named administrators, and a baseline for compliance evidence on administrator authentication.Lockout risk if factors are lost, so recovery codes and a tested second path must be defined before enforcement. Confirm the exact flow settings for your release.
Dedicated named admin accountsTies every administrative action to one person in audit logs and lets you disable one account without affecting others.Teams with more than one operator, and any environment where administrator activity must be attributable.Needs an account lifecycle process for joiners, movers and leavers, and shared accounts often reappear under pressure.
Limiting master realm use for daily workKeeps day-to-day administration in a separate realm so the master realm holds only a few tightly controlled administrators.Multi-realm or multi-tenant deployments where operators should not hold rights across all realms.Requires a clear role and realm design, and realm-scoped permissions take planning to match what operators actually need.
Break-glass administratorProvides a documented path back into the console when the identity provider, MFA or proxy rules fail.Every production deployment that enforces any of the controls above.A break-glass account is a standing high-value target, so it needs strong credentials, restricted network reach, alerting on use and a tested procedure.

Setting up a separate admin hostname and proxy rules

This sequence moves the Keycloak admin console and Administration REST API onto a route that only administrators can reach, while public sign-in and token endpoints stay available on the public hostname. The result is a tested split between the two paths, with evidence that each control holds.

  1. Inventory current public paths and clients

    Before changing anything, the platform team lists every path Keycloak serves through the public hostname today, including /admin and the Administration REST API, and every client, integration and monitoring tool that calls them. Record which callers are browsers used by people, which are service accounts and which are CI or automation jobs. Confirm with the vendor documentation for the version in use which paths belong to the admin console and which belong to public frontend endpoints, because the production guide separates them. Done means you have a written list of admin paths, their callers and the networks those callers use, which becomes the baseline for every later check.

  2. Define the admin hostname or context path

    Choose a separate hostname (for example, an internal admin name) or a distinct context path for the admin console and Administration REST API, and set the Keycloak hostname settings so that admin URLs are generated on that route rather than the public one. The production guide calls for the admin console and Administration REST API to be exposed on a different hostname or context path from public frontend URLs. Confirm the exact hostname and admin URL configuration keys for your Keycloak version in the official production and administration guides before you set them. Done means a test request to the admin route resolves, and the admin console loads only through that route.

  3. Configure proxy rules for admin and public paths

    At the reverse proxy, serve admin paths only on the admin route and return a denial for those same paths on the public hostname, while passing the public login, token, OIDC discovery and account endpoints through unchanged. Keep TLS on both routes. Write the rules as an allowlist for public paths where your proxy supports it, so new admin endpoints are blocked by default. Confirm the production guide's path restriction guidance for your version and test the rule set against the inventory from the first step. Done means a request to an admin path on the public hostname returns a blocked response, and a request to a public login path still reaches Keycloak.

  4. Restrict the admin route by network

    Limit the admin hostname to the networks your administrators use, such as a management VLAN, a VPN range or a bastion, by enforcing source address rules at the proxy, load balancer or firewall. Keep the admin route off the public DNS zone if your architecture allows it. Confirm that health and metrics endpoints are reached through the management interface and not exposed publicly. Done means a request to the admin route from a source address outside the allowed range is refused, and the same request from an approved network succeeds. Record both results as evidence.

  5. Create dedicated admin accounts and require MFA

    Create named administrator accounts in a realm that is not used for application sign-in, remove or disable shared and default admin accounts, and assign only the roles each administrator needs. Require multi-factor authentication for these accounts using the OTP or WebAuthn options documented in the server administration guide, and confirm the required action or authentication flow settings for your version. Keep at least one recovery path documented and tested before you disable any existing account. Done means each administrator signs in with a named account, MFA is enforced on a test login, and the account list shows no shared administrators.

  6. Reduce master realm use

    Move day-to-day administration of application realms to administrator accounts that hold realm-scoped roles, and keep the master realm limited to the small set of break-glass and platform administrators. Review which clients, users and integrations still authenticate against master and migrate them. Store the break-glass credentials under your normal secrets process with access logging. Confirm the role model in the server administration guide for your version before changing assignments. Done means a review of master realm users and clients shows only the approved list, and a test of routine realm administration succeeds without master realm access.

  7. Verify admin blocking and public login together

    Run one closing test set from outside the allowed network and from a normal user browser. Request each admin path on the public hostname and on the admin route from an unapproved source, confirm the responses are blocked, then sign in to the admin console from an approved network with MFA. Finally, complete a test sign-in and token refresh for a representative application through the public hostname. Keep the outputs with the inventory and the proxy configuration so that changes can be compared later. Done means every blocked request is recorded as blocked, every public login flow succeeds, and the evidence is filed for your change record.

How the admin hostname, master realm and proxy fit together

The core decision is to treat the admin console, the Administration REST API, the management interface and the master realm as separate trust boundaries from the public login pages. End users reach the public frontend URL for their realm, where login, token and account endpoints live. Administrators reach a different hostname or context path that serves only the admin console and Admin REST API. The management interface, which exposes health and /metrics when metrics are enabled with --metrics-enabled=true, sits on its own port and should never be published through the proxy at all. Keycloak's production guide calls for exposing the admin console and Administration REST API on a different hostname or context path from public frontend URLs, and that separation is what makes the rules below enforceable.

The master realm is where administrator accounts live, so it deserves the same separation. Every admin login, whether through the console or a token request to the Admin REST API, is authenticated against the master realm, and a compromised master realm account can reach every other realm. Confirm which realms your administrators actually authenticate against, and plan to keep the master realm limited to a small set of named break-glass and platform accounts rather than day-to-day application realms. Ask your team to document which hostname each administrative tool uses, because operators, automation and monitoring often need different paths and that inventory is what the proxy rules must match.

A request for an admin path flows from the client, through TLS termination at the reverse proxy, to Keycloak. The proxy is the first place it can be denied: it should match admin paths and hostnames explicitly and return a refusal for anything that is not on an approved network or identity-aware route, before the request reaches Keycloak. Keycloak then applies its own checks, including authentication and role authorization in the master realm. Denial can happen at three layers (DNS or hostname routing, proxy path rules, and Keycloak authorization), and a sound design does not rely on only one. Test each layer separately by sending admin paths from an unapproved network to the public hostname and confirming the refusal is recorded in proxy logs.

Where admin requests are allowed and blocked

The diagram starts with three request sources: users on the internal user network, administrators on a dedicated admin network, and anonymous traffic from the public internet. A reverse proxy with path rules sits in front of Keycloak and decides each request. Public login and token paths reach the public frontend hostname, while requests to the admin console and Administration REST API are allowed only from the admin network to the restricted admin hostname. Check that every denied path returns a block at the proxy, and that admin requests that do arrive are still challenged by MFA in the master realm.

Allowed and denied request paths through the proxy to Keycloak.

Security and operational risks to manage after lockdown

Locking down the admin console is not a one-time change. Proxy rules drift, administrator accounts accumulate, and recovery paths go untested, so each control below needs an owner and a record. The cards pair each risk with the check and the evidence an internal auditor is likely to ask for.

Proxy rule drift after upgrades

An upgrade, a new ingress controller or a changed load balancer can quietly re-expose /admin or the Administration REST API on the public hostname. Treat the proxy configuration as code, keep it in version control, and rerun the same external request tests after every change. Confirm that the path rules still block admin paths from the public frontend host. The evidence to keep is the reviewed proxy configuration, the test log from each change, and the change ticket that approved it.

Keycloak production guide

Shared or lingering admin accounts

Shared administrator logins make it impossible to attribute a change to a person, and dormant accounts that keep master realm rights are an easy target. Each administrator should have a named account with MFA, and access should be removed when the role changes. Review the list of users holding admin roles on a set schedule and disable anything without an owner. The evidence to keep is the role assignment export, the review sign-off, and the offboarding records for administrators who left.

Master realm used for applications

When application clients and end users live in the master realm, a compromise of an application's credentials can reach the realm that controls the whole server. Keep the master realm for administration only and place applications in separate realms. Check that no application client, user directory or identity provider is defined there. The evidence to keep is the realm inventory showing the master realm's contents and the design note that states which realms exist and why.

Lost admin access and recovery

If the only administrator loses MFA or the proxy blocks every route, the team may be forced into an emergency change. Plan a break-glass path before lockdown: a second named administrator, stored recovery codes, and a documented way to reach the admin endpoint from the management network. Test that path in a non-production environment. The evidence to keep is the recovery runbook, the date of the last successful test, and the custody record for recovery material.

Metrics endpoint exposure

Keycloak serves Prometheus-format metrics at /metrics when started with --metrics-enabled=true, and those metrics reveal operational detail useful to an attacker. Confirm that the endpoint is reachable only on the management interface and from the monitoring network, never through the public proxy. Verify the setting in the running server and from outside the network. The evidence to keep is the scrape configuration, the network rule that limits access, and the external test result showing the endpoint is unreachable.

Keycloak metrics guide

Admin event logging and review

Admin actions are only useful for investigation if they are recorded and someone reads them. Enable admin event logging with details, forward the records to a central log store, and review changes to clients, roles and identity providers on a defined cadence. Alert on administrator logins from unexpected networks. The evidence to keep is the logging configuration, the retention setting in the log platform, and the periodic review record showing who checked which changes.

Questions teams ask before restricting admin access

How much effort does restricting Keycloak admin access take?

The effort depends mainly on how many entry points you have to close, not on the Keycloak version itself. Count the public hostnames that serve the admin console or the Administration REST API, the reverse proxies and load balancers in front of them, the number of realms and clients that reference admin-facing settings, and the number of people who currently sign in as administrators. Each proxy needs path rules, each admin account needs MFA and a dedicated identity, and each realm needs a review of who can reach its master realm. A small single-realm deployment with one proxy is a much smaller task than a multi-realm estate behind several gateways. Ask any quote to break the work down by these counts, and to state which items it assumes you already have, such as an internal DNS zone or a VPN.

Can our own team restrict Keycloak admin access without a partner?

Yes, if you have people who can administer your reverse proxy, network controls and Keycloak realms, and who have time to test changes before they reach production. The Keycloak production guidance covers the core pattern: a separate hostname or context path for the admin console and Administration REST API, and a reverse proxy that only exposes the paths public users need. The harder parts are usually organizational. Your team must agree who keeps admin rights, how break-glass access is handled, and how every change is verified from outside the network. A partner adds value when the team lacks proxy or identity skills, when the change must be evidenced for an assessment, or when the work has to finish inside a fixed window.

What do you need from our team to start this work?

Expect to provide access and time from three groups. From network and platform engineering, you need current network diagrams, a list of public and internal hostnames, the reverse proxy or ingress configuration, and a way to test from inside and outside your network. From the identity team, you need the realm list, the administrator accounts and their roles, the current MFA policy for administrators, and the identity provider used for admin sign-in. From the Keycloak owners, you need the Keycloak version, deployment method, and any existing change windows. Ask the quote to list each input, who supplies it, and how many working sessions it requires, so that your schedule is not the hidden constraint.

Does restricting admin access require a Keycloak upgrade or downtime?

Not necessarily. Separating the admin hostname and adding proxy path rules are configuration changes made at the proxy and at Keycloak's hostname settings, and they can often be rolled out without a version change. Whether you see a brief interruption depends on how your proxy is configured and whether you run more than one Keycloak node behind it. Changing the hostname settings can affect how redirects and issuer URLs are generated, so clients and bookmarks may need to be checked. If your current version is out of support or lacks a setting you need, an upgrade may be part of the plan. The Keycloak upgrading guide and your own staging test will tell you which steps are required for your version, so confirm this in writing before scheduling a production change.

How should break-glass administrator access work after we restrict the console?

Break-glass access is a small, tightly controlled set of administrator accounts kept for the case where your normal identity provider or MFA path fails. Keep these accounts out of daily use, store their credentials under dual control in a sealed location, and require MFA on them as well if your Keycloak version allows it. Alert on every sign-in, and record why each use occurred. Test the procedure in a non-production environment before you need it. Another common approach is to keep a path from inside your management network that bypasses the public proxy, so administrators can still reach the console when the public front end is down. Agree this design with your security team and document who can invoke it.

What does a DeployOpen engagement cover for admin console restriction?

DeployOpen works on fixed scope, so the written scope and deliverables are agreed before work starts. For this topic, a typical scope covers reviewing the current hostnames, proxy rules and admin accounts, designing the separate admin path and network restrictions, implementing them in your infrastructure, configuring MFA and dedicated administrator accounts, limiting master realm use, and testing the result from both inside and outside your network. Ask the quote to state which environments are included, whether documentation and evidence for internal reviews are delivered, and whether ongoing monitoring or a retainer is included. DeployOpen does not issue audit reports or certifications, so evidence prepared for an assessment is reviewed by your auditor. Pricing follows from the written scope and is not published as a list.

How do we confirm the restrictions actually work?

Verify from the outside. From a network location that should not reach the admin console, request the admin paths and the Administration REST API endpoints, and confirm that the proxy refuses them. From an approved administrator network, confirm that sign-in works, that MFA is enforced, and that dedicated accounts are the only ones in use. Check that public hostnames do not advertise the admin path in redirects or metadata. Keep the test commands, results and dates as evidence. Repeat the checks after every proxy change, Keycloak upgrade or new realm, because path rules are easy to bypass when a new route is added. Ask any partner to include a retest of the proxy rules and admin sign-in in the scope.

Limits to confirm in your environment

The admin console hardening pattern depends on details that change between Keycloak versions, proxies, operators and database setups. The cards below list what to confirm in your own environment before you commit to a design, so the plan rests on checked facts rather than assumptions.

Exact admin path and hostname settings

Confirm the hostname and admin path options for the Keycloak version you run, and test them in a staging environment. The production guide describes serving the admin console and Administration REST API on a different hostname or context path from public frontend URLs, but the exact option names and behavior are version-specific. Check how your version handles the admin hostname before writing proxy rules that depend on it.

Production guide

Proxy and ingress path rule support

Confirm that your reverse proxy, load balancer or Kubernetes ingress can block or route specific paths, methods and hostnames without breaking login flows. Some ingress controllers handle path prefixes differently from exact matches, and a rule that is too broad can block the public login endpoints. Test each rule with the public and admin hostnames before relying on it.

Operator behavior for hostname settings

If you run the Keycloak Operator, confirm how it applies hostname and proxy settings to the custom resource and whether a configuration change triggers a rolling restart. Pair this with the manual approval mode the operator documentation recommends for updates, so a version change does not silently alter the admin endpoint configuration. Record which settings the operator owns and which you manage yourself.

Operator installation docs

MFA options for administrator accounts

Check which second-factor methods your Keycloak version offers for administrator accounts, and whether your realm policies can require them for the master realm. Confirm that OTP and WebAuthn enrollment work for the admin users you plan to create, and decide how recovery codes will be issued and stored. Do not assume that an MFA setting applies to the admin console unless you have tested that login path.

Server admin guide

Database and high availability limits for admin changes

Confirm how admin-driven configuration changes replicate across nodes in your chosen high availability design, and that the database used for it is one of the supported production databases. Both supported multi-site designs depend on a synchronously replicated database, so a change made through the admin console on one site must reach every node. Verify this with a test change and a node restart before you rely on the admin path for emergency changes.

High availability overview

Compliance evidence requirements

Ask your auditor or compliance lead which evidence they need to show that administrative access is restricted, MFA is enforced and admin actions are logged. Keycloak can produce configuration and login records, but whether they meet a specific framework depends on your retention, review and access rules. Agree the evidence list before the build so that the admin restriction design can produce it.

Official Keycloak sources for admin hardening

Before you change anything about how the admin console and Admin REST API are reached, read the Keycloak production configuration guide first. It sets out the baseline the Keycloak project expects in production: TLS on all communication, a reverse proxy with path restrictions, and exposing the admin console and Administration REST API on a different hostname or context path from public frontend URLs. The page you are reading explains the design choices behind those controls. The production guide gives you the exact option names and the order in which to apply them, so treat it as the reference your configuration is checked against. Keep a copy of the version you deploy, since option names can change between releases.

The Keycloak server administration guide is the reference for what each admin-side control does inside the product. Use it to confirm how dedicated administrator accounts are created in the master realm, how roles are assigned to them, how OTP and WebAuthn credentials are configured for them, and where realm-level settings for brute-force protection and login behavior live. Its wording for each feature should guide the test cases you write, because a control you believe is on may be scoped to a different realm or client than you assumed. Confirm each setting in your own environment instead of relying on the default you remember.

Read the Keycloak upgrading guide before you move to a new release, because admin-related behavior can change between versions. Check it against the version you run and the version you plan to reach, including any changes to how the admin console is served and how administrator sessions are handled. Any hardening change you make should be retested after each upgrade, since a proxy rule that worked on one release may need adjustment on the next. Record which guide version you checked so the evidence for your internal audit points to a specific release.

How DeployOpen scopes and delivers admin access hardening

The sequence moves from a written scope to a reviewed baseline, a tested change set and a handover of evidence, so the admin console and Admin REST API end up off the public path with controls your own teams can review. Each step names what changes and what confirms it. The work runs in your infrastructure, under your change control.

  1. Agree the scope in writing

    Before any change, DeployOpen and your team agree in writing which hostnames, proxies, networks, realms and administrator groups are in scope, what is excluded, who approves changes and how access to your environment is granted. The scope lists the deliverables, including the configuration changes, test evidence and handover documents. Fixed-scope terms are the norm, so a quote follows from this document. The step is done when both parties have signed the scope and the change window process is confirmed.

  2. Review current exposure and configuration

    DeployOpen reviews the live setup in your environment: which hostnames and paths reach the admin console and Admin REST API, how the reverse proxy and load balancer route traffic, which firewall or ingress rules apply, who holds administrative roles and how many users work in the master realm. The review also checks whether the production guidance on separating admin and public frontend URLs has been applied. The output is a written baseline listing each exposed path, its owner and the planned change.

  3. Design the separate admin hostname and path rules

    Working with your network and platform owners, DeployOpen designs a separate admin hostname or context path, the proxy rules that serve only the admin console and Admin REST API on it, and the network restrictions that limit where it can be reached from. The design records which internal networks, VPN ranges or bastion hosts are allowed, and how public frontend URLs are kept apart. Your team approves the design before it is built. The output is a reviewed design document with each rule and its reason.

  4. Implement proxy, network and MFA changes

    DeployOpen applies the approved changes in a non-production copy first, then in production during the agreed window. Work covers the admin hostname, proxy path restrictions, network access rules, dedicated administrator accounts, MFA for those accounts through the realm's authentication flows, and a reduced use of the master realm for day-to-day administration. Changes are recorded in your version control or change system. The step closes when each change is in place and your administrators can sign in through the new path only.

  5. Verify the restrictions from outside the allowed network

    DeployOpen tests the result from networks and locations that should be blocked, confirming that the admin console, admin API paths and administrative login endpoints do not answer on the public hostname. It also checks that allowed networks reach the admin hostname, that MFA is required for administrator sign-in, and that a non-admin account cannot reach admin functions. Each test records the request, the expected result and the observed response. The step is done when every test matches the agreed expectation or a fix is logged and retested.

  6. Hand over configuration and evidence

    DeployOpen delivers the final configuration as it is deployed, a runbook for administrators covering how to sign in and how to recover MFA or account access, the test results from the verification step and a list of open items with owners. Your compliance or security team receives the evidence in a form it can file for internal review. DeployOpen does not issue audit reports or certifications, so the evidence supports your own assessors. The step closes when your named owner accepts the handover in writing.

  7. Test the admin surface and continue support

    After handover, you can ask DeployOpen to run security testing of the admin surface, covering the proxy, admin endpoints, administrator authentication and realm configuration, with findings and a retest. Ongoing support, configuration reviews and upgrades can continue under a retainer agreed in writing. Confirm which tests and support levels the written scope covers before work begins. The step is done when findings are closed or accepted, and the review date for the next check is recorded.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.