-
Notifications
You must be signed in to change notification settings - Fork 266
Encryption Key Rotation Support #2350
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
Open
alstanchev
wants to merge
5
commits into
eclipse-ditto:master
Choose a base branch
from
boschglobal:feature/rolling-keys
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
142eedf
Add dual-key encryption support for key rotation
alstanchev f402a27
Add encryption key migration via piggyback commands
alstanchev ec82e0c
Adds documentation for rolling encrypted secrets symmetric key.
alstanchev 3dcf373
Some refactoring
alstanchev e495d12
chart version
alstanchev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,8 @@ | |
| import org.apache.pekko.cluster.sharding.ClusterSharding; | ||
| import org.apache.pekko.cluster.sharding.ClusterShardingSettings; | ||
| import org.apache.pekko.event.DiagnosticLoggingAdapter; | ||
| import org.apache.pekko.cluster.singleton.ClusterSingletonProxy; | ||
| import org.apache.pekko.cluster.singleton.ClusterSingletonProxySettings; | ||
| import org.apache.pekko.japi.pf.DeciderBuilder; | ||
| import org.eclipse.ditto.base.service.RootChildActorStarter; | ||
| import org.eclipse.ditto.base.service.actors.DittoRootActor; | ||
|
|
@@ -33,6 +35,7 @@ | |
| import org.eclipse.ditto.connectivity.service.messaging.persistence.ConnectionPersistenceOperationsActor; | ||
| import org.eclipse.ditto.connectivity.service.messaging.persistence.ConnectionPersistenceStreamingActorCreator; | ||
| import org.eclipse.ditto.connectivity.service.messaging.persistence.ConnectionSupervisorActor; | ||
| import org.eclipse.ditto.connectivity.service.messaging.persistence.EncryptionMigrationActor; | ||
| import org.eclipse.ditto.edge.service.dispatching.EdgeCommandForwarderActor; | ||
| import org.eclipse.ditto.edge.service.dispatching.ShardRegions; | ||
| import org.eclipse.ditto.internal.utils.cluster.ClusterUtil; | ||
|
|
@@ -46,6 +49,7 @@ | |
| import org.eclipse.ditto.internal.utils.health.config.PersistenceConfig; | ||
| import org.eclipse.ditto.internal.utils.namespaces.BlockedNamespaces; | ||
| import org.eclipse.ditto.internal.utils.pekko.logging.DittoLoggerFactory; | ||
| import org.eclipse.ditto.internal.utils.persistence.mongo.MongoClientWrapper; | ||
| import org.eclipse.ditto.internal.utils.persistence.mongo.MongoHealthChecker; | ||
| import org.eclipse.ditto.internal.utils.persistence.mongo.streaming.MongoReadJournal; | ||
| import org.eclipse.ditto.internal.utils.persistentactors.PersistencePingActor; | ||
|
|
@@ -116,6 +120,8 @@ private ConnectivityRootActor(final ConnectivityConfig connectivityConfig, | |
| ConnectionPersistenceOperationsActor.props(pubSubMediator, connectivityConfig.getMongoDbConfig(), | ||
| config, connectivityConfig.getPersistenceOperationsConfig())); | ||
|
|
||
| startEncryptionMigrationSingleton(actorSystem, connectivityConfig); | ||
|
|
||
| RootChildActorStarter.get(actorSystem, ScopedConfig.dittoExtension(config)).execute(getContext()); | ||
|
|
||
|
|
||
|
|
@@ -150,6 +156,21 @@ protected PartialFunction<Throwable, SupervisorStrategy.Directive> getSupervisio | |
| }).build().orElse(super.getSupervisionDecider()); | ||
| } | ||
|
|
||
| private void startEncryptionMigrationSingleton(final ActorSystem actorSystem, | ||
| final ConnectivityConfig connectivityConfig) { | ||
| final MongoClientWrapper mongoClientWrapper = | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will create also its own connection pool, based on the min/max config of the service. This is a little much, couldn't we reuse the existing MongoClientWrapper, via |
||
| MongoClientWrapper.newInstance(connectivityConfig.getMongoDbConfig()); | ||
| final String managerName = EncryptionMigrationActor.ACTOR_NAME + "Singleton"; | ||
| final ActorRef singletonManager = startClusterSingletonActor( | ||
| EncryptionMigrationActor.props(connectivityConfig, mongoClientWrapper), managerName); | ||
|
|
||
| final ClusterSingletonProxySettings proxySettings = | ||
| ClusterSingletonProxySettings.create(actorSystem).withRole(CLUSTER_ROLE); | ||
| final Props proxyProps = ClusterSingletonProxy.props( | ||
| singletonManager.path().toStringWithoutAddress(), proxySettings); | ||
| getContext().actorOf(proxyProps, EncryptionMigrationActor.ACTOR_NAME); | ||
| } | ||
|
|
||
| private ActorRef startClusterSingletonActor(final Props props, final String name) { | ||
| return ClusterUtil.startSingleton(getContext(), CLUSTER_ROLE, name, props); | ||
| } | ||
|
|
||
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
startEncryptionMigrationSingleton()is called unconditionally, which means every deployment — including those that never use encryption — pays the cost of: