Skip to content

Commit 75ffa23

Browse files
socks5
1 parent df687b6 commit 75ffa23

File tree

5 files changed

+37
-106
lines changed

5 files changed

+37
-106
lines changed

.evergreen/config.yml

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,31 +1862,11 @@ tasks:
18621862
updates:
18631863
- {key: VERSION, value: latest}
18641864
- {key: TOPOLOGY, value: replica_set}
1865-
- {key: AUTH, value: noauth}
1866-
- func: install dependencies
1867-
- func: bootstrap mongo-orchestration
1868-
- func: bootstrap kms servers
1869-
- func: run socks5 tests
1870-
- name: test-socks5-csfle-proxy-auth
1871-
tags:
1872-
- socks5-csfle
1873-
commands:
1874-
- command: expansions.update
1875-
type: setup
1876-
params:
1877-
updates:
1878-
- {key: VERSION, value: latest}
1879-
- {key: TOPOLOGY, value: replica_set}
1880-
- {key: TEST_SOCKS5_CSFLE, value: 'true'}
1881-
- {key: AUTH, value: noauth}
1882-
- {key: PROXY_AUTH, value: 'true'}
1883-
- {key: CLIENT_ENCRYPTION, value: 'true'}
1884-
- {key: TEST_CSFLE, value: 'true'}
18851865
- func: install dependencies
18861866
- func: bootstrap mongo-orchestration
18871867
- func: bootstrap kms servers
18881868
- func: run socks5 tests
1889-
- name: test-socks5-csfle-no-proxy-auth
1869+
- name: test-socks5-csfle
18901870
tags:
18911871
- socks5-csfle
18921872
commands:
@@ -1897,9 +1877,6 @@ tasks:
18971877
- {key: VERSION, value: latest}
18981878
- {key: TOPOLOGY, value: replica_set}
18991879
- {key: TEST_SOCKS5_CSFLE, value: 'true'}
1900-
- {key: AUTH, value: noauth}
1901-
- {key: CLIENT_ENCRYPTION, value: 'true'}
1902-
- {key: TEST_CSFLE, value: 'true'}
19031880
- func: install dependencies
19041881
- func: bootstrap mongo-orchestration
19051882
- func: bootstrap kms servers
@@ -1914,7 +1891,6 @@ tasks:
19141891
- {key: SSL, value: ssl}
19151892
- {key: VERSION, value: latest}
19161893
- {key: TOPOLOGY, value: replica_set}
1917-
- {key: AUTH, value: noauth}
19181894
- func: install dependencies
19191895
- func: bootstrap mongo-orchestration
19201896
- func: run socks5 tests
@@ -4673,8 +4649,7 @@ buildvariants:
46734649
- test-auth-kerberos
46744650
- test-auth-ldap
46754651
- test-socks5
4676-
- test-socks5-csfle-proxy-auth
4677-
- test-socks5-csfle-no-proxy-auth
4652+
- test-socks5-csfle
46784653
- test-socks5-tls
46794654
- test-snappy-compression
46804655
- test-zstd-1.x-compression
@@ -4734,8 +4709,7 @@ buildvariants:
47344709
- test-auth-kerberos
47354710
- test-auth-ldap
47364711
- test-socks5
4737-
- test-socks5-csfle-proxy-auth
4738-
- test-socks5-csfle-no-proxy-auth
4712+
- test-socks5-csfle
47394713
- test-socks5-tls
47404714
- test-snappy-compression
47414715
- test-zstd-1.x-compression
@@ -4795,8 +4769,7 @@ buildvariants:
47954769
- test-auth-kerberos
47964770
- test-auth-ldap
47974771
- test-socks5
4798-
- test-socks5-csfle-proxy-auth
4799-
- test-socks5-csfle-no-proxy-auth
4772+
- test-socks5-csfle
48004773
- test-socks5-tls
48014774
- test-snappy-compression
48024775
- test-zstd-1.x-compression
@@ -4856,8 +4829,7 @@ buildvariants:
48564829
- test-auth-kerberos
48574830
- test-auth-ldap
48584831
- test-socks5
4859-
- test-socks5-csfle-proxy-auth
4860-
- test-socks5-csfle-no-proxy-auth
4832+
- test-socks5-csfle
48614833
- test-socks5-tls
48624834
- test-snappy-compression
48634835
- test-zstd-1.x-compression
@@ -4914,8 +4886,7 @@ buildvariants:
49144886
- test-latest-load-balanced
49154887
- test-auth-kerberos
49164888
- test-auth-ldap
4917-
- test-socks5-csfle-proxy-auth
4918-
- test-socks5-csfle-no-proxy-auth
4889+
- test-socks5-csfle
49194890
- test-socks5-tls
49204891
- test-snappy-compression
49214892
- test-zstd-1.x-compression

