Managing X-Road management API keys securely

Automation that calls the X-Road management REST API needs its own credentials, and each key must be scoped, stored, rotated and revoked like any privileged account. This page explains the decisions, the setup sequence and the checks to run before you rely on keys in production.

On this page

How to manage X-Road management API keys securely

Each management API key is a standing credential, so every key needs a named owner, a narrow scope, a storage location and a revocation path before it is issued. Teams usually need keys when a script or CI pipeline repeats configuration work, when a monitoring system must read Security Server state on a schedule, or when onboarding automation must act without someone signing in to the admin UI each time. A manual admin session remains the better fit for one-off changes, for approvals that need a named person on record, and for any change to security settings, because an interactive login ties each action to one accountable person. Check key formats, endpoints and request details against the management REST API documentation for the release you run (7.8.3, 7.7.4 or 7.6.5), since these details differ by release and should be taken from that documentation directly.

Scope each key to the single Security Server role its job needs. The five roles are Security Officer, Registration Officer, Service Administrator, System Administrator and Security Server Observer, and each covers a different part of administration. A monitoring integration should not hold a role that can change configuration, so map it to Security Server Observer after confirming in the Security Server user guide which operations that role permits. If you authenticate admin users through PAM with SSSD and LDAP, place each owning account in a dedicated directory group, so that group membership controls access and removing the account becomes part of the revocation procedure. Confirm whether a key is bound to a local or LDAP-backed account and what happens to it when that account is disabled. Apply the lockout and password settings the hardening guide recommends to every account behind a key, including the 15-minute lock after 3 failed logins.

Store each key in a secrets manager or the CI platform's protected secret store, never in a repository, job log or shared script, and restrict read access to the one pipeline or service that needs it. Record each key in an inventory with its owner, purpose, role, storage location and rotation date, so that an owner leaving the team does not leave an orphaned credential behind. Before go-live, test revocation: disable or remove the key, confirm that the next call fails, then reissue it. In a Central Server high availability setup, also confirm that a revoked key is refused by every node the automation can reach, because a credential that still works on one node undermines the revocation. Confirm how that propagation behaves in your release before you rely on it.

Key design options and when each fits

This table compares the main key design choices for X-Road management API access, from how many keys exist to where they live and how often they change. Read each row for what it protects against, what it costs to run, and what to confirm in the release you operate. Pick the combination your written access policy can actually enforce and audit.

OptionWhat it protects againstWhat it costs to operateWhat to confirm in your release
One key per automation jobLimits the damage from one leaked key and makes revocation specific to one job.The most keys to create, scope, rotate and record. Cost grows with each new job.How keys are created and revoked, and how each key appears in logs. Check the vendor documentation for your version.
One shared key across jobsLittle. A leaked key exposes every job, though revoking it stops all of them at once.The fewest keys to manage, but every rotation touches every automation tool.Whether all dependent jobs can switch to a new key together without a service gap.
Scope keys to the five Security Server rolesLimits a key to the duties of one role, such as read-only monitoring or service administration.Mapping work up front, plus re-checking the mapping after each role or policy change.Which API calls each role can reach, and whether a key can be bound to one role. Confirm in the Security Server user guide.
Dedicated service account on the hostTies automation actions to one local identity, so host logs show which job acted.Account setup, PAM or directory mapping, and credential handling on each host.How the account interacts with lockout and key-only SSH settings in the hardening guidelines.
Keys held only by the automation toolKeeps key material off the Security Server host, so a host compromise exposes fewer keys.Secret store access controls, reviews of who can use the tool, and rotation steps in every pipeline.Where the tool stores secrets, who can read them, and whether each use is logged.
Rotation on a cadence set by written policyShortens how long a stolen key stays useful and gives assessors a dated record of changes.Recurring rotation work, plus testing that each job picked up the new key.The interval your policy sets, and whether your release allows old and new keys to overlap during a change.

How an automation key reaches the management API

The flow starts in the automation network, where a CI job reads its key from a secret store and crosses into the Security Server host. The management REST API checks the key first, and a revoked key is rejected there and logged. A valid key then passes the PAM and role check before any configuration change. Confirm the secret store is reachable only from the job runner, and that accepted and rejected calls both reach the audit trail. The diagram shows the order of checks only; confirm exact endpoints in the release documentation.

Illustrative flow of a key request, from automation job to audit trail.

Creating a scoped key and verifying it before production use

This sequence takes a management API key from an approved change record to a key that has passed one read-only call, one audit trail check and one controlled write in a test environment. Each step closes with a check, so the team can show who created the key, what it can do and where its activity is recorded before production use.

  1. Confirm the release and intended key role

    The change owner checks the installed X-Road version against the supported releases (7.8.3, 7.7.4 and 7.6.5 at the time of writing) and confirms which management API operations the intended role needs. Use the user guide and management API documentation for that exact installed version, because menus and endpoints can differ between releases. Done when the change record names the release, the role and each operation the automation will call.

  2. Record owner and expiry in the change record

    Before anything is created, the requesting team and the approver write the key's named owner, business purpose, permitted operations, storage location and expiry date in the change record. The expiry date should follow your key lifecycle policy, so confirm the required period with your security team before setting it. Done when the approver signs off the record and the owner is a named person or service account accountable for rotation and revocation.

  3. Create the key with the narrowest scope

    An administrator with the approved role creates the key through the menu path or management API call documented for the installed version, selecting only the role and operations listed in the change record. Test the scope before moving on: an attempt at an operation outside the record should be denied, and the key's details should show only the approved role. Done when the key's scope matches the change record line by line and the denied attempt is logged.

  4. Store the key in the approved secret store

    Copy the key into the approved secret store once, limiting read access to the automation account that needs it. Keep it out of shell history, configuration files in version control, tickets and chat. Record the store path, not the secret, in the change record. Done when the automation account can retrieve the key from the store and a search of the repositories, pipeline logs and tickets finds no copy of it.

  5. Make one read-only call

    The automation account makes a single read-only request from the environment where the key will run, using a call that the management API documentation lists as a read operation. Record the expected response code and the fields you expect in the body before sending the request, so the comparison is made against a written prediction. Done when the response matches the expected result and the call succeeds using the stored key.

  6. Confirm the call in the audit trail

    Find the entry for that call in the Security Server audit log, using the log location documented for your installed version. The entry should show the key's identity, the endpoint called, the time and the result. Done when the entry exists under the key's identity and matches the read-only call you made. If the entry is missing or shows a different identity, stop and investigate before the key is used for anything else.

  7. Run one controlled test write

    In a test environment running the same release, the team makes one write that the change record allows, targeting a single clearly named test object. Before sending it, write down the configuration state you expect afterwards. Done when the configuration shows the expected change, the audit trail holds a matching write entry, and the test object is removed or documented as left in place.

  8. Close the record and approve production use

    Attach the outputs from each check to the change record: the read-only response, the audit entry, the denied out-of-scope attempt and the test write results. The approver then decides whether the key may move to production, and the rotation and revocation dates are added to the record. Done when the approver signs the record, the key is enabled in production and its owner is named in the record.

Rotating and revoking keys without breaking pipelines

Rotate a management API key by overlapping the old and new keys so that pipelines keep working throughout the change. Issue the replacement key while the existing key still authenticates, then store the new value in your secret store and update the pipeline variables that read it. Trigger one scheduled or manual run and confirm it succeeds with the new key, checking the API responses and any logs you collect that show which key identifier each call used, if your installed release records it. Only after that run succeeds should you revoke the old key. Then make a test call with the old key and confirm it is refused. Keeping revocation as its own step means a failed run still leaves a working fallback. Record the date, the affected pipelines and the person who made each change in your change system, so the next rotation starts from a known inventory of where each key is used.

Revoke emergency keys immediately when a runner, a laptop or a log file may have exposed a key, and do not wait for the next rotation window. Make emergency revocation a short, pre-approved action so that the on-call engineer can act at any hour without waiting for a change board. Confirm in your role mapping which of the five Security Server roles can revoke an API key, and whether a second person must approve the change. After revoking, check that calls made with the exposed key are refused. Then rotate any other secret that appeared beside it, such as pipeline tokens or database credentials that were written to the same log. Record who revoked the key, when, why, and which systems may have been exposed in your incident record, and handle the log copy under your evidence rules, since it may contain sensitive values.

