Skip to content

Commit 8067db9

Browse files
committed
Add SSE-C encryption config
1 parent bb37243 commit 8067db9

5 files changed

Lines changed: 800 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ jobs:
6464
6565
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
6666
- name: Install Ubuntu packages
67-
run: sudo apt-get -y install protobuf-compiler
67+
run: |
68+
sudo apt-get update
69+
sudo apt-get -y install protobuf-compiler
6870
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v.6.1.0
6971
with:
7072
python-version: '3.11'
@@ -132,7 +134,9 @@ jobs:
132134
- .github/workflows/ci.yml
133135
- name: Install Ubuntu packages
134136
if: always() && steps.modified.outputs.rust_src == 'true'
135-
run: sudo apt-get -y install protobuf-compiler
137+
run: |
138+
sudo apt-get update
139+
sudo apt-get -y install protobuf-compiler
136140
- name: Setup nightly Rust Toolchain (for rustfmt)
137141
if: steps.modified.outputs.rust_src == 'true'
138142
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master

.github/workflows/ui-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
task:
3131
- name: Cypress run
3232
command: |
33+
sudo apt-get update
3334
sudo apt-get -y install protobuf-compiler
3435
CI=false yarn --cwd quickwit-ui build
3536
RUSTFLAGS="--cfg tokio_unstable" cargo build --features=postgres

quickwit/quickwit-config/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ pub use crate::node_config::{
8080
use crate::source_config::serialize::{SourceConfigV0_7, SourceConfigV0_8, VersionedSourceConfig};
8181
pub use crate::storage_config::{
8282
AzureStorageConfig, FileStorageConfig, GoogleCloudStorageConfig, RamStorageConfig,
83-
S3StorageConfig, StorageBackend, StorageBackendFlavor, StorageConfig, StorageConfigs,
83+
S3EncryptionConfig, S3StorageConfig, StorageBackend, StorageBackendFlavor, StorageConfig,
84+
StorageConfigs,
8485
};
8586

8687
/// Returns true if the ingest API v2 is enabled.

quickwit/quickwit-config/src/storage_config.rs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,36 @@ impl fmt::Debug for AzureStorageConfig {
308308
}
309309
}
310310

311+
#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)]
312+
#[serde(tag = "type", rename_all = "snake_case")]
313+
pub enum S3EncryptionConfig {
314+
/// This is the standard AES256 SSE-C header config. Key is expected to be a
315+
/// 256bit base64-encoded string, and key_md5 is expected to be the
316+
/// base64-encoded MD5 digest of the (binary) key. Akamai gen1 buckets don't
317+
/// respect this (only the a 32 hex char key is expected).
318+
SseC {
319+
key: String,
320+
key_md5: String,
321+
read_only: bool,
322+
},
323+
}
324+
325+
impl fmt::Debug for S3EncryptionConfig {
326+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
327+
match self {
328+
S3EncryptionConfig::SseC {
329+
key_md5, read_only, ..
330+
} => f
331+
.debug_struct("S3EncryptionConfig")
332+
.field("type", &"sse_c")
333+
.field("key", &"***redacted***")
334+
.field("key_md5", key_md5)
335+
.field("read_only", read_only)
336+
.finish(),
337+
}
338+
}
339+
}
340+
311341
#[derive(Clone, Default, Eq, PartialEq, Serialize, Deserialize)]
312342
#[serde(deny_unknown_fields)]
313343
pub struct S3StorageConfig {
@@ -329,6 +359,8 @@ pub struct S3StorageConfig {
329359
pub disable_multi_object_delete: bool,
330360
#[serde(default)]
331361
pub disable_multipart_upload: bool,
362+
#[serde(default)]
363+
pub encryption: Option<S3EncryptionConfig>,
332364
}
333365

334366
impl S3StorageConfig {
@@ -685,4 +717,31 @@ mod tests {
685717
assert_eq!(s3_storage_config.flavor, Some(StorageBackendFlavor::MinIO));
686718
}
687719
}
720+
721+
#[test]
722+
fn test_storage_s3_config_encryption_serde() {
723+
{
724+
let s3_storage_config_yaml = r#"
725+
endpoint: http://localhost:4566
726+
encryption:
727+
type: sse_c
728+
key: test-customer-key
729+
key_md5: test-customer-key-md5
730+
read_only: true
731+
"#;
732+
let s3_storage_config: S3StorageConfig =
733+
serde_yaml::from_str(s3_storage_config_yaml).unwrap();
734+
735+
let expected_s3_config = S3StorageConfig {
736+
endpoint: Some("http://localhost:4566".to_string()),
737+
encryption: Some(S3EncryptionConfig::SseC {
738+
key: "test-customer-key".to_string(),
739+
key_md5: "test-customer-key-md5".to_string(),
740+
read_only: true,
741+
}),
742+
..Default::default()
743+
};
744+
assert_eq!(s3_storage_config, expected_s3_config);
745+
}
746+
}
688747
}

0 commit comments

Comments
 (0)