-
Notifications
You must be signed in to change notification settings - Fork 149
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
Logstash S3 input plugin assume role not working #213
Comments
It would appear from the source code that the assumed role may only work if logstash is running on an AWS ec2 and your using the identity assigned to the instance and also not populating the access key and secret options, only providing a assumed role and session name. The code requires changes to use a different identity for an assumed role and also would then work on a non AWS hosted server. |
Hi @cabberley , thanks for your comment. When you are working into the EC2 instance, you don't need to assume the role of the instance, this is automatically implemented into the AWS SDK. The common behaviour is to use assume-role when you are operating cross-account, where you use the actual credentials to call sts API and create temporary credentials into the second account. We can see it into the docs Creating an AWS STS Access Token Of course, could be a case where you are operating into the EC2 instance and needs to operate cross-account also. For me, if you pass the AWS |
Hi @christiangda I may not have explained very well. Your comments are correct. What I am trying to say is that the way the s3 plugin code has been written, if you you supply access_key_id, secret_access_key in the .conf file the code will never do the assumeRole with the role_arn you provide. It will only use role_arn and execute the Assumerole if the .conf file only has role_arn. The code which is the problem for us is actually part of logstash-mixin-aws not this plugin The logic in the code says Which means if you provide as you want all 3 values, it will never do the assume role. I made my own version of the plugin which changed the logic to cater for your scenario IF access_key_id and secret_access key is provided then use them to authenticate Mine also caters for using external_id which is also a parameter that AssumeRole sometimes requires depending on how the identity has been setup. addiing external_id does require a few other code changes to Logstash-mixin-aws for it to work. But Doesn't require changes to the plugins that rely on logstash-mixin-aws. I use the s3 input plugin and the cloudwatch plugin which rely on this code. |
I am also facing the same issue. Can you please let me know how to solve this problem. |
If you don’t need to use an external Id with your assume role arn, you can install the aws cli on the server use the aws credentials to setup the aws default profile for the primary account. In your logstash config do not put an access key and secret key leave them out, just put the role arn in the config and a sessionname. The plugin will then use the default profile that you setup with cli to present to aws to get the assumed role in return. |
Thanks alot brother.... It worked!!! |
@cabberley, can you help me with this error. Just wanted to know when does this occur. Is it because of configuration issue or permissions at s3 bucket. And, I was able to list the objects through awscli. |
We are still facing this issue? Any updates on this ? |
One of the ways I tried fixing this issue was to export Access Keys as environment variables and then start logstash |
Hi,
I'm trying to use the assume role functionality with logstash S3 input plugin but I get the following error:
NOTE: Looks like the plugin is not assuming the role, I can't see any trace about
assume a role
I have
two AWS account
, the first one only contains AWS IAM credentials and users, the second one has the S3 buckets.Account A
Here I have an IAM programmatic user which inside a Group with a policy
to assume a role to account b
Policy:
Account b
Here I have one bucket with data logs and
a role to be assumed with access to this bucket
Role:
As I mentioned before, looks like the plugins in not assuming the role.
NOTE: If I create credentials directly into the
account b
, the pluging work fine, what I mean, this works when do not need to assume a role, with a conf like:Please let me know if I'm doing something wrong with this plugin, or if I have left some configuration off.
Environment information
# inside the container bash-4.2$ cat /etc/redhat-release CentOS Linux release 7.8.2003 (Core)
NA
podman run -d \ --name=logstash-01 \ --net=odfe \ --hostname=logstash-01 \ --privileged \ --ulimit=host \ --security-opt label=disable \ --volume {{ logstash_host_volume_conf_path }}:/usr/share/logstash/config:ro \ --volume {{ logstash_host_volume_pipeline_path }}:/usr/share/logstash/pipeline:ro \ --volume {{ logstash_host_volume_data_path }}:/usr/share/logstash/data:rw \ --volume {{ logstash_host_volume_logs_path }}:/usr/share/logstash/logs:rw \ --cpus 1 \ --memory 1g \ --memory-reservation 512m \ --memory-swap 1g \ docker.elastic.co/logstash/logstash-oss:7.8.0 bash -c "bin/logstash-plugin install logstash-input-s3 && bin/logstash"
The text was updated successfully, but these errors were encountered: