-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Implement OIDC SASL mechanism #1134
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ca5bae1
Implement OIDC SASL mechanism in sync (#1107)
katcharov 5a2f145
Implement OIDC auth for async (#1131)
katcharov c1830b7
Remove non-machine workflow (#1259)
katcharov 8b80055
Add Human OIDC Workflow (#1316)
katcharov 106ee4d
OIDC Add remaining environments (azure, gcp), evergreen testing, API …
katcharov 8392006
Doc fix
katcharov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
set -o xtrace | ||
set -o errexit # Exit the script with error if any of the commands fail | ||
|
||
############################################ | ||
# Main Program # | ||
############################################ | ||
|
||
# Supported/used environment variables: | ||
# DRIVERS_TOOLS The path to evergreeen tools | ||
# OIDC_AWS_* Required OIDC_AWS_* env variables must be configured | ||
# | ||
# Environment variables used as output: | ||
# OIDC_TESTS_ENABLED Allows running OIDC tests | ||
# OIDC_TOKEN_DIR The path to generated OIDC AWS tokens | ||
# AWS_WEB_IDENTITY_TOKEN_FILE The path to AWS token for device workflow | ||
|
||
if [ -z ${DRIVERS_TOOLS+x} ]; then | ||
echo "DRIVERS_TOOLS. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_ROLE_ARN+x} ]; then | ||
echo "OIDC_AWS_ROLE_ARN. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_SECRET_ACCESS_KEY+x} ]; then | ||
echo "OIDC_AWS_SECRET_ACCESS_KEY. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_ACCESS_KEY_ID+x} ]; then | ||
echo "OIDC_AWS_ACCESS_KEY_ID. is not set"; | ||
exit 1 | ||
fi | ||
|
||
export AWS_ROLE_ARN=${OIDC_AWS_ROLE_ARN} | ||
export AWS_SECRET_ACCESS_KEY=${OIDC_AWS_SECRET_ACCESS_KEY} | ||
export AWS_ACCESS_KEY_ID=${OIDC_AWS_ACCESS_KEY_ID} | ||
export OIDC_FOLDER=${DRIVERS_TOOLS}/.evergreen/auth_oidc | ||
export OIDC_TOKEN_DIR=${OIDC_FOLDER}/test_tokens | ||
export AWS_WEB_IDENTITY_TOKEN_FILE=${OIDC_TOKEN_DIR}/test1 | ||
export OIDC_TESTS_ENABLED=true | ||
|
||
echo "Configuring OIDC server for local authentication tests" | ||
|
||
cd ${OIDC_FOLDER} | ||
DRIVERS_TOOLS=${DRIVERS_TOOLS} ./oidc_get_tokens.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
set -o xtrace | ||
set -o errexit # Exit the script with error if any of the commands fail | ||
|
||
############################################ | ||
# Main Program # | ||
############################################ | ||
|
||
# Supported/used environment variables: | ||
# DRIVERS_TOOLS The path to evergreeen tools | ||
# OIDC_AWS_* OIDC_AWS_* env variables must be configured | ||
# | ||
# Environment variables used as output: | ||
# OIDC_TESTS_ENABLED Allows running OIDC tests | ||
# OIDC_TOKEN_DIR The path to generated tokens | ||
# AWS_WEB_IDENTITY_TOKEN_FILE The path to AWS token for device workflow | ||
|
||
if [ -z ${DRIVERS_TOOLS+x} ]; then | ||
echo "DRIVERS_TOOLS. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_ROLE_ARN+x} ]; then | ||
echo "OIDC_AWS_ROLE_ARN. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_SECRET_ACCESS_KEY+x} ]; then | ||
echo "OIDC_AWS_SECRET_ACCESS_KEY. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_ACCESS_KEY_ID+x} ]; then | ||
echo "OIDC_AWS_ACCESS_KEY_ID. is not set"; | ||
exit 1 | ||
fi | ||
|
||
export AWS_ROLE_ARN=${OIDC_AWS_ROLE_ARN} | ||
export AWS_SECRET_ACCESS_KEY=${OIDC_AWS_SECRET_ACCESS_KEY} | ||
export AWS_ACCESS_KEY_ID=${OIDC_AWS_ACCESS_KEY_ID} | ||
export OIDC_FOLDER=${DRIVERS_TOOLS}/.evergreen/auth_oidc | ||
export OIDC_TOKEN_DIR=${OIDC_FOLDER}/test_tokens | ||
export AWS_WEB_IDENTITY_TOKEN_FILE=${OIDC_TOKEN_DIR}/test1 | ||
export OIDC_TESTS_ENABLED=true | ||
|
||
echo "Configuring OIDC server for local authentication tests" | ||
|
||
cd ${OIDC_FOLDER} | ||
DRIVERS_TOOLS=${DRIVERS_TOOLS} ./start_local_server.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
set +x # Disable debug trace | ||
set -eu | ||
|
||
echo "Running MONGODB-OIDC authentication tests" | ||
echo "OIDC_ENV $OIDC_ENV" | ||
|
||
if [ $OIDC_ENV == "test" ]; then | ||
if [ -z "$DRIVERS_TOOLS" ]; then | ||
echo "Must specify DRIVERS_TOOLS" | ||
exit 1 | ||
fi | ||
source ${DRIVERS_TOOLS}/.evergreen/auth_oidc/secrets-export.sh | ||
# java will not need to be installed, but we need to config | ||
RELATIVE_DIR_PATH="$(dirname "${BASH_SOURCE:-$0}")" | ||
source "${RELATIVE_DIR_PATH}/javaConfig.bash" | ||
elif [ $OIDC_ENV == "azure" ]; then | ||
source ./env.sh | ||
elif [ $OIDC_ENV == "gcp" ]; then | ||
source ./secrets-export.sh | ||
else | ||
echo "Unrecognized OIDC_ENV $OIDC_ENV" | ||
exit 1 | ||
fi | ||
|
||
|
||
if ! which java ; then | ||
echo "Installing java..." | ||
sudo apt install openjdk-17-jdk -y | ||
echo "Installed java." | ||
fi | ||
|
||
which java | ||
export OIDC_TESTS_ENABLED=true | ||
|
||
./gradlew -Dorg.mongodb.test.uri="$MONGODB_URI" \ | ||
--stacktrace --debug --info --no-build-cache driver-core:cleanTest \ | ||
driver-sync:test --tests OidcAuthenticationProseTests --tests UnifiedAuthTest \ | ||
driver-reactive-streams:test --tests OidcAuthenticationAsyncProseTests \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.