Comments (9)
Hey @ad-m-ss,
Thanks for your contribution. role-session-name
is actually required and can not be an empty string. I'll go ahead and add some validation for it.
In terms the article you sent, it suggests using the config
file to create new profiles instead of credentials
. While this is great, the assume-role-with-web-identity
eliminates static credentials entirely and uses the CIRCLE_OIDC_TOKEN
to create a profile with temporary keys. There is no default profile out of the box so you can't assume a role from a source-profile
.
The good news is we have a command called role-arn-setup
that does just that. You're able to pass in a role-arn
and and source-profile
that lets you create a new profile in the config
file. This assumes that you run the setup
command first to configure a default profile with your static credentials.
I hope that makes sense. Let me know what you think!
Best,
Brian
from aws-cli-orb.
Thanks for your contribution.
role-session-name
is actually required and can not be an empty string. I'll go ahead and add some validation for it.
By default it have value ${CIRCLE_JOB}
, so it does have value in my cases. The issue is that my value have probably spaces, so it fails on validation. Notice at the end of output:
Unknown options: on, dev-adam, chart
I believe this is due to the presence of spaces somewhere in the middle of the default parameters.
uses the CIRCLE_OIDC_TOKEN to create a profile with temporary keys.
I think this is risky, because it might fails when temporary keys expires or become invalided for some other reason. Article describes that application which consume temporary keys should be able to rotate it:
code that uses temporary credentials should be able to refresh those credentials.
Code which exports temporary keys does not follow this rule. I am aware that documentation of AWS STS does not explain that well ( awsdocs/iam-user-guide#249 ).
You might use AWS.TokenFileWebIdentityCredentials
to enable application to use temporary keys and enable to refresh those credentials by application. This is the mechanism used in AWS EKS for IRSA, so it is a stable and well-established solution ( https://aws.amazon.com/blogs/opensource/introducing-fine-grained-iam-roles-service-accounts/ ) supported in all modern AWS SDK. It requires something like:
TOKEN_FILE=$(mktemp)
echo "CIRCLE_OIDC_TOKEN" > "$TOKEN_FILE"
{
echo "export AWS_WEB_IDENTITY_TOKEN_FILE=\"${TOKEN_FILE}\""
echo "export AWS_ROLE_ARN=\"${PARAM_AWS_CLI_ROLE_ARN}\""
} >>"$BASH_ENV"
Alternatively you might use AWS.ProcessCredentials
to create profile which is able to retrieve fresh temporary keys.
from aws-cli-orb.
Hi,
I'm running into the same issue, my Job Name contains spaces and then it is not passed to AWS CLI properly. I believe that a fix would be to pass env variables using double quotes to prevent globbing and word splitting. Should I send a PR with that?
from aws-cli-orb.
Hey @pavelkucera,
Can you show me an example config of what you mean so I can check it out? Did you mean I needed to double quote "${CIRCLE_JOB}"
for the parameter's default value?
Best,
Brian
from aws-cli-orb.
Hi @brivu, the gist of the config:
jobs:
aws-job:
steps:
- aws-cli/setup:
role-arn: ...
workflows:
deploy:
jobs:
- aws-job:
name: Name with spaces
As for the double quoting, I think it needs to happen in shell, specifically in assume-role-with-web-identity.sh:12 I would add double quotes around ${PARAM_ROLE_SESSION_NAME}
Would that make sense?
from aws-cli-orb.
Yes, thank you!
from aws-cli-orb.
I ran into the same issue and want to point out another important issue connected to this: The script didn't fail for me so my deployment continued to run and I received confusing aws authentication errors further down the build pipeline.
Can you please add validation that the env vars where correctly set and fail your script (orb) if not? I believe working with correct exit codes is a common best practice for shell (and CI) jobs.
from aws-cli-orb.
Hey @jtheuer,
Can you share the snippet of your config that's failing along with the output you're getting? I want to test this on my end to isolate the issue.
You can also submit a PR
with a fix and I'd be glad to take a look and merge it.
Thanks for letting us know!
Brian
from aws-cli-orb.
Hi Brian, thanks for reaching out and taking care for this. I currently have no capacity to provide a full PR to vendors. However, setting a job name with a space should be sufficient to reproduce both issues.
Let me know when you have a fix deployed, I'm eager to try the new version.
from aws-cli-orb.
Related Issues (20)
- Provide a way for `assume_role_with_web_identity` to not set `AWS_*` environment variables in `BASH_ENV` HOT 4
- `install` on older windows images fails when `override_installed: true` HOT 6
- 'role_arn' IS a required argument when calling 'aws-cli/setup' HOT 2
- circleci/[email protected] fails on aws-cli/setup - Error relocating /usr/bin/curl (alpine)
- Generate shortlived AWS Keys using CircleCI OIDC token fails
- Grep statement in install.sh (Windows) can cause wrong path to be added HOT 1
- 'disable_aws_pager' argument ignored if AWS CLI is already installed
- Enhance Installation Flow for Existing CLI Versions
- multiple calls to setup don't use newest role
- Broken AWS Credentials after #164 (4.1.2) HOT 8
- The documentation on aws sts assume-role is incorrect / not working in real world scenarios HOT 2
- Incorrect Version Check in Installation Script (install.sh) when using 'latest'
- Extra hyphen at the end of role_session_name
- upgrade glibc from 2.34-r0 to 2.35-r1 to resolve nsswitch cannot be overwrriten issue
- /tmp/default.keys: No such file or directory HOT 3
- OICD AWS Provider - Old AWS orb version not consistent with > 4.0 version causing issues with AWS Credentials configuration
- `setup` command fails with OIDC role while `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are set in the environment HOT 1
- Unable to use a dynamic `role_arn` with `assume_role_with_web_identity` command HOT 1
- Permission Denied for $BASH_ENV in v4.1.3
- setup not creating fully up to date credentials file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-cli-orb.