Skip to content

Commit a6882ec

Browse files
test(NODE-5443): x509 auth (#4080)
1 parent 8fca1aa commit a6882ec

File tree

7 files changed

+218
-599
lines changed

7 files changed

+218
-599
lines changed

.evergreen/config.in.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,18 @@ functions:
11111111
binary: bash
11121112
args:
11131113
- ${PROJECT_DIRECTORY}/.evergreen/run-benchmarks.sh
1114+
"run x509 auth tests":
1115+
- command: subprocess.exec
1116+
type: test
1117+
params:
1118+
working_dir: "src"
1119+
env:
1120+
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
1121+
MONGODB_URI: ${MONGODB_URI}
1122+
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
1123+
binary: bash
1124+
args:
1125+
- ${PROJECT_DIRECTORY}/.evergreen/run-x509-tests.sh
11141126

11151127
tasks:
11161128
- name: 'test-atlas-data-lake'

.evergreen/config.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,18 @@ functions:
10711071
binary: bash
10721072
args:
10731073
- ${PROJECT_DIRECTORY}/.evergreen/run-benchmarks.sh
1074+
run x509 auth tests:
1075+
- command: subprocess.exec
1076+
type: test
1077+
params:
1078+
working_dir: src
1079+
env:
1080+
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
1081+
MONGODB_URI: ${MONGODB_URI}
1082+
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
1083+
binary: bash
1084+
args:
1085+
- ${PROJECT_DIRECTORY}/.evergreen/run-x509-tests.sh
10741086
tasks:
10751087
- name: test-atlas-data-lake
10761088
tags:
@@ -1731,6 +1743,23 @@ tasks:
17311743
- func: bootstrap mongo-orchestration
17321744
- func: bootstrap kms servers
17331745
- func: run tests
1746+
- name: test-x509-authentication
1747+
tags:
1748+
- latest
1749+
- auth
1750+
- x509
1751+
commands:
1752+
- command: expansions.update
1753+
type: setup
1754+
params:
1755+
updates:
1756+
- {key: VERSION, value: latest}
1757+
- {key: TOPOLOGY, value: sharded_cluster}
1758+
- {key: AUTH, value: noauth}
1759+
- {key: SSL, value: ssl}
1760+
- func: install dependencies
1761+
- func: bootstrap mongo-orchestration
1762+
- func: run x509 auth tests
17341763
- name: test-atlas-connectivity
17351764
tags:
17361765
- atlas-connect
@@ -3975,6 +4004,7 @@ buildvariants:
39754004
- test-3.6-replica_set
39764005
- test-3.6-sharded_cluster
39774006
- test-latest-server-v1-api
4007+
- test-x509-authentication
39784008
- test-atlas-connectivity
39794009
- test-5.0-load-balanced
39804010
- test-6.0-load-balanced
@@ -4028,6 +4058,7 @@ buildvariants:
40284058
- test-3.6-replica_set
40294059
- test-3.6-sharded_cluster
40304060
- test-latest-server-v1-api
4061+
- test-x509-authentication
40314062
- test-atlas-connectivity
40324063
- test-5.0-load-balanced
40334064
- test-6.0-load-balanced
@@ -4081,6 +4112,7 @@ buildvariants:
40814112
- test-3.6-replica_set
40824113
- test-3.6-sharded_cluster
40834114
- test-latest-server-v1-api
4115+
- test-x509-authentication
40844116
- test-atlas-connectivity
40854117
- test-5.0-load-balanced
40864118
- test-6.0-load-balanced
@@ -4133,6 +4165,7 @@ buildvariants:
41334165
- test-3.6-replica_set
41344166
- test-3.6-sharded_cluster
41354167
- test-latest-server-v1-api
4168+
- test-x509-authentication
41364169
- test-atlas-connectivity
41374170
- test-5.0-load-balanced
41384171
- test-6.0-load-balanced

.evergreen/generate_evergreen_tasks.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,22 @@ BASE_TASKS.push({
114114
]
115115
});
116116

117+
BASE_TASKS.push({
118+
name: `test-x509-authentication`,
119+
tags: ['latest', 'auth', 'x509'],
120+
commands: [
121+
updateExpansions({
122+
VERSION: 'latest',
123+
TOPOLOGY: 'sharded_cluster',
124+
AUTH: 'noauth',
125+
SSL: 'ssl'
126+
}),
127+
{ func: 'install dependencies' },
128+
{ func: 'bootstrap mongo-orchestration' },
129+
{ func: 'run x509 auth tests' }
130+
]
131+
})
132+
117133
// manually added tasks
118134
TASKS.push(
119135
...[

.evergreen/run-x509-tests.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
source "${PROJECT_DIRECTORY}/.evergreen/init-node-and-npm-env.sh"
4+
5+
set -o errexit
6+
7+
export SSL_KEY_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/client.pem
8+
export SSL_CA_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem
9+
export SSL_KEY_FILE_EXPIRED=$DRIVERS_TOOLS/.evergreen/x509gen/expired.pem
10+
export SSL_KEY_NO_USER=$DRIVERS_TOOLS/.evergreen/x509gen/crl.pem
11+
12+
SUBJECT=$(openssl x509 -subject -nameopt RFC2253 -noout -inform PEM -in $SSL_KEY_FILE)
13+
14+
# Strip `subject=` prefix from the subject
15+
SUBJECT=${SUBJECT#"subject="}
16+
17+
# Remove any leading or trailing whitespace
18+
SUBJECT=$(echo "$SUBJECT" | awk '{$1=$1;print}')
19+
20+
export SUBJECT
21+
22+
npm run check:x509

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
"check:socks5": "mocha --config test/manual/mocharc.json test/manual/socks5.test.ts",
159159
"check:csfle": "mocha --config test/mocha_mongodb.json test/integration/client-side-encryption",
160160
"check:snappy": "mocha test/unit/assorted/snappy.test.js",
161+
"check:x509": "mocha test/manual/x509_auth.test.ts",
161162
"fix:eslint": "npm run check:eslint -- --fix",
162163
"prepare": "node etc/prepare.js",
163164
"preview:docs": "ts-node etc/docs/preview.ts",

0 commit comments

Comments
 (0)