How often to rotate is a policy decision for your organization. It should follow your risk assessment, the sensitivity of the services each key reaches and what your auditors will expect to see. Set the interval in policy first, then decide how far the procedure can enforce it. Before any of these steps go into a runbook, confirm with the X-Road releases documentation for your version whether management API keys support an expiry date and whether two keys can be valid at the same time. The supported 7.x releases are 7.8.3, 7.7.4 and 7.6.5, and support for expiry and overlap may differ between them. Without an overlap window, the rotation above becomes a cutover with a short gap in access, so the runbook must describe only the pattern your release actually supports. Test both steps on a non-production Security Server first, and keep the test record as evidence that the procedure works.

Extra considerations for a Central Server HA setup

On a single Security Server, the node that hosts the management API is the only place where keys are created, validated and audited. This shape is the simplest to reason about, so it is the baseline the other two tabs build on. Confirm the exact steps for your release in the Security Server user guide before you script them.

  • Creation and validation: Keys are created and checked on the same host, so a key that fails validation points to one configuration to inspect.
  • Node coverage: Only one node holds the key, so the question of whether it works on every node does not apply.
  • Revocation: Revocation takes effect on that node. Confirm whether any session or token outlives revocation and for how long.
  • Audit entries: Confirm where audit records are stored on the host and how your team exports them to a central log store.
  • Automation address: The tool calls the node directly, so its TLS name, firewall rule and retry logic all point at one host. Confirm which port and network path the management API uses in your release.

Check that a revoked key fails on the next call from the automation tool, and record the result in your change log.

Storing and protecting keys in automation tools

A management API key is only as protected as the pipeline, runner and network path that hold it. The six areas below cover where keys tend to leak or get over-used, from the CI system that stores them to the admin interface that accepts them. Each card names one risk and the control that addresses it, followed by a check you can run in your own environment.

Secret storage in CI tools

A key stored as a plain pipeline variable can be read by anyone who can edit the pipeline. Keep each management API key in a secrets store your team operates, and limit access to the jobs that call the API. Check who can edit pipeline definitions, protected variables and project settings, since those people can read the key even when the UI masks it.

Keys leaking into logs

Debug output, verbose HTTP tracing and echoed command lines can print a key into job logs or build artifacts. Turn off request tracing in scripts that call the management API, and avoid passing keys as command-line arguments, where process listings and shell history can capture them. Search retained logs and artifacts for the key pattern, and confirm how long your CI system keeps them before you rely on masking.

Runner hosts that outlive jobs

A long-lived runner or agent host keeps copies of the key in its workspace, cache and environment after the job has finished. Use ephemeral runners, or clear workspaces and caches at job end, and keep the key out of shell profiles and agent configuration files. Check whether runner images, dependency caches and backups or snapshots of agent hosts sit inside your retention scope, because those copies outlive the job.

Over-broad keys shared across pipelines

One key shared by several pipelines means a single leak exposes every system those pipelines can reach. Issue a separate key for each pipeline or environment, give it the narrowest role that pipeline needs, and record an owner for each key so a revocation does not break unrelated jobs. Compare your key inventory with the pipelines that reference each key, and remove any key that no pipeline still uses.

Admin UI and API exposure

The admin UI listens on TCP 4000, and anything that can reach that port can attempt to use the management interface. Restrict TCP 4000 to a management network or jump host, and deny it from information system and general user segments. Confirm which port and path your version uses for the management API, restrict it the same way, and review firewall and load balancer rules that forward broad internal ranges to the host.

Installation guide

Hardening baseline under the keys

Weak host authentication lets an attacker who reaches the server guess their way into the account that manages the keys. The X-Road hardening guide recommends locking accounts for 15 minutes after 3 failed logins, passwords of at least 16 characters, key-only SSH, and the allowed-hostnames setting against host header injection. Check each setting on every Security Server, including standby nodes, and keep the results as evidence for your review.

Security hardening guide

How much effort and cost does API key management take?

What makes X-Road API key management take more or less effort?

Effort rises with how many moving parts the keys touch. The main drivers are:

  • The number of pipelines and automation tools that call the management REST APIs, since each one needs its own key, scope and rotation step.
  • The number of environments, such as development, test and production, because keys and approvals usually differ by environment.
  • Whether the Central Server runs in high availability, which adds a shared database and a second node to check for every key change.
  • How much audit evidence you must keep, including who created, used and revoked each key and where those records live.
  • How many of the five Security Server roles are split across people, since each split adds an approval path that must be designed and tested.

A single-environment setup with one pipeline is a much smaller job than the same design across several environments with an HA Central Server.

