Skip to content

Commit e8a30b1

Browse files
feat(NODE-3445): add support for AssumeRoleWithWebIdentity in aws authentication (#3556)
1 parent 60f4232 commit e8a30b1

File tree

5 files changed

+688
-370
lines changed

5 files changed

+688
-370
lines changed

.evergreen/config.in.yml

+66-1
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,17 @@ functions:
381381
params:
382382
file: src/deps-expansion.yml
383383

384+
"install aws-credential-providers":
385+
- command: shell.exec
386+
type: setup
387+
params:
388+
shell: bash
389+
working_dir: "src"
390+
script: |
391+
${PREPARE_SHELL}
392+
source "${PROJECT_DIRECTORY}/.evergreen/init-nvm.sh"
393+
npm install @aws-sdk/credential-providers
394+
384395
"run atlas tests":
385396
- command: shell.exec
386397
type: test
@@ -520,7 +531,12 @@ functions:
520531
"iam_auth_assume_role_name" : "${iam_auth_assume_role_name}",
521532
"iam_auth_ec2_instance_account" : "${iam_auth_ec2_instance_account}",
522533
"iam_auth_ec2_instance_secret_access_key" : "${iam_auth_ec2_instance_secret_access_key}",
523-
"iam_auth_ec2_instance_profile" : "${iam_auth_ec2_instance_profile}"
534+
"iam_auth_ec2_instance_profile" : "${iam_auth_ec2_instance_profile}",
535+
"iam_auth_assume_web_role_name": "${iam_auth_assume_web_role_name}",
536+
"iam_web_identity_issuer": "${iam_web_identity_issuer}",
537+
"iam_web_identity_rsa_key": "${iam_web_identity_rsa_key}",
538+
"iam_web_identity_jwks_uri": "${iam_web_identity_jwks_uri}",
539+
"iam_web_identity_token_file": "${iam_web_identity_token_file}"
524540
}
525541
EOF
526542
@@ -672,6 +688,55 @@ functions:
672688
${PREPARE_SHELL}
673689
${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
674690
691+
"run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME set":
692+
- command: shell.exec
693+
type: test
694+
params:
695+
working_dir: "src"
696+
silent: true
697+
script: |
698+
cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
699+
. ./activate_venv.sh
700+
${MONGODB_BINARIES}/mongo --verbose aws_e2e_web_identity.js
701+
cd -
702+
cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
703+
export AWS_WEB_IDENTITY_TOKEN_FILE=${iam_web_identity_token_file}
704+
export AWS_ROLE_ARN=${iam_auth_assume_web_role_name}
705+
export AWS_ROLE_SESSION_NAME='test'
706+
export MONGODB_URI="mongodb://localhost:27017/aws?authMechanism=MONGODB-AWS"
707+
EOF
708+
- command: shell.exec
709+
type: test
710+
params:
711+
working_dir: "src"
712+
script: |
713+
${PREPARE_SHELL}
714+
${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
715+
716+
"run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME unset":
717+
- command: shell.exec
718+
type: test
719+
params:
720+
working_dir: "src"
721+
silent: true
722+
script: |
723+
cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
724+
. ./activate_venv.sh
725+
${MONGODB_BINARIES}/mongo --verbose aws_e2e_web_identity.js
726+
cd -
727+
cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
728+
export AWS_WEB_IDENTITY_TOKEN_FILE=${iam_web_identity_token_file}
729+
export AWS_ROLE_ARN=${iam_auth_assume_web_role_name}
730+
export MONGODB_URI="mongodb://localhost:27017/aws?authMechanism=MONGODB-AWS"
731+
EOF
732+
- command: shell.exec
733+
type: test
734+
params:
735+
working_dir: "src"
736+
script: |
737+
${PREPARE_SHELL}
738+
${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
739+
675740
"run aws ECS auth test":
676741
- command: shell.exec
677742
type: test

0 commit comments

Comments
 (0)