Trilio Site Recovery for OpenStackOpenStack native DR service
Guide

Policy & Roles (oslo.policy)

Default roles and policy rules, and how to override them


Overview

Trilio Site Recovery for OpenStack enforces access control through oslo.policy, the standard OpenStack authorization framework. Every API call is checked against a named policy rule before any work is done. This page documents the four-tier role hierarchy, every default policy rule (by resource and action), how the trust-based cross-site authentication model maps onto those rules, and how to override defaults at deploy time using policy.yaml. Read this page before granting roles to users or relaxing rules for a production deployment — the wrong role grant, particularly dr_site_admin, carries cloud-wide consequences that do not respect project boundaries.


Prerequisites

Before working with DR policy and roles:

  • Trilio Site Recovery deployed and registered in Keystone (protector-api running and reachable on port 8788)
  • OpenStack CLI with the python3-triliositerecovery package installed
  • Both Keystone roles dr_operator and dr_site_admin created on both sites before any DR operation runs — trust creation fails naming a missing role rather than skipping it:
    openstack role create dr_operator
    openstack role create dr_site_admin
    
  • Access to policy.yaml at /etc/protector/policy.yaml (Juju and Kolla deployments) for any overrides
  • Familiarity with oslo.policy rule syntax (role:, rule:, project_id:%(project_id)s)

Installation

Policy enforcement is active from first startup — no separate install step is required. The default rules are compiled into the service and registered at startup. The editable override file is installed by the trilio-site-recovery Debian package at /etc/protector/policy.yaml.

To verify the policy file is loaded:

# Juju
juju ssh trilio-site-recovery/0 'ls -l /etc/protector/policy.yaml'

# Kolla
docker exec protector_api ls -l /etc/protector/policy.yaml

# OpenShift
oc -n trilio-site-recovery exec \
  $(oc -n trilio-site-recovery get pod \
    -l app.kubernetes.io/name=trilio-site-recovery,app.kubernetes.io/component=api \
    -o jsonpath='{.items[0].metadata.name}') \
  -- ls -l /etc/protector/policy.yaml

The oslo_policy section of protector.conf tells the service where to find the file:

[oslo_policy]
policy_file = /etc/protector/policy.yaml

This path is written by the Juju charm automatically. For Kolla and OpenShift deployments, confirm the value matches the file's actual location inside the container.

To apply a policy override without restarting the service, place your changes in policy.yaml and send SIGHUP to the API process (oslo.policy reloads on the next request after a file change). On Juju the charm rewrites protector.conf on every hook but does not own policy.yaml, so edits to that file survive charm operations.

Important for Juju deployments: policy.yaml is a conffile owned by the trilio-site-recovery Debian package. The charm does not overwrite it. Your edits persist across charm upgrades as long as the package is not purged.


Configuration

Role hierarchy

The service defines four levels of access. Each level is a superset of the one below it.

RoleBase ruleWhat it gates
adminrole:adminEverything — overrides all other rules
dr_site_adminrole:dr_site_admin or role:adminSite registration, tenant mapping, site-level failover, replication audit, site operation list/show
dr_operatorrole:dr_operator or role:dr_site_admin or role:adminProtection group and member lifecycle, DR operations (failover, failback, test failover, reconcile), resource mappings
memberis_admin:True or is_system:True or project_id:%(project_id)sRead-only access to resources within the caller's project

is_system is not a role and cannot be set from an API request. It marks a context the service builds internally for cross-tenant work. A system context still must carry a role that passes context_is_dr_operator or context_is_site_admin.


Base rules

These named rules are referenced by all resource rules. You can override them in policy.yaml.

# Satisfied by role:admin only
context_is_admin: role:admin

# Satisfied by dr_operator, dr_site_admin, or admin
context_is_dr_operator: role:dr_operator or role:dr_site_admin or role:admin

# Satisfied by dr_site_admin or admin
context_is_site_admin: role:dr_site_admin or role:admin

# Satisfied by admin, system contexts, or the resource's own project member
admin_or_owner: is_admin:True or is_system:True or project_id:%(project_id)s

# Read-only: any authenticated project member
"protector:default:read": rule:admin_or_owner

# Mutating: dr_operator (or higher) scoped to the caller's project
"protector:default:write": >
  rule:context_is_dr_operator and
  (is_admin:True or is_system:True or project_id:%(project_id)s)

Relaxing a rule: switching from rule:context_is_admin to rule:context_is_dr_operator broadens access, because context_is_dr_operator accepts dr_operator, dr_site_admin, or admin — while context_is_admin accepts only admin. admin remains the superset role under any override.