Can an internal IT team manage X-Road API keys without an outside partner?

It can, if the team already runs Linux services and PostgreSQL and can own the change process. The work draws on several skills:

  • Linux administration, plus PAM and SSSD configuration, since Security Server admin logins are authenticated through PAM and can map to LDAP groups.
  • Hands-on experience with the management REST API and the admin tasks it supports.
  • Secrets handling, including how automation tools retrieve keys from a secret store without writing them to files.
  • Change management and audit logging, so approvals and key events can be shown to reviewers.
  • Testing, so revocation and rotation are proven in a non-production environment before anyone relies on them.

Check these skills against your own environment before deciding. A team missing one of them can bring in a partner for the design and keep day-to-day operations in house.

What does the client need to provide before API key work starts?

The work depends on decisions only your organization can make, so named people are needed from the start. Expect to provide:

  • Named owners for each key, each pipeline and each Security Server role, with a backup for every owner.
  • Change approvers who sign off on key creation, scope changes, rotation and revocation.
  • Access to test environments close enough to production to prove a rotation or revocation before it runs in production.
  • A secret store approved by your security team, and confirmation of how automation tools authenticate to it.
  • Read access to the current X-Road configuration, the admin account list and the audit log locations.

Missing owners or test access can hold up this kind of work, so confirm both before the written scope is signed.

How long does X-Road API key management take to deliver?

Duration follows scope, so the same design can take very different amounts of time depending on what is included. A single environment with one pipeline is a smaller job than several environments with a highly available Central Server, split roles and an audit trail an assessor will review. The drivers match the effort drivers: pipelines, environments, HA, evidence and role splits. Client response time matters too, since owners, approvers and test environments set the pace. Most engagements are fixed-scope, so the timeline and milestones are agreed in writing before work starts. Ask each milestone to name the client input it depends on, and ask when the revocation and rotation tests will run, since those tests should happen before the procedures are relied on.

Does X-Road 8 change how API keys should be designed?

Plan for a possible change, but do not build a new key model around X-Road 8 yet. The current release is 7.8.3, and 7.8.0 was the last new-feature release of the 7 line. NIIS intends to keep X-Road 7 maintained with bug fixes and security patches beyond 2026, but the length of that period has not been decided. X-Road 8 "Spaceship" is available for testing as 8.0.0 Beta 2, with production scheduled for December 2026. Before you write automation against the 8 management APIs, confirm the endpoints, key handling and role model in a test environment. Keep key lifecycle steps in documented procedures so they can move to the new release, and check the X-Road releases page for final release notes.

What should a written quote for API key management include?

A quote follows from the written scope, and DeployOpen does not publish a price list, so compare proposals on scope first. Ask that the quote state:

  • The systems covered, including each Central Server and Security Server, the pipelines and environments, and whether Central Server HA is in scope.
  • The roles and approval paths to be designed, and which of the five Security Server roles map to directory groups.
  • Deliverables such as key lifecycle runbooks, rotation and revocation procedures, secret store integration and audit evidence.
  • Testing, including revocation tests and a retest after fixes.
  • Client inputs, such as owners and test access, and what happens if they arrive late.
  • Exclusions, assumptions and the timeline with milestones.
  • Post-delivery support options, including any retainer for rotation, upgrades and reviews.
Which API key costs are one-time and which ones recur?

One-time costs cover design, build, the first rotation cycle, documentation and testing. Recurring costs cover the work that keeps keys controlled after go-live:

  • Scheduled rotation and access reviews, which take staff time every cycle.
  • Revoking keys when people or pipelines change, and recording who approved each revocation.
  • Reviewing audit logs and key use, which needs a named owner.
  • Upgrades to new X-Road releases, which can change the management API and need a retest.
  • Retainer support, if you buy ongoing support, upgrades or continuous testing from DeployOpen.

Ask the quote to split one-time and recurring work, and to name who performs each recurring task. Confirm with your secret store vendor whether licensing or hosting carries recurring charges, since those sit outside the X-Road work.

Does API key management help us pass a compliance audit?

It can supply the controls and evidence an assessor asks for, but DeployOpen does not issue audit reports, attestations or certifications. Independent auditors and certification bodies perform that step. The work typically produces:

  • A key inventory with owners, scopes and purposes.
  • Approval records for creation, scope change, rotation and revocation.
  • Test results showing that revocation and rotation work as documented.
  • Audit log settings and retention locations for key events.

