10gen / mongo-orchestration

Apache License 2.0
7 stars 11 forks source link

Use SCRAM-SHA-1 on MongoDB >= 3.7.2 #238

Closed ShaneHarvey closed 6 years ago

ShaneHarvey commented 6 years ago

This allows starting >=3.7.2 servers with auth.

Previously attempts would fail because pymongo does not support SCRAM-SHA-256:

RuntimeError: Error sending POST to cluster: Traceback (most recent call last):
  File "/Users/shane/git/mongo-orchestration/mongo_orchestration/apps/__init__.py", line 66, in wrap
    return f(*arg, **kwd)
  File "/Users/shane/git/mongo-orchestration/mongo_orchestration/apps/replica_sets.py", line 80, in rs_create
    result = _rs_create(data)
  File "/Users/shane/git/mongo-orchestration/mongo_orchestration/apps/replica_sets.py", line 37, in _rs_create
    rs_id = ReplicaSets().create(params)
  File "/Users/shane/git/mongo-orchestration/mongo_orchestration/replica_sets.py", line 630, in create
    repl = ReplicaSet(rs_params)
  File "/Users/shane/git/mongo-orchestration/mongo_orchestration/replica_sets.py", line 106, in __init__
    self._add_users(self.connection()[self.auth_source])
  File "/Users/shane/git/mongo-orchestration/mongo_orchestration/common.py", line 128, in _add_users
    db.add_user(**secondary_login)
  File "/Users/shane/venv-python3.6/lib/python3.6/site-packages/pymongo/database.py", line 953, in add_user
    (not uinfo["users"]), name, password, read_only, **kwargs)
  File "/Users/shane/venv-python3.6/lib/python3.6/site-packages/pymongo/database.py", line 876, in _create_or_update_user
    self.command(command_name, name, **opts)
  File "/Users/shane/venv-python3.6/lib/python3.6/site-packages/pymongo/database.py", line 516, in command
    codec_options, **kwargs)
  File "/Users/shane/venv-python3.6/lib/python3.6/site-packages/pymongo/database.py", line 428, in _command
    parse_write_concern_error=parse_write_concern_error)
  File "/Users/shane/venv-python3.6/lib/python3.6/site-packages/pymongo/pool.py", line 477, in command
    collation=collation)
  File "/Users/shane/venv-python3.6/lib/python3.6/site-packages/pymongo/network.py", line 116, in command
    parse_write_concern_error=parse_write_concern_error)
  File "/Users/shane/venv-python3.6/lib/python3.6/site-packages/pymongo/helpers.py", line 210, in _check_command_response
    raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: Use of SCRAM-SHA-256 requires undigested passwords
ajdavis commented 6 years ago

Does the C Driver (and others) need to install PyMongo from master, as well as mongo-orchestration from master, in order to use this?

behackett commented 6 years ago

No. This change works with existing released versions of PyMongo.

behackett commented 6 years ago

Oh, you will need to install mongo-orchestration from master, until we do another release. drivers-evergreen-tools uses git master for mongo-orchestration already.