Resource rules (defaults)

All resource rules default to either protector:default:read or protector:default:write except for site-administrative and admin-only operations.

Protection Groups

ActionDefault rule
protector:protection_groups:indexrule:protector:default:read
protector:protection_groups:showrule:protector:default:read
protector:protection_groups:createrule:protector:default:write
protector:protection_groups:updaterule:protector:default:write
protector:protection_groups:deleterule:protector:default:write
protector:protection_groups:syncrule:protector:default:write
protector:protection_groups:sync_metadatarule:protector:default:write
protector:protection_groups:replication_healthrule:protector:default:read
protector:protection_groups:recovery_pointsrule:protector:default:read
protector:protection_groups:create_recovery_pointrule:protector:default:write

Members

ActionDefault rule
protector:members:indexrule:protector:default:read
protector:members:showrule:protector:default:read
protector:members:validaterule:protector:default:read
protector:members:createrule:protector:default:write
protector:members:updaterule:protector:default:write
protector:members:deleterule:protector:default:write

DR Operations

ActionDefault rule
protector:operations:indexrule:protector:default:read
protector:operations:showrule:protector:default:read
protector:operations:failoverrule:protector:default:write
protector:operations:failbackrule:protector:default:write
protector:operations:test_failoverrule:protector:default:write
protector:operations:test_cleanuprule:protector:default:write
protector:operations:reconcilerule:protector:default:write

Sites

ActionDefault ruleNotes
protector:sites:indexrule:protector:default:read
protector:sites:showrule:protector:default:read
protector:sites:localrule:protector:default:read
protector:sites:list_resourcesrule:protector:default:read
protector:sites:createrule:context_is_site_adminCloud-wide — see warning below
protector:sites:updaterule:context_is_site_adminCloud-wide
protector:sites:deleterule:context_is_site_adminCloud-wide
protector:sites:storage_arraysrule:context_is_adminAdmin only
protector:sites:replication_auditrule:context_is_site_adminCloud-wide
protector:sites:actionrule:context_is_site_adminCloud-wide
protector:sites:failoverrule:context_is_site_adminCloud-wide

Site Operations

ActionDefault rule
protector:site_operations:indexrule:context_is_site_admin
protector:site_operations:showrule:context_is_site_admin

Tenant Mappings

ActionDefault ruleNotes
protector:tenant_mappings:indexrule:protector:default:read or rule:context_is_site_admin
protector:tenant_mappings:showrule:protector:default:read or rule:context_is_site_admin
protector:tenant_mappings:createrule:context_is_site_adminCloud-wide — intentionally not tenant-scoped
protector:tenant_mappings:deleterule:context_is_site_adminCloud-wide
protector:tenant_mappings:validaterule:context_is_site_adminCloud-wide
protector:tenant_mappings:receive_syncrule:protector:default:writeCalled by trust-delegated sessions

Resource Mappings

ActionDefault rule
protector:resource_mappings:indexrule:protector:default:read
protector:resource_mappings:createrule:protector:default:write
protector:resource_mappings:deleterule:protector:default:write
protector:resource_mappings:auto_maprule:protector:default:write

Metadata Sync

ActionDefault rule
protector:metadata_sync:receive_syncrule:protector:default:write
protector:metadata_sync:get_sync_statusrule:protector:default:read

Replication Policies and Consistency Groups

ActionDefault rule
protector:policies:showrule:protector:default:read
protector:policies:createrule:protector:default:write
protector:consistency_groups:showrule:protector:default:read
protector:consistency_groups:volumesrule:protector:default:read
protector:consistency_groups:syncrule:protector:default:write

Usage / Billing

ActionDefault rule
protector:usage:summaryrule:context_is_admin
protector:usage:reportrule:context_is_admin

dr_site_admin is a cloud-wide role

Warning: The rules dr_site_admin gates carry no project_id:%(project_id)s clause, and their handlers authorize without a target object. The Keystone project you grant this role on restricts nothing — the check asks only whether the token carries the role. A token holding dr_site_admin can fail over the entire site and register or delete site records that every tenant's DR depends on.

Grant dr_site_admin only to cloud operators, on the admin project:

# Correct
openstack role add --user <cloud-operator> --project admin dr_site_admin

# Wrong — the project does not contain the role; they can still fail over every tenant
openstack role add --user <dr-user> --project <dr-project> dr_site_admin

Tenant DR users need only member and dr_operator on their own project.


Trust-based authentication and policy

The service uses Keystone trusts to act on behalf of tenants during cross-site operations. Trusts are created automatically on first use. The roles delegated by each trust are controlled by:

[service_credentials]
default_trust_roles = member,dr_operator

member grants the Nova/Cinder/Neutron access a recovery needs. dr_operator satisfies the protector:default:write check on cross-site sync endpoints — without it, the trust-scoped session is rejected by Protector's own policy on the receiving site.

Every role named in default_trust_roles must exist on both sites before any DR operation runs. Trust creation fails with an explicit error naming the missing role rather than silently skipping it. Do not add roles to this list beyond what DR requires — a trust should carry the least privilege the operation needs.

Do not omit member from this list. It is the role that carries Nova and Cinder access; dr_operator alone is insufficient for instance and volume operations, and a failover will fail after the storage work is already done.


Overriding policy rules

Create or edit /etc/protector/policy.yaml. Only the rules you place there are overridden; all others continue to use their compiled-in defaults.

# /etc/protector/policy.yaml
# Example: allow dr_operator to view storage array details
# Default is context_is_admin (role:admin only).
"protector:sites:storage_arrays": "rule:context_is_dr_operator"

The service reloads policy.yaml on the next request after the file changes — no restart is required.

For Juju deployments, the charm does not own policy.yaml, so you edit the file directly on the unit:

juju ssh trilio-site-recovery/0 \
  'sudo tee /etc/protector/policy.yaml' << 'EOF'
"protector:sites:storage_arrays": "rule:context_is_dr_operator"
EOF

For Kolla deployments, mount a custom policy.yaml into the container or rebuild your site's config volume to include it.

For OpenShift deployments, add the override to the ConfigMap that holds protector.conf or mount a separate ConfigMap entry at /etc/protector/policy.yaml.


Usage

Recommended account layout

Three accounts cover all DR roles with least-privilege separation:

AccountRolesProjectResponsible for
drsiteadminmember, dr_site_adminadminSite registration, tenant mapping, site-level failover
drusermember, dr_operatoreach DR projectDR operations within that project
protector (service account)member, dr_operatoreach DR projectCross-site operations on behalf of tenants

The protector service account additionally holds service on the service project for Keystone token validation.


Setting up the site admin account

Run this on both sites:

openstack user create --domain default --password-prompt drsiteadmin
openstack role add --user drsiteadmin --project admin member
openstack role add --user drsiteadmin --project admin dr_site_admin

This account does not need the admin role. The cloud admin role does satisfy every rule here, so an existing admin can perform site operations without any additional grant — but a dedicated account gives a cleaner audit trail and keeps site-level failover out of reach of routine cloud administration.


Setting up tenant DR users

For each project that will hold protection groups:

# Create the DR user (if not already existing)
openstack user create --domain default --password-prompt druser

# Grant the roles needed for DR operations within the project
openstack role add --user druser --project <dr-project> member
openstack role add --user druser --project <dr-project> dr_operator

Do not grant dr_site_admin to this account on any project.


Pre-granting trust roles to avoid a runtime admin dependency

When the service account creates a trust for a project it has never acted on, it first grants itself the default_trust_roles on that project — which requires an account that may assign roles (hence the service account holding admin at install time).

Pre-grant the roles and the runtime self-assignment becomes a no-op:

# Run on both sites for every project that will hold protection groups
openstack role add --project <dr-project> --user protector member
openstack role add --project <dr-project> --user protector dr_operator

Both roles are required. member alone matches only the first half of default_trust_roles = member,dr_operator and leaves the service account to escalate for the second.


Verifying role assignments

# Check what roles a user holds on a project
openstack role assignment list --user druser --project <dr-project> --names

# Confirm the Keystone roles exist on both sites
openstack role show dr_operator
openstack role show dr_site_admin

Operations that require each role

member + dr_operator (tenant DR users):

  • Create, update, delete protection groups
  • Add and remove members
  • Run failover, failback, test failover, test cleanup, reconcile
  • Create and delete resource mappings
  • Sync metadata
  • Read replication health and recovery points

dr_site_admin (cloud operators only):

  • Register, update, and delete sites (openstack dr site create/set/delete)
  • Create and delete tenant mappings
  • Validate tenant mappings
  • Run site-level failover (openstack dr site failover, openstack dr failover to this site)
  • List and show site operations
  • Run replication audit

admin only:

  • View storage array details (GET /v1/{tenant_id}/storage-arrays)
  • View usage summaries and reports

Optional: enable instance state recovery after failover

