The Master KEK rotation (MasterKeyRotator) targets a single key id read from pdv.settings:master_key_id for every subject, regardless of tenant.
Since the multi-tenant feature (#3593589), a subject key belongs to a (tenant, owner) pair and is wrapped under that tenant's Master KEK (pdv_tenant.master_key_id, falling back to the site key when empty). A rotation run on a multi-tenant site therefore:
- re-wraps every tenant's subject keys onto the site-wide key, undoing the per-tenant cryptographic isolation;
- never converges, because subjects legitimately on a tenant key are always counted as not on the target and re-wrapped on every pass.
Proposed fix:
- resolve the rotation target per tenant:
pdv_tenant.master_key_id, falling back to the site key when empty;
- iterate tenants (or scope the convergence queries by tenant) so each tenant's subjects converge toward that tenant's own key;
- scope
countNotOnMasterKey() and ownersNotOnMasterKey() by tenant;
- add kernel coverage: a two-tenant fixture where rotation converges each tenant to its own key and leaves the other untouched.
Single-tenant installs are unaffected. Until this lands, operators on a multi-tenant install should not run a Master KEK rotation.
Comments
Comment #4
mably commented