-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Adds SSE-KMS and SSE-C config to S3 Objstore #3064
Conversation
Signed-off-by: James Bach <james.bach@transferwise.com>
Signed-off-by: James Bach <james.bach@transferwise.com>
Signed-off-by: James Bach <james.bach@transferwise.com>
Signed-off-by: James Bach <james.bach@transferwise.com>
Signed-off-by: James Bach <james.bach@transferwise.com>
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.
Amazing, this is what we need. I have minor suggestions though, otherwise LGTM!
Thanks for helping here and reimplementing old PR 🤗
Signed-off-by: James Bach <james.bach@transferwise.com>
Signed-off-by: James Bach <james.bach@transferwise.com>
Signed-off-by: James Bach <james.bach@transferwise.com>
Prior to KMS configuration:
So, for testing (with KMS), I use the the following policy that lets Thanos actually use the KMS key + upload to buckets: {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:AbortMultipartUpload",
"s3:ListBucket",
"s3:DeleteObject",
"s3:PutObjectAcl",
"s3:ListMultipartUploadParts"
],
"Resource": [
"arn:aws:s3:::secret-bucket",
"arn:aws:s3:::secret-bucket/*"
]
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"kms:Encrypt",
"kms:GenerateDataKey",
"kms:Decrypt"
],
"Resource": [
"arn:aws:kms:eu-central-1:1234567890abc:key/12345678-12ab-34cd-56ef-1234567890ab"
]
}
]
} And configure the key (using custom helm chart, ignore that but take note of the service:
args:
- "compact"
- "--log.level=debug"
- "--log.format=logfmt"
- "--http-address=0.0.0.0:10902"
- |
--objstore.config=
type: S3
config:
bucket: secret-bucket
endpoint: s3.eu-central-1.amazonaws.com
sse_config:
type: SSE-KMS
kms_key_id: 12345678-12ab-34cd-56ef-1234567890ab
- "--data-dir=/var/thanos/compact"
- "--consistency-delay=30m"
- "--retention.resolution-raw=0d"
- "--retention.resolution-5m=0d"
- "--retention.resolution-1h=0d"
- "--block-sync-concurrency=20"
- "--compact.concurrency=1"
- "--wait" level=debug ts=2020-08-24T10:33:14.97343253Z caller=objstore.go:158 group="0@{cluster=\"secret-environment.transferwise.com\", prometheus=\"prometheus\", prometheus_shard=\"0\", replica=\"prometheus-k8s-shard-0-1.secret-environment.transferwise.com\"}" groupKey=0@11189359859295756877 msg="uploaded file" from=/var/thanos/compact/compact/0@11189359859295756877/01EGG0DS7MV3TDG8HGNTVA4W3F/meta.json dst=debug/metas/01EGG0DS7MV3TDG8HGNTVA4W3F.json bucket="tracing: secret-bucket"
level=info ts=2020-08-24T10:33:16.778498888Z caller=fetcher.go:453 component=block.BaseFetcher msg="successfully synchronized block metadata" duration=244.381563ms cached=168 returned=168 partial=1
level=debug ts=2020-08-24T10:33:16.801469782Z caller=objstore.go:158 group="0@{cluster=\"secret-environment.transferwise.com\", prometheus=\"prometheus\", prometheus_shard=\"0\", replica=\"prometheus-k8s-shard-0-1.secret-environment.transferwise.com\"}" groupKey=0@11189359859295756877 msg="uploaded file" from=/var/thanos/compact/compact/0@11189359859295756877/01EGG0DS7MV3TDG8HGNTVA4W3F/chunks/000001 dst=01EGG0DS7MV3TDG8HGNTVA4W3F/chunks/000001 bucket="tracing: secret-bucket"
level=debug ts=2020-08-24T10:33:18.556145359Z caller=objstore.go:158 group="0@{cluster=\"secret-environment.transferwise.com\", prometheus=\"prometheus\", prometheus_shard=\"0\", replica=\"prometheus-k8s-shard-0-1.secret-environment.transferwise.com\"}" groupKey=0@11189359859295756877 msg="uploaded file" from=/var/thanos/compact/compact/0@11189359859295756877/01EGG0DS7MV3TDG8HGNTVA4W3F/chunks/000002 dst=01EGG0DS7MV3TDG8HGNTVA4W3F/chunks/000002 bucket="tracing: secret-bucket"
level=debug ts=2020-08-24T10:33:20.047301162Z caller=objstore.go:158 group="0@{cluster=\"secret-environment.transferwise.com\", prometheus=\"prometheus\", prometheus_shard=\"0\", replica=\"prometheus-k8s-shard-0-1.secret-environment.transferwise.com\"}" groupKey=0@11189359859295756877 msg="uploaded file" from=/var/thanos/compact/compact/0@11189359859295756877/01EGG0DS7MV3TDG8HGNTVA4W3F/index dst=01EGG0DS7MV3TDG8HGNTVA4W3F/index bucket="tracing: secret-bucket"
level=debug ts=2020-08-24T10:33:20.101614981Z caller=objstore.go:158 group="0@{cluster=\"secret-environment.transferwise.com\", prometheus=\"prometheus\", prometheus_shard=\"0\", replica=\"prometheus-k8s-shard-0-1.secret-environment.transferwise.com\"}" groupKey=0@11189359859295756877 msg="uploaded file" from=/var/thanos/compact/compact/0@11189359859295756877/01EGG0DS7MV3TDG8HGNTVA4W3F/meta.json dst=01EGG0DS7MV3TDG8HGNTVA4W3F/meta.json bucket="tracing: secret-bucket" And to test with an unhappy case of a misconfigured key:
I should add the policy I used to the documentation. |
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.
Amazing. Small suggestions only and happy to merge this! 🤗
```yaml | ||
|
||
--- | ||
sse_config: |
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.
👍
Signed-off-by: James Bach <james.bach@transferwise.com>
Signed-off-by: James Bach <james.bach@transferwise.com>
Signed-off-by: James Bach <james.bach@transferwise.com>
Signed-off-by: James Bach <james.bach@transferwise.com>
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.
LGTM!
Thanks for your patience! 💪
@@ -173,8 +192,32 @@ func NewBucketWithConfig(logger log.Logger, config Config, component string) (*B | |||
client.SetAppInfo(fmt.Sprintf("thanos-%s", component), fmt.Sprintf("%s (%s)", version.Version, runtime.Version())) | |||
|
|||
var sse encrypt.ServerSide | |||
if config.SSEEncryption { | |||
sse = encrypt.NewSSE() | |||
if config.SSEConfig.Type != "" { |
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.
Instead of this we can have just empty case for ""
Not a blocker (:
Signed-off-by: James Bach <james.bach@transferwise.com>
Going to wait for tests to run and then ready to merge 👌 |
OMG link checking job is too annoying, let's kill it for now.... Related issue: #3060 |
Thanks! |
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.
We are missing an important things here.
encrypt_sse: true
should fail and not be silently ignored. This will ensure users will not get surprised. Will add that change in separate PR (:
Changes
Adds S3 SSE via a
sse_config
block. It's a reimplementation of #2170 since it looks like it was abandoned. It solves #946.There are 3 types of SSE you can use: SSE-S3, SSE-KMS, and SSE-C.
Verification
I can verify if this works when I get back to work. We're currently running into 403 errors from not providing a KMS key ID, so when we don't get 403s I'll know it works.