Skip to content

Connect a regional tenant ​

This guide is for the platform team and the tooling that onboards its customers. It explains how to onboard a tenant so that the CMK of its region serves it: through the central CMK-2-Krypton Bridge, which also creates the tenant's keys in Krypton, or directly in the Registry when you run CMK without Krypton. It then covers the tenant's identity provider and systems, and how to change its limits, block it or terminate it.

How it works ​

A tenant is a customer of your cloud service. You register it once, in the Registry, with the CMK region that should serve it, for example emea. From then on, the tenant lives in that region's deployment: its users sign in with the region's Session Manager and manage their keys in the region's CMK UI and API, and its keys and data stay in that region's databases.

Tenants are never created in CMK directly. The Registry, in the central deployment, is the source of truth for every tenant: its region, its status, its identity provider settings and the systems mapped to it. The Registry passes each change to the CMK of the tenant's region as a job, and records CMK's result. See Deployment planning for the central and regional deployments.

How the tenant reaches the Registry depends on whether you use Krypton:

DeploymentYour onboarding tooling callsWho registers the tenant in the Registry
With Krypton SandboxThe CMK-2-Krypton Bridge: EnsureKeyHierarchyThe Bridge, after it has created the tenant and its key chain in Krypton. It also registers the service as a system of the tenant
Without KryptonThe Registry: RegisterTenantYour onboarding tooling

Everything after the registration is the same in both cases: you connect the identity provider, change limits, and block or terminate the tenant through the Registry.

The Registry routes every job by the tenant's region: it sends the job to the orbital.targets entry with that region, which is the request queue of that region's CMK tenant manager. CMK itself does not check the region; the queues decide which regional deployment receives the tenant.

StepCallWho calls it
1. Onboard the tenantEnsureKeyHierarchy on the Bridge, with Krypton; RegisterTenant on the Registry, without KryptonYour onboarding tooling
2. Connect its identity providerApplyAuthYour onboarding tooling
3. Give the first administrator accessGroup membership in the identity providerThe customer
4. Map its systemsRegisterSystem, MapSystemToTenantThe Bridge for the services it creates keys for; your cloud services for the others, see Connect a regional system
5. Change its limitsUpdateTenantConfigYour onboarding tooling, optional
Block, unblock, terminateBlockTenant, UnblockTenant, TerminateTenantYour onboarding tooling

The APIs ​

The CMK-2-Krypton Bridge API ​

The Bridge offers gRPC on port 9092. Its service kms.api.krypton.rpc.v1.CmkKryptonBridgeService is defined in proto/kms/api/krypton/rpc/v1/proxy_service.proto of cmk-krypton-bridge:

MethodPurpose
EnsureKeyHierarchyCreate the tenant and the keys of a service in Krypton, as a job, and register them in the Registry
GetJobStatusThe status of a job: accepted, processing, retrying, done or failed
GetKey, ListKeysThe keys of a tenant in Krypton
HealthThe Bridge's health and its connection to Krypton

The cmk2kryptonctl CLI calls these methods; the examples below use it.

The Registry API ​

The Registry offers gRPC only, on port 9092. Its services, defined in api-sdk under proto/kms/api/cmk/registry/:

gRPC serviceMethods
kms.api.cmk.registry.tenant.v1.ServiceRegisterTenant, GetTenant, ListTenants, BlockTenant, UnblockTenant, TerminateTenant, SetTenantLabels, RemoveTenantLabels, SetTenantUserGroups
kms.api.cmk.registry.auth.v1.ServiceApplyAuth, GetAuth, ListAuths, RemoveAuth
kms.api.cmk.registry.tenant_config.v1.ServiceGetTenantConfig, UpdateTenantConfig
kms.api.cmk.registry.system.v1.ServiceRegisterSystem, ListSystems, DeleteSystem, UpdateSystemStatus, UpdateSystemL1KeyClaim, SetSystemLabels, RemoveSystemLabels
kms.api.cmk.registry.mapping.v1.ServiceMapSystemToTenant, UnmapSystemFromTenant, Get

These calls create, block and terminate tenants, and so does the Bridge's EnsureKeyHierarchy. Allow only your onboarding tooling to reach the Bridge's gRPC API, and only your onboarding tooling, your cloud services, the regional CMK deployments and the CMK-2-Krypton Bridge to reach the Registry, with network policies and a service mesh with mutual TLS; see the hardening checklist.

The examples below use grpcurl from a pod that may reach the Registry. The Registry chart disables gRPC reflection, so add the proto files of api-sdk, in the version that the Registry uses, to every command:

bash
git clone --depth 1 --branch v0.23.0 https://github.com/openkcm/api-sdk
grpcurl -plaintext -import-path api-sdk/proto -import-path api-sdk/vendor-proto \
  -proto kms/api/cmk/registry/tenant/v1/tenant.proto \
  -d '{"id":"acme"}' registry.services.svc.cluster.local:9092 \
  kms.api.cmk.registry.tenant.v1.Service/GetTenant

Each service has its own proto file, for example auth/v1/auth.proto for ApplyAuth. The examples below leave these options out for brevity.

Step 1: Onboard the tenant ​

With Krypton: through the CMK-2-Krypton Bridge ​

Ask the Bridge for the key chain of the tenant's first service:

bash
cmk2kryptonctl --addr=cmk-krypton-bridge.services.svc.cluster.local:9092 \
  ensure-hierarchy --tenant-id=acme --service-id=payments --level=L4
FieldRules
tenant_idThe tenant ID in Krypton and in the Registry. Follow the Registry's rules for tenant IDs, see below: lowercase letters, digits and hyphens, at most 40 characters
service_idThe service, for example payments. The Bridge registers it as a system of the tenant, with this ID as its external ID. Always set it when you onboard a tenant
target_levelL2, L3 or L4: the level down to which the Bridge creates keys. See Key hierarchy

The Bridge returns a job ID at once and runs the job in the background. Follow it until it is done:

bash
cmk2kryptonctl --addr=cmk-krypton-bridge.services.svc.cluster.local:9092 \
  watch-job --job-id=<job ID>

What happens next:

  1. The Bridge creates the tenant in Krypton, the first time only, and then every missing key of the chain down to the requested level. A failed attempt is retried, up to config.worker.maxAttempts times.
  2. When the job is done, the Bridge registers the tenant in the Registry. A tenant that the Registry already knows is left as it is.
  3. It registers the service as a system of the tenant, which maps the system to the tenant.
  4. From here on, the Registry provisions the tenant in CMK as described below for the registration without Krypton: status STATUS_PROVISIONING, then STATUS_ACTIVE.

The Bridge fills the Registry's fields from the request and from its own configuration (config.registry):

Registry fieldValue
Tenant id and nameThe request's tenant_id
Tenant regionconfig.registry.region
Tenant owner_id, owner_typeconfig.registry.ownerId, config.registry.ownerType
Tenant roleconfig.registry.role; ROLE_TRIAL when it is not set
System external_id, typeThe request's service_id, config.registry.systemType
System regionconfig.registry.region
System l2_key_idThe ID of the key that the job created at the requested level

Name, owner and role of your own

To give a tenant a name, owner or role other than the Bridge's, register it in the Registry first, as without Krypton, then call the Bridge: it keeps the tenant that the Registry already knows.

The Bridge uses config.registry.region for both the tenant and the system, so that value is the tenant's CMK region and the system's region at the same time:

  • The Registry needs an orbital.targets entry with this region, for the CMK that serves the tenant.
  • That CMK needs an eventProcessor.targets entry with this region, with the Bridge's queues, so that the key and system tasks of these systems reach the Bridge.
  • Today all tenants that one Bridge instance registers get the same CMK region, owner and role. See the Bridge's current state.

The registration in the Registry runs once, after the job is done. If it fails, for example because the Registry cannot be reached or a validation rule refuses a value, the job still reports JOB_STATUS_DONE and the Bridge logs the error. Check the tenant with GetTenant, as shown below. Repeating the same ensure-hierarchy request is safe: the keys exist already, and the Bridge tries the registration again.