Before work starts, ask your auditor which control IDs and evidence formats they expect, and map each deliverable to them. Confirm with the auditor that an approval workflow meets a requirement before you count on it.

What to confirm in your release and environment

Six questions decide whether the design in this guide holds in your environment, and the published material does not settle any of them. Confirm each one against the user guide and management API documentation for X-Road 7.8.3, 7.7.4 or 7.6.5, whichever matches your release. Your answers set the rotation runbook: how often keys change, where they are stored, and how revocation is verified.

Operation or role scoping

Find out whether a management API key can be limited to specific operations, or only assigned to one of the five Security Server roles. If keys carry only a role, an automation key may inherit more rights than its job needs, and the role becomes the access boundary. If operation-level scoping exists, issue one key per pipeline and list its permitted calls in the runbook. Request the scoping model in writing, then test it with a key that should be denied one call.

Security Server user guide

Expiry enforcement by software

Confirm whether the management API rejects a key once its expiry date passes, or whether expiry is only a date your team tracks. If the software does not enforce it, an expired key keeps working until someone deletes it, and your rotation calendar becomes the only control. Test this on a non-production Security Server: create a key with a near expiry, wait past it, and record the response. If the software enforces expiry, the runbook can rely on it. If it does not, the runbook needs an automated check that lists every key with its age.

Key storage on the server

Find out how the server stores key material: as a hashed or readable value, encrypted at rest, or in plain form in the database or on disk. Also confirm whether a key can be shown again after creation. If only a hash is kept, a lost key means issuing a new one and updating every pipeline that holds the old value. Check whether database backups contain key material, and whether an administrator who creates keys can read them later. Those answers affect both backup handling and incident response.

Acceptance on every cluster node

In a clustered Central Server or Security Server setup, confirm whether a key created on one node is accepted by every node accepts the key each other node, and how long that takes. If key state sits on a single node instead of the shared database, a load balancer can send a pipeline's call to a node that rejects it. Create a key on one node, then call each node directly and through the load balancer. Record the result for each supported release, because it changes the order of steps when you rotate a key across the cluster.

Revocation timing in HA

Establish how quickly a revoked key still accepted stops working on every node, and whether any cached session or token survives revocation. A node that has not yet received the change can accept a key that your security team has already withdrawn. Ask for the propagation behavior in writing, then measure it: revoke a test key, then call each node in turn until the call fails. The measured window is the limit you state to security reviewers, and the runbook orders revocation and credential removal around it.

Audit log coverage

Confirm whether API calls are logged into the audit log, and which fields it records: the identity behind the key, the operation, the source address, the time and the outcome. Check whether failed authentication attempts are logged too. Without these entries, an investigation cannot separate a key's last legitimate use from misuse after rotation. Make one call with a test key, then search the log for it. The answer decides whether rotation evidence comes from the audit log or from your automation's own records.

How DeployOpen scopes and supports API key management

DeployOpen treats API keys for the X-Road management REST APIs as privileged access that is planned before any key is created. We scope which automation needs which calls, build the key lifecycle and secret storage in your environment, and document how keys are rotated and revoked. Engagements are fixed-scope, with the scope agreed in writing before work starts.

How we scope

  • Inventory every automation tool and job that would call the management REST APIs, and the operations each one needs.
  • Map each key to one server, one purpose and one owning team in the written scope.
  • Agree in writing which administrator roles may create, rotate or revoke keys, and who approves those changes.

How we build

  • Create keys in a test environment first, then confirm each key reaches only the calls in its scope.
  • Store secrets in your existing vault, with read access limited to the jobs that use each key.
  • Document the rotation and revocation steps as runbooks, and test them on a staging Security Server before go-live.

How we hand over

  • Deliver the key inventory, scope matrix, storage locations and owners as documents your team keeps.
  • Walk your operations and security staff through creation, rotation and revocation, using your own environment.
  • Provide runbook test records so reviewers can see the revocation path was exercised.

How we support

  • Retainers can cover scheduled rotations, key reviews after staff or tool changes, and upgrade testing.
  • Re-check key scopes and runbooks after each X-Road upgrade, confirming the management API behavior in your version.
  • Ask for the retainer scope in writing, including who responds to a suspected key leak and through which channel.

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.