-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Introduces a server_side_encryption parameter for the S3 [OUTPUT] plugin. Possible values are AES256 and aws:kms, as per AWS API documentation: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html#API_PutObject_ResponseSyntax - If either value is provided, the x-amz-server-side-encryption header will be included with S3 requests with the corresponding value set. Signed-off-by: Mark Solters <[email protected]>
- Loading branch information
Showing
5 changed files
with
138 additions
and
1 deletion.
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); | ||
return -1; | ||
} |