Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-4536

Can't connect using username/password

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.24.6
    • Affects Version/s: 1.23.0, 1.24.1
    • Component/s: Compass
    • None
    • Environment:
      MacOSX 10.15.6
      Ubuntu 18
    • Not Needed

      Problem Description

      I can't connect to my mongoDB instance using a SSH Tunnel and a username/password.  This might be related to COMPASS-4534.

      It works if I run a mongo shell directly on the same port and using the same username/password. It works as well if I run a mongo shell on the remote server using the same username/password.

      The last Compass Version it appears to be working is 1.21.0.

      I haven't changed anything in the actual connection string, it just stops working when using any Compass Version above 1.21.0

      Please note that I am opening the SSH Tunnel manually outside of Compass via:

       

      ssh -L 57896:127.0.0.1:57896 user@remote_server

       

      My remote instance is listening on port 57896.

      Steps to Reproduce

      Create a remote MongoDB Instance with username/password authentication.

      Connect via a SSH Tunnel to the server running the remote instance (It can be on the standard port of 27017).

      Try to connect to the Instance from your local machine running Compass 1.24.1 or 1.23.0

      Expected Results

      It should connect to the Remote Instance, like it does in Compass 1.21.0

      Actual Results

      It doesn't connect and displays a wrong "connect ECONNREFUSED 127.0.0.1:27017" error

      Additional Notes

      It seems that Compass does actually connect to the remote instance but doesn't run the authentication command.

      It might be something in the nodejs driver which changes from 3.5.6 to 3.6.3 between the working and not working Compass versions.

      These are the logs I see within my remote MongoDB Instance

       

      {"t":{"$date":"2020-12-10T16:34:12.184+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"10.0.4.3:34958","sessionId":22429,"connectionCount":184}}
      {"t":{"$date":"2020-12-10T16:34:12.229+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn22429","msg":"client metadata","attr":{"remote":"10.0.4.3:34958","client":"conn22429","doc":{"driver":{"name":"nodejs","version":"3.6.3"},"os":{"type":"Darwin","name":"darwin","architecture":"x64","version":"19.6.0"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}
      {"t":{"$date":"2020-12-10T16:34:12.289+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn22429","msg":"connection ended","attr":{"remote":"10.0.4.3:34958","connectionCount":183}}
      

      These are the SSH Logs:

       

       

      debug1: Connection to port 57896 forwarding to 127.0.0.1 port 57896 requested. debug1: channel 9: new [direct-tcpip]
      debug1: channel 9: free: direct-tcpip: listening port 57896 for 127.0.0.1 port 57896, connect from 127.0.0.1 port 51418 to 127.0.0.1 port 57896, nchannels 10
      

      So a connection is established, but the authentication fails.

       

      These are the logs when I connect via Compass 1.21.0

       

      {"t":{"$date":"2020-12-10T16:39:09.260+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"10.0.4.3:35000","sessionId":22436,"connectionCount":178}}
      {"t":{"$date":"2020-12-10T16:39:09.313+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn22436","msg":"client metadata","attr":{"remote":"10.0.4.3:35000","client":"conn22436","doc":{"driver":{"name":"nodejs","version":"3.5.6"},"os":{"type":"Darwin","name":"darwin","architecture":"x64","version":"19.6.0"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}
      {"t":{"$date":"2020-12-10T16:39:09.467+00:00"},"s":"I",  "c":"ACCESS",   "id":20250,   "ctx":"conn22436","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"username","authenticationDatabase":"admin","client":"10.0.4.3:35000"}}
      {"t":{"$date":"2020-12-10T16:39:09.567+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"10.0.4.3:35018","sessionId":22437,"connectionCount":179}}
      {"t":{"$date":"2020-12-10T16:39:09.570+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"10.0.4.3:35020","sessionId":22438,"connectionCount":180}}
      {"t":{"$date":"2020-12-10T16:39:09.571+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"10.0.4.3:35022","sessionId":22439,"connectionCount":181}}
      {"t":{"$date":"2020-12-10T16:39:09.572+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"10.0.4.3:35024","sessionId":22440,"connectionCount":182}}
      {"t":{"$date":"2020-12-10T16:39:09.613+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn22437","msg":"client metadata","attr":{"remote":"10.0.4.3:35018","client":"conn22437","doc":{"driver":{"name":"nodejs","version":"3.5.6"},"os":{"type":"Darwin","name":"darwin","architecture":"x64","version":"19.6.0"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}
      {"t":{"$date":"2020-12-10T16:39:09.614+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn22438","msg":"client metadata","attr":{"remote":"10.0.4.3:35020","client":"conn22438","doc":{"driver":{"name":"nodejs","version":"3.5.6"},"os":{"type":"Darwin","name":"darwin","architecture":"x64","version":"19.6.0"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}
      {"t":{"$date":"2020-12-10T16:39:09.614+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn22440","msg":"client metadata","attr":{"remote":"10.0.4.3:35024","client":"conn22440","doc":{"driver":{"name":"nodejs","version":"3.5.6"},"os":{"type":"Darwin","name":"darwin","architecture":"x64","version":"19.6.0"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}
      {"t":{"$date":"2020-12-10T16:39:09.615+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn22439","msg":"client metadata","attr":{"remote":"10.0.4.3:35022","client":"conn22439","doc":{"driver":{"name":"nodejs","version":"3.5.6"},"os":{"type":"Darwin","name":"darwin","architecture":"x64","version":"19.6.0"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}
      {"t":{"$date":"2020-12-10T16:39:09.812+00:00"},"s":"I",  "c":"ACCESS",   "id":20250,   "ctx":"conn22440","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"username","authenticationDatabase":"admin","client":"10.0.4.3:35024"}}
      {"t":{"$date":"2020-12-10T16:39:09.816+00:00"},"s":"I",  "c":"ACCESS",   "id":20250,   "ctx":"conn22437","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"username","authenticationDatabase":"admin","client":"10.0.4.3:35018"}}
      {"t":{"$date":"2020-12-10T16:39:09.817+00:00"},"s":"I",  "c":"ACCESS",   "id":20250,   "ctx":"conn22438","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"username","authenticationDatabase":"admin","client":"10.0.4.3:35020"}}
      {"t":{"$date":"2020-12-10T16:39:09.818+00:00"},"s":"I",  "c":"ACCESS",   "id":20250,   "ctx":"conn22439","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"username","authenticationDatabase":"admin","client":"10.0.4.3:35022"}}
      {"t":{"$date":"2020-12-10T16:39:09.919+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"10.0.4.3:35030","sessionId":22441,"connectionCount":183}}
      {"t":{"$date":"2020-12-10T16:39:09.962+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn22441","msg":"client metadata","attr":{"remote":"10.0.4.3:35030","client":"conn22441","doc":{"driver":{"name":"nodejs","version":"3.5.6"},"os":{"type":"Darwin","name":"darwin","architecture":"x64","version":"19.6.0"},"platform":"'Node.js v12.4.0, LE (unified)","application":{"name":"MongoDB Compass"}}}}
      {"t":{"$date":"2020-12-10T16:39:10.114+00:00"},"s":"I",  "c":"ACCESS",   "id":20250,   "ctx":"conn22441","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"username","authenticationDatabase":"admin","client":"10.0.4.3:35030"}}
      

      These are the ssh logs:

       

       

      debug1: Connection to port 57896 forwarding to 127.0.0.1 port 57896 requested.
      debug1: channel 3: new [direct-tcpip]
      debug1: Connection to port 57896 forwarding to 127.0.0.1 port 57896 requested.
      debug1: channel 4: new [direct-tcpip]
      debug1: Connection to port 57896 forwarding to 127.0.0.1 port 57896 requested.
      debug1: channel 5: new [direct-tcpip]
      debug1: Connection to port 57896 forwarding to 127.0.0.1 port 57896 requested.
      debug1: channel 6: new [direct-tcpip]
      debug1: Connection to port 57896 forwarding to 127.0.0.1 port 57896 requested.
      debug1: channel 7: new [direct-tcpip]
      debug1: Connection to port 57896 forwarding to 127.0.0.1 port 57896 requested.
      debug1: channel 8: new [direct-tcpip]
      

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            jascha.brinkmann+mongodb@gmail.com Jascha Brinkmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: