Skip to content

test(NODE-5443): add x509 auth tests #4080

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 4 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .evergreen/config.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,18 @@ functions:
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-benchmarks.sh
"run x509 auth tests":
- command: subprocess.exec
type: test
params:
working_dir: "src"
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
MONGODB_URI: ${MONGODB_URI}
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-x509-tests.sh

tasks:
- name: 'test-atlas-data-lake'
Expand Down
33 changes: 33 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,18 @@ functions:
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-benchmarks.sh
run x509 auth tests:
- command: subprocess.exec
type: test
params:
working_dir: src
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
MONGODB_URI: ${MONGODB_URI}
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-x509-tests.sh
tasks:
- name: test-atlas-data-lake
tags:
Expand Down Expand Up @@ -1741,6 +1753,23 @@ tasks:
- func: bootstrap mongo-orchestration
- func: bootstrap kms servers
- func: run tests
- name: test-x509-authentication
tags:
- latest
- auth
- x509
commands:
- command: expansions.update
type: setup
params:
updates:
- {key: VERSION, value: latest}
- {key: TOPOLOGY, value: sharded_cluster}
- {key: AUTH, value: noauth}
- {key: SSL, value: ssl}
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: run x509 auth tests
- name: test-atlas-connectivity
tags:
- atlas-connect
Expand Down Expand Up @@ -3990,6 +4019,7 @@ buildvariants:
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-x509-authentication
- test-atlas-connectivity
- test-5.0-load-balanced
- test-6.0-load-balanced
Expand Down Expand Up @@ -4043,6 +4073,7 @@ buildvariants:
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-x509-authentication
- test-atlas-connectivity
- test-5.0-load-balanced
- test-6.0-load-balanced
Expand Down Expand Up @@ -4096,6 +4127,7 @@ buildvariants:
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-x509-authentication
- test-atlas-connectivity
- test-5.0-load-balanced
- test-6.0-load-balanced
Expand Down Expand Up @@ -4148,6 +4180,7 @@ buildvariants:
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-x509-authentication
- test-atlas-connectivity
- test-5.0-load-balanced
- test-6.0-load-balanced
Expand Down
16 changes: 16 additions & 0 deletions .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@ BASE_TASKS.push({
]
});

BASE_TASKS.push({
name: `test-x509-authentication`,
tags: ['latest', 'auth', 'x509'],
commands: [
updateExpansions({
VERSION: 'latest',
TOPOLOGY: 'sharded_cluster',
AUTH: 'noauth',
SSL: 'ssl'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run x509 auth tests' }
]
})

// manually added tasks
TASKS.push(
...[
Expand Down
22 changes: 22 additions & 0 deletions .evergreen/run-x509-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

source "${PROJECT_DIRECTORY}/.evergreen/init-node-and-npm-env.sh"

set -o errexit

export SSL_KEY_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/client.pem
export SSL_CA_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem
export SSL_KEY_FILE_EXPIRED=$DRIVERS_TOOLS/.evergreen/x509gen/expired.pem
export SSL_KEY_NO_USER=$DRIVERS_TOOLS/.evergreen/x509gen/crl.pem

SUBJECT=$(openssl x509 -subject -nameopt RFC2253 -noout -inform PEM -in $SSL_KEY_FILE)

# Strip `subject=` prefix from the subject
SUBJECT=${SUBJECT#"subject="}

# Remove any leading or trailing whitespace
SUBJECT=$(echo "$SUBJECT" | awk '{$1=$1;print}')

export SUBJECT

npm run check:x509
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
"check:socks5": "mocha --config test/manual/mocharc.json test/manual/socks5.test.ts",
"check:csfle": "mocha --config test/mocha_mongodb.json test/integration/client-side-encryption",
"check:snappy": "mocha test/unit/assorted/snappy.test.js",
"check:x509": "mocha test/manual/x509_auth.test.ts",
"fix:eslint": "npm run check:eslint -- --fix",
"prepare": "node etc/prepare.js",
"preview:docs": "ts-node etc/docs/preview.ts",
Expand Down
Loading