Skip to content

AWS Kinesis Enhancements#279

Merged
cobaltclaudia merged 70 commits into
masterfrom
aws_multi_auth
Dec 17, 2019
Merged

AWS Kinesis Enhancements#279
cobaltclaudia merged 70 commits into
masterfrom
aws_multi_auth

Conversation

@kyleknighted

@kyleknighted kyleknighted commented Sep 26, 2019

Copy link
Copy Markdown
Contributor

Overview

This PR makes the following changes for the graylog-plugin-integrations AWS Kinesis/CloudWatch input:

  1. Improve authorization support: Previously, only an explicit AWS Key/Secret could be used to authorize the input. Now, the user can pick between using a key/secret and automatic AWS authorization, which uses the DefaultAWSCredentialsProviderChain, which allows many more flexible authentication options.

image

See #264 for more info.

As part of this change, the Assume Role ARN option was also moved to the first page (previously was tucked-away on a subsequent page, which was too late, since many AWS SDK calls are initiate starting from the first page):

image

  1. Add ability to specify VPC endpoints for all AWS API services used (CloudWatch, DynamoDB, IAM, and Kinesis). Fields for this are now present on the first page of the setup, since the endpoints must be used throughout the setup wizard. See Support Interface VPC Endpoints for Kinesis Data Streams #271 for more info.

image

Lots of code was changed to implement these, because many API calls support this functionality, and almost all of them had to be updated :)

Closes #264, #271

@danotorrey

Copy link
Copy Markdown
Contributor

I am planning to integrate the backend changes into this PR too. I'll start work on that tomorrow or Wednesday.

@danotorrey

Copy link
Copy Markdown
Contributor

@kyleknighted I have begun working on the backend for this. Sorry for the delay!

@danotorrey danotorrey closed this Oct 16, 2019
@danotorrey danotorrey reopened this Oct 16, 2019
@danotorrey danotorrey self-assigned this Oct 16, 2019
@danotorrey

Copy link
Copy Markdown
Contributor

@kyleknighted I noticed this error in the browser when running this branch:

client.js:196 /Users/danieltorrey/workspace/graylog/master/graylog-project-repos/graylog-plugin-integrations/src/web/aws/common/awsAuth.jsModule not found: Error: Can't resolve './awsKeySecret' in '/Users/danieltorrey/workspace/graylog/master/graylog-project-repos/graylog-plugin-integrations/src/web/aws/common'

@danotorrey

Copy link
Copy Markdown
Contributor

@kyleknighted I have begun working on the backend for this again. I'l keep you updated on my progress.

Dan Torrey and others added 7 commits October 28, 2019 16:52
The initial policy needs to be fully resolved before attempting to assume a role. This is because the initial role must have the sts:AssumeRole permission to assume a role. This also allows any authentication scenario to support assuming a role. This matches the auth logic previously supported in the original AWS plugin.
Allow nullable assume role ARN as it will not always be specified.
@danotorrey

Copy link
Copy Markdown
Contributor

@kyleknighted Initial testing looks good so far. Noticed one possible issue:

Looks like the Assume Role ARN is not being passed in the Streams request (specified in input field, but is not included in the post request JSON payload):

image

@lingpri lingpri closed this Dec 11, 2019
@lingpri lingpri reopened this Dec 11, 2019
@lingpri

lingpri commented Dec 11, 2019

Copy link
Copy Markdown
Contributor

@danotorrey @kyleknighted @ceruleancee Great work ! If you need any help with any specific task Please keep me posted. I had a chance to look at creating the kinesis input with Claudia's help and we are able to see the log messages. Also, we weren't sure how to test the VPC endpoints(Dynamo DB API Endpoint override ). Is there a Swagger documentation for these end points, that we can access. Thanks.

@danotorrey

Copy link
Copy Markdown
Contributor

@lingpri @ceruleancee I investigated and found that there are valid use cases to allow an override endpoint for the IamClient AWS API URL. I feel that we should provide endpoint overrides for all AWS SDK services that we communicate to (just as the PR is currently coded to do).

