Skip to content

Commit 8e43dee

Browse files
committed
PYTHON-1957 Don't use unix sockets for mongocryptd client
1 parent aac8d63 commit 8e43dee

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

pymongo/encryption_options.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"""Options to configure client side encryption."""
1616

1717
import copy
18-
import socket
1918

2019
try:
2120
import pymongocrypt
@@ -32,7 +31,7 @@ class AutoEncryptionOpts(object):
3231
def __init__(self, kms_providers, key_vault_namespace,
3332
key_vault_client=None, schema_map=None,
3433
bypass_auto_encryption=False,
35-
mongocryptd_uri=None,
34+
mongocryptd_uri='mongodb://localhost:27020',
3635
mongocryptd_bypass_spawn=False,
3736
mongocryptd_spawn_path='mongocryptd',
3837
mongocryptd_spawn_args=None):
@@ -90,8 +89,7 @@ def __init__(self, kms_providers, key_vault_namespace,
9089
enabled. Defaults to ``False``.
9190
- `mongocryptd_uri` (optional): The MongoDB URI used to connect
9291
to the *local* mongocryptd process. Defaults to
93-
``"mongodb://%2Ftmp%2Fmongocryptd.sock"`` if domain sockets are
94-
available or ``"mongodb://localhost:27020"`` otherwise.
92+
``'mongodb://localhost:27020'``.
9593
- `mongocryptd_bypass_spawn` (optional): If ``True``, the encrypted
9694
MongoClient will not attempt to spawn the mongocryptd process.
9795
Defaults to ``False``.
@@ -117,11 +115,6 @@ def __init__(self, kms_providers, key_vault_namespace,
117115
self._key_vault_client = key_vault_client
118116
self._schema_map = schema_map
119117
self._bypass_auto_encryption = bypass_auto_encryption
120-
if mongocryptd_uri is None:
121-
if hasattr(socket, 'AF_UNIX'):
122-
mongocryptd_uri = 'mongodb://%2Ftmp%2Fmongocryptd.sock'
123-
else:
124-
mongocryptd_uri = 'mongodb://localhost:27020'
125118
self._mongocryptd_uri = mongocryptd_uri
126119
self._mongocryptd_bypass_spawn = mongocryptd_bypass_spawn
127120
self._mongocryptd_spawn_path = mongocryptd_spawn_path

test/test_encryption.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import base64
1818
import copy
1919
import os
20-
import socket
2120
import traceback
2221
import sys
2322
import uuid
@@ -74,14 +73,7 @@ def test_init(self):
7473
self.assertEqual(opts._key_vault_client, None)
7574
self.assertEqual(opts._schema_map, None)
7675
self.assertEqual(opts._bypass_auto_encryption, False)
77-
78-
if hasattr(socket, 'AF_UNIX'):
79-
self.assertEqual(
80-
opts._mongocryptd_uri, 'mongodb://%2Ftmp%2Fmongocryptd.sock')
81-
else:
82-
self.assertEqual(
83-
opts._mongocryptd_uri, 'mongodb://localhost:27020')
84-
76+
self.assertEqual(opts._mongocryptd_uri, 'mongodb://localhost:27020')
8577
self.assertEqual(opts._mongocryptd_bypass_spawn, False)
8678
self.assertEqual(opts._mongocryptd_spawn_path, 'mongocryptd')
8779
self.assertEqual(

0 commit comments

Comments
 (0)