.evergreen/generate_evergreen_tasks.js

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ TASKS.push(
175175
commands: [
176176
updateExpansions({
177177
VERSION: 'latest',
178-
TOPOLOGY: 'replica_set',
179-
AUTH: 'noauth',
178+
TOPOLOGY: 'replica_set'
180179
}),
181180
{ func: 'install dependencies' },
182181
{ func: 'bootstrap mongo-orchestration' },
@@ -185,35 +184,13 @@ TASKS.push(
185184
]
186185
},
187186
{
188-
name: 'test-socks5-csfle-proxy-auth',
187+
name: 'test-socks5-csfle',
189188
tags: ['socks5-csfle'],
190189
commands: [
191190
updateExpansions({
192191
VERSION: 'latest',
193192
TOPOLOGY: 'replica_set',
194-
TEST_SOCKS5_CSFLE: 'true',
195-
AUTH: 'noauth',
196-
PROXY_AUTH: 'true',
197-
CLIENT_ENCRYPTION: 'true',
198-
TEST_CSFLE: 'true'
199-
}),
200-
{ func: 'install dependencies' },
201-
{ func: 'bootstrap mongo-orchestration' },
202-
{ func: 'bootstrap kms servers' },
203-
{ func: 'run socks5 tests' }
204-
]
205-
},
206-
{
207-
name: 'test-socks5-csfle-no-proxy-auth',
208-
tags: ['socks5-csfle'],
209-
commands: [
210-
updateExpansions({
211-
VERSION: 'latest',
212-
TOPOLOGY: 'replica_set',
213-
TEST_SOCKS5_CSFLE: 'true',
214-
AUTH: 'noauth',
215-
CLIENT_ENCRYPTION: 'true',
216-
TEST_CSFLE: 'true'
193+
TEST_SOCKS5_CSFLE: 'true'
217194
}),
218195
{ func: 'install dependencies' },
219196
{ func: 'bootstrap mongo-orchestration' },
@@ -228,15 +205,14 @@ TASKS.push(
228205
updateExpansions({
229206
SSL: 'ssl',
230207
VERSION: 'latest',
231-
TOPOLOGY: 'replica_set',
232-
AUTH: 'noauth'
208+
TOPOLOGY: 'replica_set'
233209
}),
234210
{ func: 'install dependencies' },
235211
{ func: 'bootstrap mongo-orchestration' },
236212
{ func: 'run socks5 tests' }
237213
]
238214
}
239-
]
215+
]
240216
);
241217

