Skip to content

Commit

Permalink
RUST-906 Add native support for AWS IAM Roles for service accounts, E…
Browse files Browse the repository at this point in the history
…KS in particular (#885)
  • Loading branch information
isabelatkinson authored Jun 7, 2023
1 parent 220a3f7 commit b6344d2
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 138 deletions.
53 changes: 52 additions & 1 deletion .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ functions:
"iam_auth_assume_role_name" : "${iam_auth_assume_role_name}",
"iam_auth_ec2_instance_account" : "${iam_auth_ec2_instance_account}",
"iam_auth_ec2_instance_secret_access_key" : "${iam_auth_ec2_instance_secret_access_key}",
"iam_auth_ec2_instance_profile" : "${iam_auth_ec2_instance_profile}"
"iam_auth_ec2_instance_profile" : "${iam_auth_ec2_instance_profile}",
"iam_auth_assume_web_role_name": "${iam_auth_assume_web_role_name}",
"iam_web_identity_issuer": "${iam_web_identity_issuer}",
"iam_web_identity_jwks_uri": "${iam_web_identity_jwks_uri}",
"iam_web_identity_token_file": "${iam_web_identity_token_file}",
"iam_web_identity_rsa_key": "${iam_web_identity_rsa_key}"
}
EOF
Expand Down Expand Up @@ -297,6 +302,46 @@ functions:
cat setup.js
mongo --nodb setup.js aws_e2e_ecs.js
"run aws assume role with web identity test":
- command: shell.exec
type: test
params:
shell: bash
working_dir: "src"
script: |
${PREPARE_SHELL}
cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
. ./activate-authawsvenv.sh
mongo aws_e2e_web_identity.js
- command: shell.exec
type: test
params:
working_dir: "src"
silent: true
script: |
# DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
export AWS_ROLE_ARN="${iam_auth_assume_web_role_name}"
export AWS_WEB_IDENTITY_TOKEN_FILE="${iam_web_identity_token_file}"
EOF
- command: shell.exec
type: test
params:
shell: bash
working_dir: "src"
script: |
# the test should be run with and without a session name set
ASYNC_RUNTIME=${ASYNC_RUNTIME} \
PROJECT_DIRECTORY=${PROJECT_DIRECTORY} \
ASSERT_NO_URI_CREDS=true \
AWS_ROLE_SESSION_NAME="test" \
.evergreen/run-aws-tests.sh
ASYNC_RUNTIME=${ASYNC_RUNTIME} \
PROJECT_DIRECTORY=${PROJECT_DIRECTORY} \
ASSERT_NO_URI_CREDS=true \
.evergreen/run-aws-tests.sh
"run x509 tests":
- command: shell.exec
type: test
Expand Down Expand Up @@ -1023,6 +1068,7 @@ tasks:
- func: "run aws auth test with aws credentials and session token as environment variables"
- func: "run aws auth test with aws EC2 credentials"
- func: "run aws ECS auth test"
- func: "run aws assume role with web identity test"

- name: "test-5.0-standalone"
tags: ["5.0", "standalone"]
Expand Down Expand Up @@ -1083,6 +1129,7 @@ tasks:
- func: "run aws auth test with aws credentials and session token as environment variables"
- func: "run aws auth test with aws EC2 credentials"
- func: "run aws ECS auth test"
- func: "run aws assume role with web identity test"

- name: "test-6.0-standalone"
tags: ["6.0", "standalone"]
Expand Down Expand Up @@ -1143,6 +1190,7 @@ tasks:
- func: "run aws auth test with aws credentials and session token as environment variables"
- func: "run aws auth test with aws EC2 credentials"
- func: "run aws ECS auth test"
- func: "run aws assume role with web identity test"

- name: "test-7.0-standalone"
tags: ["7.0", "standalone"]
Expand Down Expand Up @@ -1203,6 +1251,7 @@ tasks:
- func: "run aws auth test with aws credentials and session token as environment variables"
- func: "run aws auth test with aws EC2 credentials"
- func: "run aws ECS auth test"
- func: "run aws assume role with web identity test"

- name: "test-rapid-standalone"
tags: ["rapid", "standalone"]
Expand Down Expand Up @@ -1263,6 +1312,7 @@ tasks:
- func: "run aws auth test with aws credentials and session token as environment variables"
- func: "run aws auth test with aws EC2 credentials"
- func: "run aws ECS auth test"
- func: "run aws assume role with web identity test"

- name: "test-latest-standalone"
tags: ["latest", "standalone"]
Expand Down Expand Up @@ -1324,6 +1374,7 @@ tasks:
- func: "run aws auth test with aws credentials and session token as environment variables"
- func: "run aws auth test with aws EC2 credentials"
- func: "run aws ECS auth test"
- func: "run aws assume role with web identity test"

- name: "test-connection-string"
commands:
Expand Down
Loading

0 comments on commit b6344d2

Please sign in to comment.