Without Krypton: directly in the Registry ​

bash
grpcurl -plaintext -d @ registry.services.svc.cluster.local:9092 \
  kms.api.cmk.registry.tenant.v1.Service/RegisterTenant <<'EOF'
{
  "id": "acme",
  "name": "ACME Corporation",
  "region": "emea",
  "owner_id": "customer-4711",
  "owner_type": "customer",
  "role": "ROLE_LIVE"
}
EOF
FieldRequiredRules
idyes1 to 40 characters: letters, digits, ., _, ~, -. Use lowercase letters, digits and hyphens only, see below. The ID cannot be changed and cannot be used again after the tenant is terminated
nameyesDisplay name. CMK copies changes daily (tenant:refresh-name task)
regionyesThe CMK region that serves the tenant, for example emea. Must equal the region of a Registry target. Cannot be changed once the tenant is active
owner_id, owner_typeyesThe owner of the tenant in your systems, for example a customer account
roleyesROLE_LIVE, ROLE_TEST or ROLE_TRIAL
labelsnoKey–value pairs; keys and values must not be empty

Validation rules in the Registry's validations can restrict these values further. Add a Tenant.Region rule with your CMK regions: without it, the Registry accepts any region and the tenant fails only later, when no target matches.

What happens next:

  1. The Registry stores the tenant with status STATUS_PROVISIONING and sends a provisioning job to the CMK of the tenant's region.
  2. CMK's tenant manager creates the tenant, its database schema and two groups, KMS_TenantAdministrator_<id> and KMS_TenantAuditor_<id>.
  3. CMK writes the two group names to the tenant's user groups in the Registry (SetTenantUserGroups) and reports the job as done.
  4. The Registry sets the tenant to STATUS_ACTIVE.

No keystore is assigned at this point. CMK takes the tenant's keystore from the keystore pool when the tenant first needs it.

Check the result:

bash
grpcurl -plaintext -d '{"id":"acme"}' registry.services.svc.cluster.local:9092 \
  kms.api.cmk.registry.tenant.v1.Service/GetTenant

Tenant IDs with ., _ or ~

The Registry accepts them, also from the Bridge, but the CMK group names built from them, such as KMS_TenantAdministrator_acme.eu, do not match the Registry chart's default Tenant.UserGroups rule (^KMS_(TenantAdministrator|TenantAuditor)_[A-Za-z0-9-]+$). CMK then retries SetTenantUserGroups without end, and the tenant stays in STATUS_PROVISIONING. Add a Tenant.ID rule such as ^[a-z0-9][a-z0-9-]{2,39}$ to reject such IDs at registration.

If the region has no Registry target, the job is canceled with no matching orbital target manager found for region and the tenant moves to STATUS_PROVISIONING_ERROR. Correct it with RegisterTenant for the same ID: in STATUS_PROVISIONING_ERROR, and only there, the call updates the fields you send, including region, and starts the provisioning again. For a tenant in any other status it fails with tenant is already provisioned.

Step 2: Connect the identity provider ​

The tenant's users sign in with the tenant's own OpenID Connect identity provider. Register it with ApplyAuth; the tenant must be active:

bash
grpcurl -plaintext -d @ registry.services.svc.cluster.local:9092 \
  kms.api.cmk.registry.auth.v1.Service/ApplyAuth <<'EOF'
{
  "external_id": "acme-oidc",
  "tenant_id": "acme",
  "type": "oidc",
  "properties": {
    "issuer": "https://idp.example.com/realms/acme",
    "client_id": "cmk-session-manager",
    "jwks_uri": "https://idp.example.com/realms/acme/protocol/openid-connect/certs",
    "audiences": "cmk-api,account"
  }
}
EOF

The Registry sends the settings to the CMK of the tenant's region. CMK writes the tenant's trust record in that region's Session Manager, which then accepts sign-ins with this identity provider, and ExtAuthZ accepts its tokens. The auth's status moves from AUTH_STATUS_APPLYING to AUTH_STATUS_APPLIED, or to AUTH_STATUS_APPLYING_ERROR with an error_message. Check it with GetAuth ({"external_id":"acme-oidc"}).

  • Each tenant has one trust record in Session Manager. Use one auth per tenant: applying a second auth overwrites the same record, and removing any auth of the tenant (RemoveAuth) removes the tenant's trust, so nobody can sign in until you apply an auth again.
  • Calling ApplyAuth again with the same external_id updates the record.
  • The properties are described in the regional installation guide.

Step 3: Give the first administrator access ​

CMK created two groups for the tenant: KMS_TenantAdministrator_<id> and KMS_TenantAuditor_<id>. The customer makes their first administrator a member of KMS_TenantAdministrator_<id> in the tenant's identity provider, which must send the group in the groups claim. Give the customer:

  • the address of the CMK UI of the tenant's region,
  • the tenant ID,
  • the name of the administrator group.

The administrator then signs in and creates the groups for key administrators; see Sign-in, groups and roles.

Step 4: Map the tenant's systems ​

A tenant sees in CMK only the systems that are mapped to it in the Registry. With Krypton, the Bridge registers and maps the system of every service it creates keys for: call EnsureKeyHierarchy for each further service of the tenant. Your cloud services register and map their other systems, as described in Connect a regional system:

  • MapSystemToTenant requires the tenant to be active, and the system to be available, not mapped to another tenant and without an L1 key claim.
  • The Registry does not compare a system's region with the tenant's region. The CMK of the tenant's region sends the system's tasks to its eventProcessor.targets entry for the system region; configure an entry for every system region in which your tenants have systems.

Step 5 (optional): Change the tenant limits ​

CMK applies default limits to every tenant, set in its tenant section. Override them for one tenant with UpdateTenantConfig:

bash
grpcurl -plaintext -d @ registry.services.svc.cluster.local:9092 \
  kms.api.cmk.registry.tenant_config.v1.Service/UpdateTenantConfig <<'EOF'
{
  "tenant_id": "acme",
  "values": { "system_limit": 200, "key_limit": 20 },
  "update_mask": "systemLimit,keyLimit"
}
EOF
LimitCounts
system_limitSystems linked to one key configuration
key_limitKeys of one key configuration, not counting deleted and detached keys

Only system_limit and key_limit can be updated today. In JSON, write the paths of update_mask in lowerCamelCase, as above. To return to CMK's default, list the path in update_mask and leave the value out. The Registry sends the change to the tenant's CMK; check the result with GetTenantConfig.

Block, unblock and terminate ​

CallAllowed fromWhat happens
BlockTenantSTATUS_ACTIVECMK blocks the tenant's trust record in Session Manager: session checks fail with TENANT_BLOCKED. Keys, systems and data stay unchanged. The tenant's auths become AUTH_STATUS_BLOCKED
UnblockTenantSTATUS_BLOCKEDCMK unblocks the trust record. The tenant is active again, its auths AUTH_STATUS_APPLIED
TerminateTenantSTATUS_BLOCKED only: block a tenant before you terminate itThe Registry detaches all of the tenant's systems at once and releases their L1 key claims. CMK removes the trust record, unlinks the systems, detaches the keys, then deletes the tenant and its schema and sends an audit event. The auths become AUTH_STATUS_REMOVED

Every call takes the tenant ID: {"id":"acme"}.

  • Termination is final. A terminated tenant stays in the Registry with STATUS_TERMINATED, and its ID cannot be registered again. CMK deletes the tenant's data in CMK; the key material stays in the keystores.
  • CMK fails a termination that takes longer than tenantManager.terminationTimeout, 48 hours by default, for example while keys are still being detached.
  • The calls are rejected with auth in transient state while one of the tenant's auths is being applied, removed, blocked or unblocked. Wait until it is done.
  • A call that does not fit the current status is rejected with FailedPrecondition.

Tenant statuses ​

  • The statuses ending in ING wait for the CMK of the tenant's region. They end when CMK reports the job as done or failed.
  • The _ERROR statuses mean that CMK failed the job, or that the Registry gave up after orbital.maxPendingReconciles unanswered sends. Fix the cause, then repeat the same call.
  • Labels can be changed only on active tenants (SetTenantLabels, RemoveTenantLabels). Leave SetTenantUserGroups to CMK.

Region configuration ​

Shared between the Registry, CMK and the Bridge

The region name and the queue pair below must be the same on both sides. A mismatch does not stop a service from starting: tenants stay in STATUS_PROVISIONING or go to STATUS_PROVISIONING_ERROR. See Settings that must match.

The platform operator connects each CMK region once, before tenants are registered for it:

WhereSettingContent
Registryorbital.targetsOne entry per CMK region: region as used in RegisterTenant, the broker URL, and the request and reply queues of that region's CMK tenant manager
RegistryvalidationsA Tenant.Region rule with the CMK regions, and a Tenant.ID rule for lowercase IDs
CMK of the regiontenantManager.amqpsource equal to the target's request queue, target equal to its reply queue
CMK of the regionservices.registry, services.sessionManagerThe central Registry and the region's Session Manager
CMK-2-Krypton Bridge, with Kryptonconfig.registryregion equal to the CMK region of the tenants it onboards; ownerId, ownerType, role and systemType for the tenants and systems it registers
CMK of the region, with KryptoneventProcessor.targetsAn entry with the Bridge's config.registry.region and the Bridge's queues

CMK does not check a tenant's region: whichever CMK reads a target's request queue serves the tenants of that region.

What the onboarding tooling seesCause
Tenant in STATUS_PROVISIONING_ERROR with no matching orbital target manager found for regionThe Registry has no target for the tenant's region
Tenant stays in STATUS_PROVISIONINGNo CMK reads the target's request queue, or the queues do not match

Checklist ​

  • [ ] The tenant's CMK region has a Registry target, and that region's CMK reads its queues.
  • [ ] The tenant ID uses lowercase letters, digits and hyphens only.
  • [ ] With Krypton: the Bridge's job is JOB_STATUS_DONE, and GetTenant in the Registry finds the tenant.
  • [ ] The tenant is STATUS_ACTIVE before you apply its identity provider.
  • [ ] One auth per tenant, with the identity provider's exact issuer, is AUTH_STATUS_APPLIED.
  • [ ] The customer knows the CMK UI address of the tenant's region, the tenant ID and the administrator group.
  • [ ] The tenant's systems are registered and mapped, and the region's CMK has an eventProcessor.targets entry for each of their system regions.
  • [ ] To offboard: block the tenant first, then terminate it.

Troubleshooting ​

SymptomCause and fix
RegisterTenant fails with invalid tenant: validation failed for <field>A required field is empty, or a value breaks a validations rule
Bridge job JOB_STATUS_FAILEDRead the job's error. Usually Krypton cannot be reached, or the request is incomplete: service_id is required for L3 and L4
Bridge job done, but GetTenant finds no tenantThe registration in the Registry failed; the Bridge's log names the cause. Fix it, for example config.registry or a validations rule, and repeat the request
Tenant stays in STATUS_PROVISIONINGThe CMK tenant manager of the region is not running, or its tenantManager.amqp queues do not match the Registry target. With an ID containing ., _ or ~, see the warning in Step 1
Tenant in STATUS_PROVISIONING_ERRORCheck the job error. no matching orbital target manager found for region: the region has no Registry target
ApplyAuth fails: tenant not activeWait until provisioning has finished
Auth in AUTH_STATUS_APPLYING_ERRORRead error_message. Usually the issuer property is missing, or Session Manager of the region is not reachable from CMK
Users of the tenant cannot sign inNo applied auth, the issuer differs from the identity provider's exactly, or the tenant is blocked
TerminateTenant fails with FailedPreconditionThe tenant is not blocked. Call BlockTenant first
A tenant sees no systemsThe systems are not mapped to it, or are mapped to another tenant

See also ​

EU and German government funding logos

Funded by the European Union – NextGenerationEU.

The views and opinions expressed are solely those of the author(s) and do not necessarily reflect the views of the European Union or the European Commission. Neither the European Union nor the European Commission can be held responsible for them.