When a failed-over instance does not reach ACTIVE, the engine attempts to clear and hard-reboot it. This calls Nova's os-resetState, which is rule:admin_api by default. Without admin, the step is skipped and the log explains how to enable it.

To allow the service account to perform this step, add the following to /etc/nova/policy.yaml on both sites:

# Allow the DR service to clear a stuck instance state after failover.
"os_compute_api:os-admin-actions:reset_state": "role:dr_operator or rule:admin_api"

This is optional and safe to omit. An operator can always perform the same recovery manually:

openstack server set --state active <instance>
openstack server reboot --hard <instance>

Examples

Create the required Keystone roles on both sites

# Run on site-1
openstack role create dr_operator
openstack role create dr_site_admin

# Run on site-2 (same commands, different cloud credentials)
openstack role create dr_operator
openstack role create dr_site_admin

Set up the site admin account

openstack user create --domain default --password-prompt drsiteadmin
openstack role add --user drsiteadmin --project admin member
openstack role add --user drsiteadmin --project admin dr_site_admin

Grant DR operator access to a tenant user

openstack role add --user druser --project my-dr-project member
openstack role add --user druser --project my-dr-project dr_operator

Pre-grant trust roles to the service account

# Run on both sites for every project that will hold protection groups
openstack role add --project my-dr-project --user protector member
openstack role add --project my-dr-project --user protector dr_operator

Override a policy rule in policy.yaml

Allow dr_operator (instead of admin only) to view storage array details:

# /etc/protector/policy.yaml
"protector:sites:storage_arrays": "rule:context_is_dr_operator"

No service restart is needed. The enforcer picks up the change on the next request.


Apply a policy override on Juju (Charmed OpenStack)

juju ssh trilio-site-recovery/0 \
  'sudo tee /etc/protector/policy.yaml' << 'EOF'
"protector:sites:storage_arrays": "rule:context_is_dr_operator"
EOF

Apply the Cinder policy relaxation on Charmed OpenStack

This is required on both sites before failover will succeed. Failover imports replicated volumes using Cinder's manage API, which stock Cinder restricts to admin. The service runs as a tenant through a Keystone trust.

cat > dr-policy.yaml << 'EOF'
"volume_extension:volume_manage": "rule:admin_or_owner"
"volume_extension:volume_unmanage": "rule:admin_or_owner"
"volume_extension:services:index": "rule:admin_or_owner"
"volume_extension:type_get": "rule:admin_or_owner"
"volume_extension:type_get_all": "rule:admin_or_owner"
EOF

zip dr-policy.zip dr-policy.yaml
juju attach-resource cinder policyd-override=dr-policy.zip
juju config cinder use-policyd-override=true

Repeat against the cinder application in each site's Juju model.


Apply the Cinder policy relaxation on Kolla-Ansible

# Create or update the Cinder policy override file
sudo tee /etc/kolla/config/cinder/policy.yaml << 'EOF'
"volume_extension:volume_manage": "rule:admin_or_owner"
"volume_extension:volume_unmanage": "rule:admin_or_owner"
"volume_extension:services:index": "rule:admin_or_owner"
"volume_extension:type_get": "rule:admin_or_owner"
"volume_extension:type_get_all": "rule:admin_or_owner"
EOF

kolla-ansible -i inventory reconfigure -t cinder

Verify the Cinder policy override is active

There is no read-only call that exercises volume_manage directly. The following confirms the policy file was picked up — a failure here means the override did not reach Cinder's effective policy:

openstack volume service list

Verify role assignments are correct

# Confirm dr_operator is on the right account and project
openstack role assignment list --user druser --project my-dr-project --names

# Confirm dr_site_admin is on the admin project only
openstack role assignment list --user drsiteadmin --names

Troubleshooting

Trust creation fails with a missing-role error

Symptom: The first DR operation or tenant mapping creation fails with an error naming a Keystone role that does not exist on the site.

Cause: default_trust_roles in protector.conf names a role (dr_operator by default) that has not been created in Keystone on that site. Trust creation fails immediately rather than silently skipping the missing role.

Fix: Create the missing role on the affected site:

openstack role create dr_operator
openstack role create dr_site_admin

Then retry the operation. Run this on both sites — the roles must exist on both before any cross-site operation runs.


Failover fails with volume_extension:volume_manage (HTTP 403)

Symptom: Failover proceeds through the storage phase then stops with:

Policy doesn't allow volume_extension:volume_manage to be performed. (HTTP 403)

