[KeyManager] Introduce Key Management Agent#749
[KeyManager] Introduce Key Management Agent#749NilanjanDaw wants to merge 6 commits intogoogle:mainfrom
Conversation
…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.
bba6d55 to
ffb9583
Compare
|
|
||
| errChan := make(chan error, 1) | ||
| go func() { | ||
| errChan <- runWSD(ctx, socketPath) |
There was a problem hiding this comment.
we will also have to pass KPS mechanism here and in the following tests where we call runWSD.
|
|
||
| errChan := make(chan error, 1) | ||
| go func() { | ||
| errChan <- runWSD(ctx, socketPath) |
There was a problem hiding this comment.
the number of expected args here is 3. need to pass mode
| modeStr := os.Getenv("KEY_PROTECTION_MECHANISM") | ||
| mode := keymanager.KeyProtectionMechanism_KEY_PROTECTION_VM_EMULATED | ||
| if modeStr != "" { | ||
| if v, ok := keymanager.KeyProtectionMechanism_value[modeStr]; ok { | ||
| mode = keymanager.KeyProtectionMechanism(v) | ||
| } | ||
| } |
There was a problem hiding this comment.
even though we control the pipeline, what if someone sets an incorrect env like "RANDOM_MODE", our code won't fail in such case right?
There was a problem hiding this comment.
Makes sense, add a separate environment variable parser to handle these.
| roleStr := os.Getenv("SERVICE_ROLE") | ||
| role := keymanager.ServiceRole_WSD | ||
| if roleStr != "" { | ||
| if v, ok := keymanager.ServiceRole_value[roleStr]; ok { | ||
| role = keymanager.ServiceRole(v) | ||
| } | ||
| } |
There was a problem hiding this comment.
same here. our code won't fail if value of env SERVICE_ROLE isn't recognized.
There was a problem hiding this comment.
Makes sense, add a separate environment variable parser to handle these.
| RUN cargo install bindgen-cli | ||
|
|
||
| WORKDIR /app | ||
| COPY . . |
There was a problem hiding this comment.
should we add .dockerignore to avoid copying all the files like .git?
There was a problem hiding this comment.
Ack added a .gitignore file
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_VMsecurity 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 theSERVICE_ROLEenvironment variable.- Multi-Mode Support: Implemented logic to switch between
KEY_PROTECTION_VM_EMULATEDandKEY_PROTECTION_VMmodes, ensuring full backward compatibility while preparing for isolated VM deployments.- Containerization: Introduces the KMA Dockerfile to build and deploy the unified
/kmabinary- 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 PR is dependent on #743