Please also note that for the security concern of allowing IAM overrides, we are also adding URL white list capability, which allows the user to control which URLs are allowed to be used within Graylog. I will add support for this in a later PR.

@danotorrey

Copy link
Copy Markdown
Contributor

@ceruleancee @lingpri This PR is ready to be merged unless you have any other concerns.

@danotorrey danotorrey requested a review from lingpri December 16, 2019 10:38
Comment thread src/main/java/org/graylog/integrations/aws/inputs/AWSInput.java
Comment thread src/web/aws/authentication/AWSCustomEndpoints.jsx

@lingpri lingpri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great Work . Thank you very much for your patience. I enjoyed reviewing the PR .

import com.google.auto.value.AutoValue;
import org.graylog.autovalue.WithBeanGetter;

import javax.annotation.Nullable;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete unneeded imports
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Nullable;

Comment thread src/main/java/org/graylog/integrations/aws/inputs/AWSInput.java
@cobaltclaudia cobaltclaudia merged commit c3301d8 into master Dec 17, 2019
@cobaltclaudia cobaltclaudia deleted the aws_multi_auth branch December 17, 2019 15:52
dennisoelkers pushed a commit to Graylog2/graylog2-server that referenced this pull request Aug 29, 2023
* Moving CloudWatch and StepAuthorize

* Removing unnecessary AuthProvider

* cleaner dir paths

* cleanup

* Render different auth options

* ARN field

* Swapping fields

* Adding Automatic content

* cleanup

* Remember auth type

* Add auth provider using latest SDK version

* Add cross account role tester

* Resolve the initial policy before attempting to assume a role

The initial policy needs to be fully resolved before attempting to assume a role. This is because the initial role must have the sts:AssumeRole permission to assume a role. This also allows any authentication scenario to support assuming a role. This matches the auth logic previously supported in the original AWS plugin.

* Use AWSAuthProvider with assume role support for all AWS requests

* Flip incorrect logic for when credentials and auto auth are used

* Fix failing unit tests

Allow nullable assume role ARN as it will not always be specified.

* Updating Auth experience

* validation and review:

* Passing arn with intial streams request

* Fix invalid role name

* Every auth has arn

* update note

* Fix incorrect role ARN

* Updating button implementation

* Review value of undefined

* Cleanup auth provider formatting

* Remove cross account role test

* More auth provider formatting adjustments

* Add request support for AWS SDK client endpoint overrides

* Specify endpoints at runtime

* Add endpoint config fields

* Migrate to centralized AWS client initializer

Centralized initializer appropriately specifies general properties such as region, auth provider, and override endpoint (if specified).

* Migrate to centralized AWS client initializer (part 2)

Centralized initializer appropriately specifies general properties such as region, auth provider, and override endpoint (if specified).

* Specify SDK override endpoint for each Graylog AWS API endpoint

* Consolidate passed AWSRequest arguments

Passing individual arguments is verbose and can lead to transposition errors.

* Centralize logic for initializing and building AWS SDK clients

* Cleanup

* Undo unintended Palo Alto formatting changes

* Undo unintended Palo Alto formatting changes

* Key and secret are not required

* Validate override endpoint URIs to avoid silent failure

* Update to latest AWS SDK and Kinesis client

* Adding VPC Endpoint UI

* remove icon size sm

* fixed review value of undefined

* Validate endpoint URLs

* Shared section title styles

* Formatting cleanup

* Rework API value classes to inherit common properties

This removes the many key, secret, arn, and endpoints fields from all request classes.

* Migrate the generic AWSRequestImpl to use common fields VIA interface

* Add back integrations.protobuf.version variable

* Improve roleSessionName logic

Do not include "NONE" when access key is not present.

* Comment cleanup

* Add back test credentials

* Cleanup, finish implementing ignored `testCreateNewKinesisStream` test

* Fix failing test

* Add exception object to error message

* Save endpoints at end of wizard setup

* Do not save a title, which is deleted anyway when saving the input

* Update placeholder for endpoints

* Adjust text

* Adjust endpoint placeholder

* Fix failing test

* Add URL validation unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support all AWS SDK authorization methods

5 participants