Cause: Cinder's default policy restricts the manage/unmanage APIs to admin. The service runs as a tenant through a Keystone trust and never as admin, so the five required Cinder rules have not been applied.

Fix: Apply all five rules to Cinder on both sites using the method for your deployment (Juju: juju attach-resource cinder policyd-override=dr-policy.zip; Kolla: edit /etc/kolla/config/cinder/policy.yaml and run kolla-ansible reconfigure -t cinder). The five rules are:

  • volume_extension:volume_manage
  • volume_extension:volume_unmanage
  • volume_extension:services:index
  • volume_extension:type_get
  • volume_extension:type_get_all

All five must be set to rule:admin_or_owner. A cloud with the policy on one site only fails at whichever direction it has not covered — typically discovered halfway through a failback.


DR operator can reach site-level operations (over-privileged account)

Symptom: A tenant DR user is able to call openstack dr site failover or openstack dr site create, which should be restricted to dr_site_admin.

Cause: The user was granted dr_site_admin on a tenant project, believing project scope would restrict them. It does not — dr_site_admin rules carry no project_id clause and are cloud-wide regardless of which project the role is granted on.

Fix: Revoke dr_site_admin from tenant users:

openstack role remove --user <dr-user> --project <dr-project> dr_site_admin

Tenant users need only member and dr_operator on their own project.


Policy override has no effect after editing policy.yaml

Symptom: You edited /etc/protector/policy.yaml but the API continues enforcing the old rule.

Cause: oslo.policy reloads the file on the next request after a file change, but only if the enforcer detects the modification time has changed. On some filesystems or container overlay mounts the mtime is not updated.

Fix: Touch the file to force a mtime update and then make a request:

# Juju
juju ssh trilio-site-recovery/0 'sudo touch /etc/protector/policy.yaml'

# Kolla
docker exec protector_api touch /etc/protector/policy.yaml

If the override still has no effect, confirm the [oslo_policy] section in protector.conf points to the correct file path:

[oslo_policy]
policy_file = /etc/protector/policy.yaml

A site operation returns 403 for a user who holds dr_site_admin

Symptom: A user with dr_site_admin on a project receives HTTP 403 on a site-administrative endpoint.

Cause: The token was scoped to a project where dr_site_admin has not been granted, or the token was scoped to a project other than admin and the role assignment is on the admin project. Policy is evaluated against the token's roles, not all role assignments.

Fix: Ensure the token is scoped to the project where dr_site_admin is actually granted:

# Scope the token to the admin project where the role is held
export OS_PROJECT_NAME=admin
openstack token issue   # confirm roles include dr_site_admin
openstack dr site list  # should now succeed

Instance state does not reset after failover (stuck in non-ACTIVE state)

Symptom: After failover, one or more recovered instances remain in a non-ACTIVE state. The service log says the state-reset step was unavailable.

Cause: Nova's os-resetState is restricted to rule:admin_api by default. The service account does not hold admin and cannot clear the instance state.

Fix (optional): Add the following to /etc/nova/policy.yaml on both sites:

"os_compute_api:os-admin-actions:reset_state": "role:dr_operator or rule:admin_api"

Alternatively, perform the recovery manually:

openstack server set --state active <instance>
openstack server reboot --hard <instance>

default_trust_roles was set without member, causing failover to fail on instance/volume calls

Symptom: Failover fails during instance creation or volume management, not at the storage layer. The error references Nova or Cinder returning 403 for operations the trust-scoped session is making.

Cause: member was omitted from default_trust_roles in protector.conf. The member role carries the Nova and Cinder access a recovery needs. dr_operator alone is insufficient.

Fix: Restore the default value. In protector.conf:

[service_credentials]
default_trust_roles = member,dr_operator

Do not set only dr_operator. Both roles are required and both must exist on both sites. After correcting the config, existing trusts may need to be recreated — delete and re-create the tenant mapping to force a new trust to be issued with the corrected roles.


Tenant mapping create returns 403

Symptom: openstack dr tenant mapping create returns HTTP 403.

Cause: The calling user does not hold dr_site_admin. Tenant mapping creation is gated by protector:tenant_mappings:create: rule:context_is_site_admin with no project-scope clause — it is intentionally an operator action, not a tenant self-service action.

Fix: Perform tenant mapping operations as the drsiteadmin account (or any account holding dr_site_admin), not as a tenant DR user:

# Source credentials for the site admin account
source drsiteadmin-openrc.sh
openstack dr tenant mapping create \
  --local-tenant <local-project-id> \
  --remote-site <site-name> \
  --remote-tenant <remote-project-id>