Clustering X-Road Security Servers behind an external load balancer

A Security Server cluster with one primary and several secondaries lets you spread X-Road message traffic across nodes behind a load balancer, but it depends on identical keys, replicated configuration and a primary that still holds the write path. This page covers the design, build sequence and limits.

On this page

When a Security Server cluster is the right way to clone X-Road availability

A Security Server cluster is a set of X-Road Security Server nodes with one primary and several secondaries, placed behind an external load balancer that sends exchange traffic to whichever nodes are healthy. Choose it when your organization's X-Road exchanges must stay up and a single Security Server is a single point of failure you cannot accept, and when you want one operational view of the configuration across the nodes. The secondaries carry the same member identity, keys and certificates as the primary, so a consumer or provider sees one logical Security Server behind the balancer.

Compare this with the built-in redundancy that X-Road offers through several Security Servers registered for the same member. That option needs no external balancer and each server is managed on its own, which is often enough for many members. The cluster design adds operational work: you own the load balancer, the database replication, the synchronization of configuration, and the procedure for promoting a secondary. Confirm with your X-Road contacts and the X-Road Security Server user guide which cluster behavior your release supports before you commit to this design.

Before you decide, check your foundations. X-Road is open source under the MIT license, so the software cost is license-free, but you will pay for infrastructure, PostgreSQL and the people who run them. Every Security Server needs PostgreSQL, either local or remote, and remote options include managed services such as AWS RDS and Azure Database for PostgreSQL, so plan the database tier as a shared dependency of the cluster. Confirm that your target Ubuntu or RHEL versions are on the supported list, and ask your team to write down who owns the load balancer, the database and the failover runbook.

Cluster or built-in redundancy: how the two designs differ

A single member organization with one X-Road membership and one provider identity is the situation where the cluster design is most often considered. In a cluster, one primary and several secondary Security Servers present the same identity to the rest of the ecosystem, so the member's services stay under one Security Server identity regardless of which node answers. Redundant servers registered for the same member are a different arrangement, where each server is a separate registration that consumers and providers can choose between.

  • Identity: a cluster shares keys, certificates and configuration so every node acts as the same member.
  • Registration: redundant servers each carry their own registration and are added to the member's configuration separately.
  • Certificate handling: a cluster needs identical keys and certificates on each node, which increases the number of secrets to protect and rotate.
  • Change control: configuration changes flow from the primary to secondaries, so the primary is a single point for administrative changes.
  • Fit: a member that must present exactly one identity to partners usually leans toward the cluster.

Confirm with your X-Road operator how your membership and service registration are recorded before choosing, because the registration model determines what a failover looks like to your partners.",

How the primary, secondaries and load balancer fit together

The diagram starts with consumers and producers sending exchange traffic to an external load balancer on TCP 5500 and 5577. The balancer spreads that traffic across the primary and secondary Security Servers, which share one identical set of keys and certificates. The primary writes its serverconf database to PostgreSQL, which replicates to the standby, and it pushes configuration to the secondaries with rsync. Check that the trust boundary holds: the admin UI on TCP 4000 and information system access on 8080 or 8443 stay on the internal network.

Traffic enters the balancer, configuration flows from primary to secondaries, and the database replicates.

What must be identical on every node: keys, certificates and configuration

Every node in a Security Server cluster must present the same identity. Consumers and other members of the X-Road ecosystem see the cluster as one Security Server, so each secondary has to hold the same signing and authentication keys and the same certificates as the primary. If a secondary signs or authenticates with a different key, the exchange fails in ways that look like certificate trust problems rather than a sync problem. Before building the cluster, list every key and certificate that the primary holds, record where each one is stored, and confirm with the vendor documentation for your release how the cluster is expected to receive them. Do not assume that copying a file list from an older guide still matches the release you run.

Hardware security modules change where those keys live. The Security Server supports PKCS#11 drivers through the xroad-addon-hwtokens package for RSA and EC keys. When keys sit in an HSM, each node must reach an HSM that holds the same key material and is configured with the same token labels, and the cluster design must state whether all nodes share one HSM or each node has its own HSM with the key replicated under the HSM vendor's process. Ask the HSM vendor and the X-Road documentation separately who is responsible for key replication and what happens to signing if one HSM is unreachable.

The configuration state has two parts that do not travel the same way. The serverconf database holds the Security Server's service registrations, access rights and client settings, and it must be replicated from the primary to each secondary using the database replication you build for it. Configuration files and other local state are synchronized with rsync, which copies what you select and nothing more. Confirm the exact list of files and database objects that your release requires, exclude anything that must stay node-specific such as local addresses, and run the sync end to end in a non-production environment, including a forced failover and a configuration change, before you rely on it.

Configuration options and when each fits

This table compares the five decisions that shape a Security Server cluster: database placement, key storage, configuration sync, load balancer layer and health check design. Read each row against your own availability target, staffing and audit requirements, then confirm the chosen options with your X-Road version and load balancer vendor before building.

DecisionOptionWhen it fitsTrade-off
Primary database placementLocal PostgreSQL on the primary nodeSmall clusters where one team owns every node and the database has no separate availability targetThe database fails with the primary, so the cluster has no independent database to fail over to
Primary database placementRemote or managed PostgreSQL (for example AWS RDS or Azure Database for PostgreSQL)Organizations that want database backups, patching and failover handled by a platform service they already operateAdds network latency and a dependency on the database service's availability, access and TLS configuration
Key storageSoftware keys held in the Security ServerDeployments where the hosting environment already meets your key protection policy and secondaries need identical key material copied inKey material exists as files on every node, so protecting each copy and its backups becomes an operating duty
Key storagePKCS#11 hardware tokens through the hwtokens add-onOrganizations whose policy requires keys to stay in hardware, with the HSM reachable from every node that signs or authenticatesEach node needs HSM connectivity and driver support, and HSM availability becomes part of cluster availability
Configuration syncScheduled rsync of configuration from the primaryTeams that want an automated, repeatable copy of configuration to secondaries and can tolerate a short lag between changesChanges are not visible on secondaries until the next run, and a failed run can go unnoticed without alerting
Configuration syncManual push after each changeClusters with infrequent configuration changes and a change process that requires a named operator to verify each nodeDepends on operator discipline, and a forgotten node can run stale configuration during an incident
Load balancer layerTCP passthrough with TLS left intact end to endSetups where mutual TLS between members and Security Servers must reach the Security Server unchangedThe load balancer cannot inspect HTTP, so routing and health decisions rely on TCP reachability and separate health checks
Load balancer layerTLS terminating at the load balancerEnvironments where the balancer must inspect or route on HTTP content and the design has been reviewed against the X-Road trust modelThe balancer becomes part of the trust boundary and changes how client certificates are presented, which needs explicit testing
Health check designShallow check of the listening portQuick detection of a node that has stopped accepting connectionsDoes not show whether the node can reach its database or has current configuration, so a degraded node can stay in rotation
Health check designCheck against the Security Server health check endpoint, with thresholds tuned to avoid flappingClusters that need the balancer to remove unhealthy nodes based on the server's own reported stateRequires enabling the endpoint and tuning interval and failure thresholds, and an overly sensitive setting can remove healthy nodes

How to build the cluster in order

This sequence takes a set of Security Servers from separate installs to one primary and its secondaries that share configuration, keys and certificates, sit behind an external load balancer, and have been proven to keep serving exchanges when a node is removed.

  1. Confirm platform and database support

    Check every planned node against the supported operating systems: Ubuntu Server 22.04 or 24.04 LTS on x86-64, or Red Hat Enterprise Linux 8 or 9, with at least 3 GB RAM (4 GB with monitoring add-ons) and 3 GB free disk. Decide whether PostgreSQL will be local or remote, including a managed service such as AWS RDS or Azure Database for PostgreSQL, and confirm that the database version is acceptable for the release you plan to install. Your team owns this check, and the installation guide lists the exact requirements. Done means you have a written node inventory where every machine meets the minimums and the database option is recorded.

  2. Install the same release on every node

    Install the same X-Road release, for example 7.8.3, on the primary and every secondary, using the packages or containers the installation guide describes for your platform. Mismatched versions are a common source of cluster problems, so pin the version and record it per node. Confirm the target release against the releases page before you start, since the supported versions are 7.8.3, 7.7.4 and 7.6.5. Done means every node reports the same installed version, and no node has been registered yet.

  3. Provision PostgreSQL with replication

    Build the database layer that the cluster depends on. The Security Server stores its serverconf database in PostgreSQL, so the primary and secondaries must be able to reach a database that is either replicated or managed with failover, and the replication design should be agreed with your database team before any node is pointed at it. Confirm the replication method, TLS between nodes and the database, and how failover is handled. Done means a test connection from each node succeeds and a write on the primary database is visible on the standby, which you verify with a simple query.

  4. Set identical keys, certificates and HSM access

    Make the primary and each secondary present the same signing and authentication keys and certificates, because the members must look like one Security Server to the rest of the ecosystem. If you use a hardware security module through a PKCS#11 driver with the xroad-addon-hwtokens package, confirm that every node can reach the module and load the same keys, and check RSA or EC key type support for your design. Store and transfer key material under your own controls. Done means every node lists the same key and certificate identifiers and the HSM token is visible from each node.

  5. Configure rsync of configuration files

    Set up the secondaries to receive configuration from the primary using rsync over a link you control, and schedule the sync so changes reach secondaries predictably. Restrict the account used for sync, limit which paths are copied, and confirm the key-based access works without passwords. Remember that this design has limits: configuration changes made while the primary is down cannot be applied, so document who can change configuration and how. Done means a test change on the primary appears on each secondary after the next sync, and a failed sync is visible in your logs.

  6. Register the cluster members

    Register the primary first, then add each secondary as a member of the same Security Server cluster through the admin interface, following the registration steps in the installation guide. Confirm that the admin UI on TCP 4000 is reachable only from your internal management network and that message exchange on TCP 5500 and OCSP on TCP 5577 are reachable from the external networks the ecosystem needs. Done means every node shows as a cluster member with the same owner and the same global configuration state.

  7. Place the external load balancer on TCP 5500

    Put the external load balancer in front of the cluster, balancing TCP 5500 with TLS passthrough so the Security Server keeps handling the TLS session and the message signatures. Configure a health check against each node so that a failed node is removed from rotation. Keep the design choices, such as which health endpoint to use and the check interval, in your change record. The configuration examples for haproxy, nginx and AWS Network Load Balancer are covered in the sibling topic on load balancer setup. Done means a client connecting to the balancer address completes a TLS handshake that reaches a node, and the node's certificate is the one expected.

  8. Verify with test exchanges and failover drills

    Run test message exchanges through the load balancer and confirm that responses arrive from more than one node. Then remove the primary and a secondary from rotation in turn, repeat the exchanges, and record which requests failed and whether clients retried them successfully. Restore each node and confirm configuration converges. The drills show what your clients must handle, including the possibility of lost messages on a failed node. Done means you have a dated test record with exchange results, failover results and the retry behavior your consumers need, reviewed by the owners of the systems that call X-Road.

Security controls a cluster must keep

A Security Server cluster multiplies the attack surface: every node holds the same keys, reads the same configuration database and exposes the same admin and service listeners. The cards below cover the controls that must hold on every node, the database and the link between them, so that a failover does not weaken the security of the cluster.

Account lockout and password policy

The X-Road hardening guide recommends locking accounts for 15 minutes after 3 failed logins and using passwords of at least 16 characters. In a cluster, these settings must match on the primary and every secondary, because an attacker who fails on one node should not get fresh attempts on another. Check each node after every upgrade or rebuild, since a restored node can come back with default values.

Hardening guide

Key-only SSH and allowed hostnames

Disable password logins over SSH so that only key-based access reaches each node, and restrict administrative access to named operators. Configure the allowed-hostnames setting so that a Security Server rejects requests with unexpected host headers, which closes a host header injection path. Because load balancers forward traffic with their own host names, confirm that the balancer's health check and forwarded requests still match the allowed list.

Protecting the replicated database and its credentials

The serverconf database holds the configuration that every node depends on, so its credentials are as sensitive as the keys. Use separate database accounts for each node with the least privilege needed, store passwords in a secrets manager or restricted files rather than in shared scripts, and limit which hosts can reach the database port. Ask who can change the replication user and rotate its password after staff changes.

TLS between nodes and the database

Replication and client traffic between each Security Server and PostgreSQL cross the network that the cluster runs on, so encrypt them. Require TLS on the database side, verify the server certificate on each node, and keep the database on a private network segment with no route from external networks. Confirm with your database platform how it enforces certificate verification, since managed services and self-hosted clusters differ.

Admin UI separated from external listeners

The admin UI listens on TCP 4000, while message exchange uses TCP 5500 and OCSP uses TCP 5577 from external networks. Expose only 5500 and 5577 to partner networks, and restrict 4000 to administrator subnets or a bastion. Your load balancer should forward the exchange ports only, so that no path from the internet reaches the admin interface on any node.

LDAP roles and protecting node keys

Admin users authenticate through PAM, and SSSD can map LDAP groups to X-Road roles such as Security Officer and System Administrator, so one directory governs every node. Keep role mappings identical across nodes and review them when staff move. Protect the signing and authentication keys held by every node, using hardware security modules where your policy requires them, and limit who can export key material during rebuilds.

Questions teams ask before clustering Security Servers

What does it cost to cluster X-Road Security Servers?

The cost is mostly labor and infrastructure, and the main drivers are how many nodes you run, how many information systems and services sit behind them, and how much of the surrounding environment you must build first. Cost falls into a few parts: the servers and their operating system licenses or support, a PostgreSQL database that you run or pay a managed service for, the external load balancer, and the people who design, build, test and hand over the cluster. Most of these are one-time costs, while infrastructure, database, monitoring and support contracts recur. Ask any quote to list each component separately, state who pays for each one, and name the testing and documentation deliverables included. DeployOpen agrees a fixed scope and deliverables in writing before work starts, and the quote follows from that written scope.

How long does it take to build a Security Server cluster?

Duration depends on the state of the environment more than on the X-Road steps themselves. The time usually goes to confirming network paths, opening the required ports, preparing the database, agreeing how keys and certificates will be copied to secondaries, and testing failover. Teams with a working single Security Server and a database standard in their organization can move faster than teams that must first provision servers, load balancers and approval workflows. Ask for a timeline built from a written scope with named milestones, and confirm which change windows and approvals your organization requires, since those often set the calendar more than the technical work does.

What must our team provide before a cluster build starts?

The team needs to provide the environment and the people who own it. Before work starts, confirm the following:

  • Supported hosts: Ubuntu Server 22.04 or 24.04 LTS on x86-64, or Red Hat Enterprise Linux 8 or 9, with at least 3 GB RAM (4 GB with monitoring add-ons) and 3 GB free disk space per node.
  • Database: PostgreSQL, local or remote, with network access from every node and a backup plan.
  • Network: the ports for message exchange, OCSP, the admin UI and information system access opened only where needed, plus load balancer reachability.
  • People: staff who hold or will hold the X-Road roles, such as Security Officer, Registration Officer, Service Administrator and System Administrator, plus a named owner for the load balancer and for the database.

Ask the partner to confirm which of these items it expects you to supply and which it will configure.

Can our internal team build an X-Road Security Server cluster alone?

A team that already runs X-Road and understands its PKI, member registration and configuration model can build a cluster on its own, provided it has someone experienced with the load balancer and the database. The harder parts are usually the ones that affect safety: keeping identical keys and certificates on every node, replicating the serverconf database correctly, syncing configuration with rsync, and testing what happens when the primary fails. A partner can add an outside review of the design, a documented runbook and a failover test. Whichever route you choose, make sure at least two people can operate the cluster without the original builder.

How do X-Road upgrades affect a clustered Security Server?

Upgrades touch every node, so a cluster needs a planned order of operations rather than a single change. Upgrades should follow the supported versions for your current release line, which are 7.8.3, 7.7.4 and 7.6.5 at the time of the researched facts, and you should confirm the upgrade steps for clustered nodes in the upgrade documentation before scheduling. Plan for a maintenance window per node, a test in a non-production cluster, a rollback path, and a check that configuration and database state match after each node returns. Ask any partner how it handles the primary and secondaries during an upgrade and what evidence it provides that the cluster still serves traffic afterwards.

Does a managed PostgreSQL database change the cluster design?

A managed database such as AWS RDS or Azure Database for PostgreSQL is supported for the Security Server, so it can replace a self-run database, but it does not remove the need for design decisions. You still have to confirm network connectivity from every node, the database version and extensions you need, how failover is handled by the provider, how backups and point-in-time recovery work, and how the provider's maintenance windows interact with your X-Road change windows. The cluster design itself, with a primary, secondaries and file-level synchronization of configuration, stays the same. Ask the provider and your partner to document these points in writing.

What should a partner contract cover for a cluster build?

A partner contract should state the scope, deliverables and acceptance criteria in writing before work starts, because most engagements are fixed-scope. Include the node count and platform, the load balancer configuration and health check approach, the database design, the key and certificate handling, the rsync and replication method, and the failover test you will witness. Also cover documentation and a runbook, knowledge transfer to named staff, what happens to access and credentials after handover, and whether ongoing support, upgrades or retesting are a separate retainer. Ask what the contract does not cover, especially limits on message loss during node failure, since a cluster does not remove that risk.

What clustering does not protect against

A Security Server cluster keeps message exchange running when one node fails, but it does not make failures invisible or harmless. The cards below list the limits to confirm against your X-Road release before you rely on the design, and the checks that show where each limit applies in your environment.

Messages in flight on a failed node

A request that is being processed when its Security Server node fails may not complete, and the load balancer can only redirect new connections. Messages on a failed node may be lost, so the consumer's information system must be able to retry safely. Confirm with NIIS documentation for your release how in-flight messages are handled, and test a node failure during a transfer in a staging cluster before go-live.

No configuration changes during primary outage

Configuration changes are made on the primary node, so when the primary is down, administrators cannot add members, services, access rights or certificates. Secondaries keep serving traffic with the configuration they last received. Plan an operator runbook that names who promotes or repairs the primary, and confirm the procedure against your release before an outage occurs.

Eventual consistency across secondaries

Configuration reaches secondaries through database replication and rsync, so a secondary can briefly run an older configuration than the primary. Two nodes may answer the same request differently during that window. Confirm the replication and synchronization intervals for your release, and check after each change that every node reports the same configuration before you consider the change complete.

Compromised keys and bad changes

Clustering copies the same keys and certificates to every node, so a compromised signing key or a faulty configuration change is replicated to all of them. Redundancy does not limit the blast radius of either event. Keep a tested procedure to revoke and replace keys, restrict admin roles on the primary, and keep configuration backups that predate any change you are unsure about.

Not a substitute for Central Server HA

A Security Server cluster protects the member's own exchange point, but it does not keep the Central Server running. Security Servers depend on the global configuration distributed by the Central Server, so an outage there affects your cluster even when every node is healthy. Assess Central Server availability separately, and confirm with your operator how long cached global configuration remains usable.

Operating the cluster after go-live

Once the cluster is serving traffic, the first operational question is whether every secondary still matches the primary. Watch the replication status of the serverconf database on each secondary, and alert on lag or on a replication stream that has stopped, since a secondary that silently falls behind will serve stale configuration if it is promoted. Pair that with a check that the rsync job that copies configuration files runs on schedule and reports failures, and that the key and certificate material on each node still matches the set agreed at build time. Confirm with your database team how replication lag is exposed in your PostgreSQL platform, because the exact views and thresholds depend on that setup and on your managed service if you use one. The health check endpoint that the load balancer polls should be tested on each node, and you should confirm what it reports and how quickly a failed node is removed, so that a brief blip does not cause the balancer to flap.

Write two runbooks before go-live and rehearse both. The primary failure runbook covers how to decide that the primary is lost, which secondary becomes the new primary, how configuration changes are frozen while the primary is down, and how the former primary is rebuilt before it rejoins. Because configuration changes cannot be made while the primary is unavailable, agree in advance who is authorized to promote a node and how the decision is recorded. The secondary replacement runbook covers rebuilding a node from a known-good image or host, restoring the matching keys and certificates from your protected store, pointing the database connection at the current replica, and confirming the load balancer only routes to the node after its health check passes.

Upgrades need their own sequence. Do not upgrade the primary and all secondaries at once. Plan the order of 7.x release upgrades node by node, confirm the target release is one of the supported versions listed in the X-Road releases page, and check whether the configuration database schema changes between your current and target release before you start. Take a backup of each node and the database before each step, and keep a tested rollback path. The X-Road upgrade topic is where release-specific steps belong, and the X-Road monitoring and operations topic covers the diagnostics and backup procedures these runbooks depend on. Confirm the exact upgrade order with the release notes for your target version before you schedule any change window.

How DeployOpen scopes and delivers an X-Road Security Server cluster

DeployOpen plans, builds, tests, documents and supports self-hosted open-source platforms inside the client's own infrastructure, including X-Road Security Server clusters behind an external load balancer. Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we scope

  • Inventory the Security Servers, primary and secondary roles, and the database and load balancer each node depends on.
  • Confirm the X-Road release, supported operating system and PostgreSQL setup against the installation guide before any build.
  • Agree in writing which failure cases the cluster must survive and which recovery steps stay with the client's team.

How we build

  • Install the primary and secondaries with identical signing keys and certificates, and verify key and certificate handling on each node.
  • Configure serverconf database replication, rsync of configuration, and load balancer health checks with TLS passthrough.
  • Test failover of the primary and secondaries, and retest message exchange through the load balancer after each change.

How we hand over

  • Deliver written runbooks for node addition, failover, configuration sync checks and rollback, written for the client's operators.
  • Document the cluster's documented limits, including message loss on a failed node and configuration changes during primary outage.
  • Walk the client's operations and security teams through the design, test results and open items before handover closes.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, scoped separately from the build.
  • Support can cover X-Road upgrades within supported 7.x releases, with the upgrade path confirmed against current release notes.
  • Retesting after configuration, certificate or load balancer changes can be added to the retainer or scoped as a separate engagement.

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.