How to Configure Opensearch Replication User
You set up an opensearch replication user by creating matching roles on both clusters. You then map a dedicated account to those roles for cross-cluster data sync. Many teams take a shortcut and assign full admin rights to this account. Broad permissions make setup fast, but they create a major security risk. If one cluster gets breached, the attacker gains full control over the other. How to set up an opensearch replication user Cross-cluster replication uses a follower cluster to pull data
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up an opensearch replication user by creating matching roles on both clusters. You then map a dedicated account to those roles for cross-cluster data sync. Many teams take a shortcut and assign full admin rights to this account. Broad permissions make setup fast, but they create a major security risk. If one cluster gets breached, the attacker gains full control over the other.
How to set up an opensearch replication user
Cross-cluster replication uses a follower cluster to pull data from a leader cluster. The follower needs a specific account to read changes from the leader index. You start by setting up a secure trust link between the two clusters. Both clusters must check and trust each other using valid security certificates.
Next, you define a leader role on the source cluster. This role only needs permission to read index data and check cluster state. It should never have permission to write or delete data on the leader. You then create a follower role on the destination cluster. This role needs rights to write data and manage the local replica index.
Finally, you create the user account and map it to these new roles. When a replication task starts, the follower cluster logs in with this account. It pulls batches of index changes from the leader and writes them locally. You should scope the role to specific index names rather than all indices. This keeps private indices safe from unintended sync tasks.
Why team-level roles need careful scoping
In many setups, human engineers also need rights to start or stop replication. Teams often share the main replication user login to run these manual tasks. Sharing a single account across a whole team hides who ran which command. If someone stops a sync task by mistake, the audit log shows one shared name.
A better pattern separates the background service account from human admin accounts. The background account runs the ongoing sync job between the two clusters. Human admins log in with their own accounts to check or fix tasks. Each person gets a narrow role that only controls sync state. They do not get raw write rights on the underlying index data.
User Provisioning (SCIM) + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native roles solve and what they leave open
Native roles do a good job of controlling which cluster can log in. They verify the account name and check the basic index permission list. This stops an untrusted cluster from reading your leader data without a valid key. It also keeps the follower cluster from changing data on the leader.
Still, native setup only checks who logs in at the start of a session. It does not inspect individual requests or filter sensitive fields in flight. If an engineer queries the replica index, native roles return the full document. This exposes raw emails, phone numbers, card numbers, and national IDs in query results. Native roles also force teams to manage static passwords or keys across clusters. Rotating those keys takes manual work and can break active sync jobs if mistimed. Teams still need a way to inspect live queries and mask sensitive fields.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.
Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Does the opensearch replication user need admin rights on the leader cluster?
No, the account only needs read permissions on the specific source indices. Giving it full admin rights exposes the leader cluster to unnecessary risk.
How do leader and follower clusters verify the replication account?
The clusters use mutual TLS certificates or internal security roles to verify identity. The follower sends its user credentials over this encrypted link to pull updates.
Can I restrict which indices the replication account can read?
Yes, you can scope the leader role to exact index patterns. This ensures the follower cluster only pulls data from approved sources.
Related guides
In this post