-
Notifications
You must be signed in to change notification settings - Fork 25
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
Use one set of encryption keys on all shards for match key encryption #1474
Use one set of encryption keys on all shards for match key encryption #1474
Conversation
This almost completes the setup for TLS/encryption infrastructure with one major exception - match key encryption keys are not re-used across shards. I have a PR almost ready, but decided to split that functionality to make PR somewhat revieweable
This takes the simplest approach of overwriting the key files after creating them. Unfortunately there is no easy way to test this without writing a new protocol, so we'll wait until Hybrid comes into play. In the meantime I tested it manually to make sure files get overwritten ```bash running 1 test generating configuration for 3 shards in /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb ... ❯ cmp /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard0/h1_mk.key /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard1/h1_mk.key ❯ cmp /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard0/h1_mk.key /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard1/h2_mk.key /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard0/h1_mk.key /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard1/h2_mk.key differ: char 1, line 1 ❯ cmp /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard0/h1_mk.key /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard2/h1_mk.key ❯ cmp /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard0/h2_mk.key /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard2/h2_mk.key cmp /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard0/h3_mk.pub /var/folders/n2/wgkrrbd57173j9dvy8bdjcvw0000gn/T/.tmpCMhgQb/shard2/h3_mk.pub ```
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1474 +/- ##
==========================================
- Coverage 93.86% 93.85% -0.01%
==========================================
Files 235 235
Lines 42451 42453 +2
==========================================
Hits 39845 39845
- Misses 2606 2608 +2 ☔ View full report in Codecov by Sentry. |
for dest_shard in 1..args.shard_count() { | ||
let dest_shard_dir = args.output_dir.join(shard_conf_folder(dest_shard)); | ||
for helper_id in 1..=3 { | ||
fs::copy( |
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.
the previous version of this code just referred to the leader shards conf. We need to have an actual copy of the files?
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.
I think the previous version didn't really work because it hasn't created the appropriate files for all shards to be initialized correctly. The structure was something like this
shard0/
h1.pem
shard1/
h2.pem
...
instead of
shard0/
h1.pem,
h2.pem,
h3.pem
...
as each shard needs its own configuration to be complete, they need to have access to encryption keys in their folder
This builds on top #1473 and only adds this commit
This takes the simplest approach of overwriting the key files after
creating them. Unfortunately there is no easy way to test this without
writing a new protocol, so we'll wait until Hybrid comes into play.
In the meantime I tested it manually to make sure files get overwritten