-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29368: Key management for encryption at rest (MVP changes) #7421
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
Closed
+15,444
−424
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…-management-feature
Co-authored-by: Hari Dara <haridara@gmail.com>
…-management-feature
This comment has been minimized.
This comment has been minimized.
haridsv
added a commit
to haridsv/hbase
that referenced
this pull request
Oct 30, 2025
Contributor
Author
|
Fixing misc. issues flagged in the PR validation build via PR #7423 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…-management-feature
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
💔 -1 overall
This message was automatically generated. |
Contributor
|
You can run mvn spotless:apply for spotless failures |
haridsv
added a commit
to haridsv/hbase
that referenced
this pull request
Dec 18, 2025
…ement feature This commit prepares the codebase for the upcoming key management feature (HBASE-29368) by introducing the necessary API definitions, protocol buffer changes, and infrastructure refactoring. No functional changes are included; all implementation will follow in the feature PR. This precursor PR essentially extracts the API surface definitions and infrastructure refactoring from the main feature PR (apache#7421) to facilitate easier review. By separating the ~15k line feature PR into a smaller precursor containing interface definitions, protocol changes, and method signature updates, the subsequent feature PR will focus purely on implementation logic. API Surface Additions: * New interfaces: - KeymetaAdmin: Admin API for key management operations - Server methods for cache management (getManagedKeyDataCache, getSystemKeyCache) * Protocol buffer definitions: - ManagedKeys.proto: Definitions for managed key data and operations - Admin.proto: RPC methods for key management admin operations - Procedure.proto: Key rotation procedure support Infrastructure Refactoring: * Encryption context creation: - Moved createEncryptionContext from EncryptionUtil (client) to SecurityUtil (server) where it properly belongs, as it requires server-side resources - Added overloads to support future key encryption key (KEK) parameters * Method signature updates: - Added ManagedKeyDataCache and SystemKeyCache parameters to encryption-related methods throughout HRegion, HStore, HStoreFile, and HFile classes - Updated constructors and factory methods to thread cache references - All cache parameters are currently null/unused, enabling gradual feature rollout * New utility methods: - Encryption.encryptWithGivenKey() / decryptWithGivenKey(): Extract method refactoring to support both subject-based and KEK-based encryption - EncryptionUtil.wrapKey() / unwrapKey() overloads with KEK parameter - Bytes.add() 4-argument overload for concatenation Stub Infrastructure: * Blank place holder shells for some public data classes such as ManagedKeyData and KeymetaAdminClient * Stub implementations for key management services and caches that return null or throw UnsupportedOperationException, clearly documented as placeholders * New package org.apache.hadoop.hbase.keymeta for key management classes * Mock services updated to support new cache getter methods for testing Code Organization: * Procedure framework: Added support for region-level server name tracking to support future key rotation procedures * Testing infrastructure updated to support new constructor signatures All stub implementations clearly document they are placeholders for the upcoming feature PR. Existing encryption functionality remains unchanged and continues to work as before. Testing: * All existing tests pass (precursor introduces no functional changes) * Build completes successfully with new API surface * Backward compatibility maintained for non-key-management code paths
Contributor
Author
|
Closing as PR #7618 supersedes this PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira: HBASE-29368
Design doc: https://docs.google.com/document/d/1ToW_rveXHXUc1F6eFNQfu5LOeMAjzgq6FcYUDbdZrSM/edit?usp=sharing
Discussion thread: https://lists.apache.org/thread/q7g2rr2xcgl64rkn9j3mnokf6fvohp2y
Cumulative changes from feature branch corresponding to the following sub-tasks:
Overview
This feature introduces a comprehensive key management system that extends HBase's existing encryption-at-rest capabilities. The implementation provides enterprise-grade key lifecycle management with support for key rotation, hierarchical namespace resolution for key lookup, key caching and improved integration with key management systems to handle key life cycles and external key changes.
Key Features
1. Managed Keys Infrastructure
ManagedKeyProviderinterface for pluggable key provider implementations on the lines of the existingKeyProviderinterface.ManagedKeyStoreKeyProviderimplementation using Java KeyStore, similar to the existingKeyStoreKeyProvider.table/familynamespace → table name → global namespace2. System Key (STK) Management
3. KeymetaAdmin API
enableKeyManagement(keyCust, keyNamespace)- Enable key management for a custodian/namespace pairgetManagedKeys(keyCust, keyNamespace)- Query key status and metadatarotateSTK()- Check for and propagate new system keysdisableKeyManagement(keyCust, keyNamespace)- Disable all the keys for a custodian/namespacedisableManagedKey(keyCust, keyNamespace, keyMetadataHash)- Disable a specific keyrotateManagedKey(keyCust, keyNamespace)- Rotate the active keyrefreshManagedKeys(keyCust, keyNamespace)- Refresh from external KMS to validate all the keys.4. Persistent Key Metadata Storage
hbase:keymetafor storing key metadata and state which acts as anL2cache.ACTIVE,INACTIVE,DISABLED,FAILEDstates5. Multi-Layer Caching
6. HBase Shell Integration
enable_key_management- Enable key management for a custodian and namespaceshow_key_status- Display key status and metadatarotate_stk- Trigger system key rotationdisable_key_management- Disable key management for a custodian and namespacedisable_managed_key- Disable a specific keyrotate_managed_key- Rotate the active keyrefresh_managed_keys- Refresh all keys for a custodian and namespaceImplementation Highlights
Architecture
The implementation follows a layered architecture:
ManagedKeyProviderfor KMS integrationKeyMetaAdminAPI for administrative operationsKeymetaTableAccessorfor metadata storageManagedKeyDataCacheandSystemKeyCachefor performanceAreas for Review
I would particularly appreciate feedback on:
KeymetaAdminAPI intuitive and complete for common key management scenarios?Next Steps
After incorporating community feedback, I plan to:
How to Review
This PR introduces changes across multiple modules. Rather than reviewing all 143 files, I recommend focusing on these core components first:
Core Architecture:
ManagedKeyProvider,KeymetaAdmin,ManagedKeyDatainterfaces (hbase-common)ManagedKeys.proto- protocol definitionsHMasterand misc. procedure changes - initialization ofkeymetain a predictable orderFixedFileTrailer+ reader/writer changes - encode/decode additional encryption key in store filesKey Implementation:
KeymetaAdminImpl,KeymetaTableAccessor,ManagedKeyUtils,SystemKeyManager,SystemKeyAccessor- admin operations and persistenceManagedKeyDataCache,SystemKeyCache- caching layerSecurityUtil- encryption context creationClient & Shell:
KeymetaAdminClient- client APITests & Examples:
TestKeymetaAdminImpl,TestManagedKeymeta- for usage patternskey_provider_keymeta_migration_test.rb- E2E migration stepsNote: The remaining files contain secondary changes (API updates, test helpers, configuration constants, etc.) that can be reviewed later or skipped for initial feedback.