-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADR: Key Management Improvements #1675
Comments
I'm a fan. Key ID's can be any length right? |
cc: @biscoe916 @jrschumacher Updated ERD to support key management ADR. erDiagram
key_access_server {
uuid id
varchar uri
varchar name
varchar source_type
}
key_access_server_keys {
uuid id
uuid key_access_server_id
}
asym_keys {
uuid id
varchar key_id
varchar algorithm
varchar key_status
varchar key_mode
jsonb public_key_ctx
jsonb private_key_ctx
uuid provider_config_id
jsonb metadata
}
sym_keys {
uuid id
varchar key
varchar key_id
varchar key_status
varchar key_mode
uuid provider_config_id
}
provider_configuration {
uuid id
varchar provider_type
jsonb config_json
jsonb metadata
}
namespace_public_key_mappings {
uuid namespace_id
uuid kas_key_id
}
definition_public_key_mappings {
uuid definition_id
uuid kas_key_id
}
value_public_key_mappings {
uuid value_id
uuid kas_key_id
}
key_access_server ||--o{ key_access_server_keys : has
key_access_server_keys ||--|| asym_keys : inherits
asym_keys }o--|| provider_configuration : uses
sym_keys }o--|| provider_configuration : uses
asym_keys ||--o{ namespace_public_key_mappings : maps_to
asym_keys ||--o{ definition_public_key_mappings : maps_to
asym_keys ||--o{ value_public_key_mappings : maps_to
Proto Changes introduce a new // Supported key algorithms.
enum Algorithm {
ALGORITHM_UNSPECIFIED = 0;
ALGORITHM_RSA_2048 = 1;
ALGORITHM_RSA_4096 = 2;
ALGORITHM_EC_P256 = 3;
ALGORITHM_EC_P384 = 4;
ALGORITHM_EC_P521 = 5;
}
// The status of the key.
enum KeyStatus {
KEY_STATUS_UNSPECIFIED = 0;
KEY_STATUS_ACTIVE = 1;
KEY_STATUS_INACTIVE = 2;
KEY_STATUS_COMPROMISED = 3;
KEY_STATUS_EXPIRED = 4;
}
// Describe how the kas private key is managed.
// If the key mode is LOCAL, then the kas private key is stored in the database.
// This could be encrypted or unencrypted.
// Remote means that the kas private key is stored in a remote key system like KMS or HSM
// and all operations are done by the remote key system.
enum KeyMode {
KEY_MODE_UNSPECIFIED = 0;
KEY_MODE_LOCAL = 1;
KEY_MODE_REMOTE = 2;
}
// Describes whether this kas is managed by the organization or if they imported
// the kas information from an external party. These two modes are necessary in order
// to encrypt a tdf dek with an external parties kas public key.
enum SourceType {
SOURCE_TYPE_UNSPECIFIED = 0;
// The kas is managed by the organization.
SOURCE_TYPE_INTERNAL = 1;
// The kas is managed by an external party.
SOURCE_TYPE_EXTERNAL = 2;
}
message KeyAccessServer {
string id = 1;
string name = 2;
string uri = 3;
SourceType source_type = 4;
// Common metadata
common.Metadata metadata = 100;
}
message AsymKey {
string id = 1;
string key_id = 2;
Algorithm algorithm = 3;
KeyStatus status = 4;
KeyMode mode = 5;
string public_key_ctx = 6;
string private_key_ctx = 7;
ProviderConfig provider_config = 8;
// Common metadata
common.Metadata metadata = 100;
}
message SymKey {
string id = 1;
string key_id = 2;
KeyStatus status = 3;
KeyMode mode = 4;
ProviderConfig provider_config = 6;
// Common metadata
common.Metadata metadata = 100;
}
service KeyManagementService {
// Key Access Server Management
rpc CreateKeyAccessServer(CreateKeyAccessServerRequest) returns (CreateKeyAccessServerResponse) {}
rpc GetKeyAccessServer(GetKeyAccessServerRequest) returns (GetKeyAccessServerResponse) {}
rpc ListKeyAccessServers(ListKeyAccessServersRequest) returns (ListKeyAccessServersResponse) {}
rpc UpdateKeyAccessServer(UpdateKeyAccessServerRequest) returns (UpdateKeyAccessServerResponse) {}
// Key Management
rpc CreateKey(CreateKeyRequest) returns (CreateKeyResponse) {}
rpc GetKey(GetKeyRequest) returns (GetKeyResponse) {}
rpc ListKeys(ListKeysRequest) returns (ListKeysResponse) {}
rpc UpdateKey(UpdateKeyRequest) returns (UpdateKeyResponse) {}
rpc RotateKey(RotateKeyRequest) returns (RotateKeyResponse) {}
}
// Additions to UnsafeService
service UnsafeService {
rpc UnsafeDeleteKeyAccessService(UnsafeDeleteKeyAccessServerRequest) returns (UnsafeDeleteKeyAccessServerResponse) {}
rpc UnsafeDeleteKey(UnsafeDeleteKeyRequest) returns (UnsafeDeleteKeyResponse) {}
} Work will also need to be done to expose this crypto provider interface in order to acommodate key providers such as openbao, aws/gcp kms, etc... |
Background
OpenTDF's current key management implementation requires administrators to follow different procedures for different types of keys. KAS keys must be defined in two separate locations within the opentdf config, and other keys have their own unique management requirements. While some of this fragmentation stems from the separation between OpenTDF and vendor specific capabilities, it creates unnecessary complexity and increases the risk of configuration errors.
The platform also lacks a standardized configuration structure for accessing key material from modern key management solutions such as:
Goals
Proposal Overview
This document proposes creating a consistent key management and retrieval mechanism that can be used across both OpenTDF and any vendor specific offerings. The solution will eliminate the need for multiple configuration points while providing flexible integration with various key storage solutions.
Current State
Types of keys
KAS Keys
KAS (Key Access Server) keys can be:
Encrypted Search Keys
Bundle Signing Keys
Policy Signing Keys
Future Key Requirements
The platform needs to accommodate additional key types:
Current Management Approaches
Each key type currently requires its own management approach:
KAS Keys:
Vendor specific keys:
Signing Keys (Bundle and Policy):
These disparate approaches create several challenges:
Proposed Solution
Overview
We propose eliminating key pre-provisioning in config.yaml in favor of a unified key management system that provides:
Key Storage and Identification
The solution consists of two main components:
1. Key Storage
2. Key Identification
Key Retrieval Process
Example: Key retrieval for rewrap operation
k1
) from key access objectkeyProvider.getKeyConfiguration(k1)
Performance Considerations
To ensure optimal performance:
n
keysImplementation Plan
Phase 1: Core Infrastructure
keys
table schema ReferencePhase 2: Provider Integration
Risks and Mitigations
Operational Risks
1. Migration Complexity
Risk: Existing deployments may face disruption during migration to the new key management system.
Mitigation:
2. Performance Impact
Risk: Additional abstraction layers and external key fetching could impact system performance.
Mitigation:
3. Configuration Errors
Risk: While simpler, the new system still requires proper configuration of external key management systems.
Mitigation:
Technical Risks
1. Integration Complexity
Risk: Different key management systems have varying APIs and capabilities.
Mitigation:
The text was updated successfully, but these errors were encountered: