Skip to content
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

AWS: Adding Webidentityprovider #676

Merged
merged 3 commits into from
Apr 9, 2023
Merged

Conversation

DagW
Copy link
Contributor

@DagW DagW commented Apr 1, 2023

When running monstache in EKS,
the recommended auth method is using IRSA (IAM Roles for service accounts).

Using this method of authentication will populate two ENV vars in your Pod,
AWS_ROLE_ARN - the role to assume
AWS_WEB_IDENTITY_TOKEN_FILE - the token to do it with

To enable that, we need to also enable the stscreds.WebIdentityRoleProvider

@rwynn rwynn merged commit bb8f94d into rwynn:rel6 Apr 9, 2023
rwynn pushed a commit that referenced this pull request Apr 10, 2023
* Support webidentityprovider auth

* Add STS as a provider in chain

* Add webidentity iota after chained to avoid breaking

---------

Co-authored-by: Dag Wullt <dag@wullt.net>
@tlierdotfr
Copy link

tlierdotfr commented May 27, 2023

Hi @rwynn, do you know by when this feature will be released (maybe in v6.7.12 ) ?
In my use case, I have deployed monstache on EKS and my AWS IAM Role is binded to the Pod ServiceAccount.
I would prefer this auth method rather than using a static AccessKey / SecretKey.

@DagW
Copy link
Contributor Author

DagW commented May 27, 2023 via email

@tlierdotfr
Copy link

tlierdotfr commented May 29, 2023

@DagW I have just tried and it's not working for me out of the box.
I've just adapted the toml config file for

# AWS Connection Strategy
[aws-connect]
region = "eu-west-3"
strategy = 5

Is there anything else to do for the ServiceAccount IAM role binding ot be used by monstache ?

@DagW
Copy link
Contributor Author

DagW commented May 29, 2023 via email

@DagW
Copy link
Contributor Author

DagW commented May 29, 2023 via email

@tlierdotfr
Copy link

I confirm that the 3 env variables are correctly populated on my pod.

Here is the error I have : Unable to create Elasticsearch client: health check timeout: no Elasticsearch node available.

@DagW
Copy link
Contributor Author

DagW commented May 29, 2023 via email

@DagW
Copy link
Contributor Author

DagW commented May 30, 2023 via email

@tlierdotfr
Copy link

tlierdotfr commented May 30, 2023

Thanks a lot for this advice @DagW !

The error in curl response was :

{
	"error": {
		"root_cause": [
			{
				"type": "security_exception",
				"reason": "no permissions for [cluster:monitor/main] and User [name=arn:aws:iam::000000000000:role/iam-role-monstache, backend_roles=[arn:aws:iam::000000000000:role/iam-role-monstache], requestedTenant=null]"
			}
		],
		"type": "security_exception",
		"reason": "no permissions for [cluster:monitor/main] and User [name=arn:aws:iam::000000000000:role/iam-role-monstache, backend_roles=[arn:aws:iam::000000000000:role/iam-role-monstache], requestedTenant=null]"
	},
	"status": 403
}

And the root cause was quite simple ....
I forgot to bind the IAM role to an OpenSerch role..

After making this configuration in the "Security / Roles" menu, everything is now working perfectly fine !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants