Register AK via KBS API#273
Conversation
Signed-off-by: Roy Kaufman <rkaufman@redhat.com>
- Replacing the patch mechanism with API calls - Add a reconcile loop that watches for changes in the trustee deployment and sync LUKS key that was lost. Signed-off-by: Roy Kaufman <rkaufman@redhat.com>
This test checks that the luks key is first sent to tustee and validates that after trustee restarts, the keys are sent again. Signed-off-by: Roy Kaufman <rkaufman@redhat.com>
Signed-off-by: Roy Kaufman <rkaufman@redhat.com>
…n trustee. Signed-off-by: Roy Kaufman <rkaufman@redhat.com>
Signed-off-by: Roy Kaufman <rkaufman@redhat.com>
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: iroykaufman The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideImplements KBS-backed secret and attestation key (AK) registration with authenticated admin API, adds trustee restart synchronization logic for LUKS keys and AKs, and extends tests and configuration to validate end-to-end behavior. Sequence diagram for machine LUKS key registration via KBS APIsequenceDiagram
actor User
participant MachineController as keygen_reconcile
participant Trustee as trustee
participant K8sAPI as Kubernetes_API
participant KBS as kbs_client
User->>MachineController: Create Machine
MachineController->>Trustee: generate_secret(client, id, owner_reference)
Trustee->>K8sAPI: create Secret {id}
K8sAPI-->>Trustee: Secret created
MachineController->>Trustee: send_secret(client, id)
Trustee->>Trustee: get_auth_key_token(client)
Trustee->>Trustee: get_kbs_connection(client)
Trustee->>K8sAPI: get Secret {id}
K8sAPI-->>Trustee: Secret {id}
Trustee->>KBS: set_resource(url, auth_key_token, resource_bytes, secret_path(id), certs)
KBS-->>Trustee: OK
Trustee-->>MachineController: Action::await_change()
User->>MachineController: Delete Machine
MachineController->>Trustee: delete_secret(client, id)
Trustee->>Trustee: get_auth_key_token(client)
Trustee->>Trustee: get_kbs_connection(client)
Trustee->>KBS: delete_resource(url, auth_key_token, secret_path(id), certs)
KBS-->>Trustee: OK
Trustee-->>MachineController: Action::await_change()
Sequence diagram for trustee restart synchronization and AK registration via KBS APIsequenceDiagram
participant Main as main
participant SyncCtrl as launch_trustee_sync_controller
participant K8sAPI as Kubernetes_API
participant Reconcile as trustee_deployment_reconcile
participant Trustee as trustee
participant KBS as kbs_client
Main->>SyncCtrl: launch_trustee_sync_controller(client)
SyncCtrl->>K8sAPI: watch Deployments label app=TRUSTEE_APP_LABEL
K8sAPI-->>Reconcile: Deployment {TRUSTEE_DEPLOYMENT} update
Reconcile->>Reconcile: check status.ready_replicas >= desired
alt Trustee ready
Reconcile->>Trustee: sync_all_machine_luks_key(client)
Trustee->>K8sAPI: list Machines
loop for each Machine id
Trustee->>Trustee: send_secret(client, id)
Trustee->>KBS: set_resource(url, auth_key_token, resource_bytes, secret_path(id), certs)
end
Reconcile->>Trustee: update_attestation_keys(client)
Trustee->>K8sAPI: list Secrets label type=AttestationKey
loop for each ak in ak_secrets
Trustee->>Trustee: register_ak(client, ak)
Trustee->>KBS: set_sample_rv(url, "trusted_aks", ak, auth_key_token, certs)
end
end
Reconcile-->>SyncCtrl: Action::await_change()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
6ca5e47 to
5039c64
Compare
- Add a register_ak function to add the AK to the KBS as a reference value. - Update the attestation policy with a check to verify that the AK is registered. - Add a test to confirm the creation and synchronization of the AK upon trustee restarts. Signed-off-by: Roy Kaufman <rkaufman@redhat.com>
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Following PR#248
This PR introduces the registration of AK via the KBS API.
register_akfunction to add the AK to the KBS as a reference value.Summary by Sourcery
Register trustee machine secrets and attestation keys with the KBS API and keep them synchronized across trustee restarts.
New Features:
Enhancements:
Build:
Tests: