Skip to content

[KeyManager] Implement heartbeat mechanism#752

Open
NilanjanDaw wants to merge 3 commits intogoogle:mainfrom
NilanjanDaw:add-kma-heartbeat
Open

[KeyManager] Implement heartbeat mechanism#752
NilanjanDaw wants to merge 3 commits intogoogle:mainfrom
NilanjanDaw:add-kma-heartbeat

Conversation

@NilanjanDaw
Copy link
Copy Markdown
Collaborator

@NilanjanDaw NilanjanDaw commented Apr 20, 2026

This commit implements the state synchronization mechanism between the Workload Service Daemon (WSD) and the Key Protection Service (KPS) using a periodic heartbeat and token verification system. It also adds a batch deletion capability to optimize state cleanup.

Key Changes

  • Heartbeat Mechanism: Added a periodic gRPC Heartbeat call from WSD to KPS to detect KPS resets and network failures, with exponential back-off.
  • State Synchronization: Implemented boot token generation in KPS and verification in WSD to purge stale state on token mismatch.
  • Batch Deletion: Added DestroyAllKeys to wskcc and WorkloadService interface to allow purging all keys at once, optimizing cleanup.
  • Proto Definitions: Created api.proto for KPS with Heartbeat definition and generated Go bindings.
  • Testing: Added unit tests for heartbeat in both KPS and WSD, and verified token mismatch behavior.

This is a stacked PR dependent on #749 and includes changes from referenced PR.

…ECTION_VM support

This commit introduces the foundational infrastructure for the Key
Management Agent (KMA), enabling the KeyManager to run as a standalone
service independent of the main launcher. It establishes the
architectural groundwork for the KEY_PROTECTION_VM security milestone by
supporting distinct service roles (WSD and KPS) and multiple key
protection mechanisms within a unified entrypoint.

Key Changes
    - Unified Agent Launcher: Introduced keymanager/cmd/agent, a
    standalone entrypoint that replaces the previous WSD-only command.
    It supports both WSD (Workload Service Daemon) and KPS
    (Key Protection Service) roles via the SERVICE_ROLE environment
    variable.
    - Multi-Mode Support: Implemented logic to switch between
    KEY_PROTECTION_VM_EMULATED and KEY_PROTECTION_VM modes, ensuring
    full backward compatibility while preparing for isolated VM
    deployments.
    - Containerization: Introduces the KMA Dockerfile to build and deploy
    the unified /kma binary
    - Testing Infrastructure:
        - Added unit and integration tests for the agent lifecycle,
        including graceful shutdown and socket management.
        - Introduced a Cloud Build configuration to automatically
        validate the containerized agent and its REST APIs via the UDS
        interface.
This commit implements the state synchronization mechanism between the Workload
Service Daemon (WSD) and the Key Protection Service (KPS) using a periodic
heartbeat and token verification system. It also adds a batch deletion
capability to optimize state cleanup.

Key Changes
    - Heartbeat Mechanism: Added a periodic gRPC Heartbeat call from WSD to
      KPS to detect KPS resets and network failures, with exponential
      back-off.
    - State Synchronization: Implemented boot token generation in KPS and
      verification in WSD to purge stale state on token mismatch.
    - Batch Deletion: Added DestroyAllKeys to wskcc and WorkloadService
      interface to allow purging all keys at once, optimizing cleanup.
    - Proto Definitions: Created api.proto for KPS with Heartbeat definition
      and generated Go bindings.
    - Testing: Added unit tests for heartbeat in both KPS and WSD, and
      verified token mismatch behavior.
@NilanjanDaw NilanjanDaw requested review from atulpatildbz and meetrajvala and removed request for atulpatildbz and meetrajvala April 20, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant