forked from mongodb/mongo-java-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-gssapi-auth-test.sh
executable file
·40 lines (33 loc) · 2.11 KB
/
run-gssapi-auth-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# Don't trace since the URI contains a password that shouldn't show up in the logs
set -o errexit # Exit the script with error if any of the commands fail
# Supported/used environment variables:
# MONGODB_URI Set the URI, including username/password to use to connect to the server via PLAIN authentication mechanism
# JDK Set the version of java to be used. Java versions can be set from the java toolchain /opt/java
# "jdk5", "jdk6", "jdk7", "jdk8", "jdk9", "jdk11"
# KDC The KDC
# REALM The realm
# KEYTAB_BASE64 The BASE64-encoded keytab
# PROJECT_DIRECTORY The project directory
# LOGIN_CONTEXT_NAME The login context name to use to look up the GSSAPI Subject
############################################
# Main Program #
############################################
RELATIVE_DIR_PATH="$(dirname "${BASH_SOURCE:-$0}")"
. "${RELATIVE_DIR_PATH}/javaConfig.bash"
echo "Running GSSAPI authentication tests with login context name '${LOGIN_CONTEXT_NAME}'"
echo ${KEYTAB_BASE64} | base64 -d > ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab
trap "rm ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab; exit" EXIT HUP
cat << EOF > .evergreen/java.login.drivers.config
${LOGIN_CONTEXT_NAME} {
com.sun.security.auth.module.Krb5LoginModule required
doNotPrompt=true useKeyTab=true keyTab="${PROJECT_DIRECTORY}/.evergreen/drivers.keytab" principal=drivers;
};
EOF
echo "Running tests with Java ${JAVA_VERSION}"
./gradlew -version
./gradlew -PjavaVersion=${JAVA_VERSION} --stacktrace --info \
-Dorg.mongodb.test.uri=${MONGODB_URI} -Dorg.mongodb.test.gssapi.login.context.name=${LOGIN_CONTEXT_NAME} \
-Pgssapi.enabled=true -Psun.security.krb5.debug=true -Pauth.login.config=file://${PROJECT_DIRECTORY}/.evergreen/java.login.drivers.config \
-Pkrb5.kdc=${KDC} -Pkrb5.realm=${REALM} -Psun.security.krb5.debug=true \
driver-core:test --tests GSSAPIAuthenticationSpecification --tests GSSAPIAuthenticatorSpecification --tests KerberosSubjectProviderTest