-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
S3 Plugin: Implement Server-Side Encryption option #8646
Open
msolters
wants to merge
2
commits into
fluent:master
Choose a base branch
from
msolters:s3-server-side-encryption
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.
+138
−1
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
|
||
/* Fluent Bit | ||
* ========== | ||
* Copyright (C) 2019-2021 The Fluent Bit Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef FLB_AWS_SSE | ||
#define FLB_AWS_SSE | ||
|
||
// Per https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html#API_PutObject_ResponseSyntax | ||
#include <sys/types.h> | ||
#define FLB_AWS_SSE_NONE 0 | ||
#define FLB_AWS_SSE_AWSKMS 1 | ||
#define FLB_AWS_SSE_AES256 2 | ||
|
||
/* | ||
* Get sse type from sse keyword. The return value is used to identify | ||
* what sse option to utilize. | ||
* | ||
* Returns int sse type id - FLB_AWS_SSE_<sse-type> | ||
*/ | ||
int flb_aws_sse_get_type(const char *sse_keyword); | ||
|
||
#endif |
This file contains 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 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 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 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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
|
||
/* Fluent Bit | ||
* ========== | ||
* Copyright (C) 2019-2021 The Fluent Bit Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <fluent-bit/flb_log.h> | ||
|
||
#include <fluent-bit/aws/flb_aws_sse.h> | ||
|
||
#include <stdint.h> | ||
|
||
struct sse_option { | ||
int sse_type; | ||
char *sse_keyword; | ||
}; | ||
|
||
/* | ||
* Library of sse options | ||
* AWS plugins that support sse will have these options. | ||
* Referenced function should return -1 on error and 0 on success. | ||
*/ | ||
static const struct sse_option sse_options[] = { | ||
/* FLB_AWS_SSE_NONE which is 0 is reserved for array footer */ | ||
{ | ||
FLB_AWS_SSE_AWSKMS, | ||
"aws:kms" | ||
}, | ||
{ | ||
FLB_AWS_SSE_AES256, | ||
"AES256" | ||
}, | ||
{ 0 } | ||
}; | ||
|
||
int flb_aws_sse_get_type(const char *sse_keyword) | ||
{ | ||
int ret; | ||
const struct sse_option *o; | ||
|
||
o = sse_options; | ||
|
||
while (o->sse_type != 0) { | ||
ret = strcmp(o->sse_keyword, sse_keyword); | ||
if (ret == 0) { | ||
return o->sse_type; | ||
} | ||
++o; | ||
} | ||
|
||
flb_error("[aws_compress] unknown sse type: %s", sse_keyword); | ||
msolters marked this conversation as resolved.
Show resolved
Hide resolved
msolters marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return -1; | ||
} |
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.
@edsiper is this a recommended style/technique for FLB C code? We have similar bits of code elsewhere in the project that have a set of values but that don't validate them in this way with a object list...