242218
TASKS.push({

.evergreen/run-socks5-tests.sh

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh
44

5-
set -o errexit # Exit the script with error if any of the commands fail
5+
set -o errexit # Exit the script with error if any of the commands fail
66
set -o xtrace # For debuggability, no external credentials are used here
77

88
function setup_fle() {
9-
set -o xtrace # Write all commands first to stderr
10-
set -o errexit # Exit the script with error if any of the commands fail
11-
9+
set -o xtrace # Write all commands first to stderr
10+
set -o errexit # Exit the script with error if any of the commands fail
11+
1212
source .evergreen/setup-fle.sh
1313

1414
export CSFLE_TLS_CA_FILE="${DRIVERS_TOOLS}/.evergreen/x509gen/ca.pem"
@@ -22,11 +22,9 @@ PYTHON_BINARY=$(bash -c ". $DRIVERS_TOOLS/.evergreen/find-python3.sh && ensure_p
2222

2323
# ssl setup
2424
SSL=${SSL:-nossl}
25-
PROXY_AUTH=${PROXY_AUTH:-false}
26-
2725
if [ "$SSL" != "nossl" ]; then
28-
export SSL_KEY_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/client.pem"
29-
export SSL_CA_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
26+
export SSL_KEY_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/client.pem"
27+
export SSL_CA_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
3028
fi
3129

3230
# Grab a connection string that only refers to *one* of the hosts in MONGODB_URI
@@ -41,33 +39,29 @@ if [ "Windows_NT" = "$OS" ]; then
4139
SOCKS5_SERVER_SCRIPT=$(cygpath -w "$SOCKS5_SERVER_SCRIPT")
4240
fi
4341

44-
if [ "$PROXY_AUTH" = "true" ]; then
45-
# Test with Socks5 + proxy authentication required
46-
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1080 --auth username:p4ssw0rd --map "127.0.0.1:12345 to $FIRST_HOST" &
47-
SOCKS5_PROXY_PID=$!
48-
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
49-
setup_fle
50-
# [ "$SSL" != "ssl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
51-
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyUsername=username&proxyPassword=p4ssw0rd' npm run check:csfle
52-
echo "Running"
53-
54-
else
55-
env SOCKS5_CONFIG='["127.0.0.1",1080,"username","p4ssw0rd"]' npm run check:socks5
56-
fi
57-
kill $SOCKS5_PROXY_PID
58-
59-
exit 0
42+
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
43+
setup_fle
6044
fi
6145

46+
# First, test with Socks5 + authentication required
47+
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1080 --auth username:p4ssw0rd --map "127.0.0.1:12345 to $FIRST_HOST" &
48+
SOCKS5_PROXY_PID=$!
49+
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
50+
[ "$SSL" != "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] &&
51+
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyUsername=username&proxyPassword=p4ssw0rd' \
52+
npm run check:csfle
53+
else
54+
env SOCKS5_CONFIG='["127.0.0.1",1080,"username","p4ssw0rd"]' npm run check:socks5
55+
fi
56+
kill $SOCKS5_PROXY_PID
6257

63-
# Test with Socks5 + no proxy authentication
58+
# Second, test with Socks5 + no authentication
6459
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1081 --map "127.0.0.1:12345 to $FIRST_HOST" &
6560
SOCKS5_PROXY_PID=$!
6661
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
67-
setup_fle
68-
[ "$SSL" != "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
62+
[ "$SSL" != "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] &&
6963
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyPort=1081' \
70-
npm run check:csfle
64+
npm run check:csfle
7165
else
7266
env SOCKS5_CONFIG='["127.0.0.1",1081]' npm run check:socks5
7367
fi

test/csfle-kms-providers.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,9 @@ function getCSFLEKMSProviders() {
2727
return JSON.parse(process.env.CSFLE_KMS_PROVIDERS2 ?? '{}');
2828
}
2929

30-
const keys = [
31-
'FLE_AWS_KEY',
32-
'FLE_AWS_SECRET',
33-
'FLE_AZURE_TENANTID',
34-
'FLE_AZURE_CLIENTID',
35-
'FLE_AZURE_CLIENTSECRET',
36-
'FLE_GCP_EMAIL',
37-
'FLE_GCP_PRIVATEKEY'
38-
];
39-
4030
module.exports = {
4131
getCSFLEKMSProviders,
42-
kmsCredentialsPresent: keys.every(
43-
key => typeof process.env[key] === 'string' && process.env[key].length > 0
44-
)
32+
kmsCredentialsPresent:
33+
typeof process.env.CSFLE_KMS_PROVIDERS2 === 'string' &&
34+
process.env.CSFLE_KMS_PROVIDERS2.length > 0
4535
};

test/tools/runner/filters/client_encryption_filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class ClientSideEncryptionFilter extends Filter {
7878
}
7979
}
8080

81-
if (!kmsCredentialsPresent) return 'Test requires FLE kms credentials.';
81+
if (!kmsCredentialsPresent) return 'Test requires FLE kms credentials';
8282
if (ClientSideEncryptionFilter.version == null)
8383
return 'Test requires mongodb-client-encryption to be installed.';
8484

0 commit comments

Comments
 (0)