Uploaded image for project: 'Apache Hop (Retired)'
  1. Apache Hop (Retired)
  2. HOP-3868

Encrypted passwords in variables don't work in MongoDB connections

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • None
    • Database
    • None

    Description

      I'm using an environment variable in a project to store the password for a MongoDB connection.

      When the variable stores the password as plain text the connection to MongoDB works,

      but when the variable stores the obfuscated password generated using 

      ./hop-encrypt.sh -hop mypwd

      , the connection doesn't work.

      Error message when I use Preview in Mongodb Input transform:

      2022/03/25 12:06:40 - Hop - Projects enabled
      2022/03/25 12:06:40 - Hop - Enabling project : 'GitMigracionHop'
      2022/03/25 12:06:55 - Preview pipeline for MONGO_ESTUDIANTES - Executing this pipeline using the Local Pipeline Engine with run configuration 'local'
      2022/03/25 12:06:55 - Preview pipeline for MONGO_ESTUDIANTES - Execution started for pipeline [Preview pipeline for MONGO_ESTUDIANTES]
      2022/03/25 12:06:55 - MONGO_ESTUDIANTES.0 - Normal authentication for user myuser
      2022/03/25 12:06:55 - MONGO_ESTUDIANTES.0 - Configuring connection with read preference: primary
      2022/03/25 12:06:55 - MONGO_ESTUDIANTES.0 - No read preference tag sets defined
      2022/03/25 12:06:55 - MONGO_ESTUDIANTES.0 - Configuring connection with write concern - w = 1, wTimeout = 0, journaled = true
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 - ERROR: Unexpected error
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 - ERROR: org.apache.hop.core.exception.HopException: 
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 - com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-256, userName='myuser', source='mymongodb', password=<hidden>, mechanismProperties=<hidden>}
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 - Exception authenticating MongoCredential{mechanism=SCRAM-SHA-256, userName='myuser', source='mymongodb', password=<hidden>, mechanismProperties=<hidden>}
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 - 
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at org.apache.hop.pipeline.transforms.mongodbinput.MongoDbInput.processRow(MongoDbInput.java:145)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at org.apache.hop.pipeline.transform.RunThread.run(RunThread.java:58)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at java.lang.Thread.run(Thread.java:748)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 - Caused by: com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-256, userName='myuser', source='mymongodb', password=<hidden>, mechanismProperties=<hidden>}
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.SaslAuthenticator.wrapException(SaslAuthenticator.java:201)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.SaslAuthenticator.access$300(SaslAuthenticator.java:40)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:78)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:47)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.SaslAuthenticator.doAsSubject(SaslAuthenticator.java:207)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:47)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.InternalStreamConnectionInitializer.authenticateAll(InternalStreamConnectionInitializer.java:156)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:63)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:129)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:50)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.open(DefaultConnectionPool.java:398)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:115)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:101)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.DefaultServer.getConnection(DefaultServer.java:92)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:133)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.client.internal.ClientSessionBinding$SessionBindingConnectionSource.getConnection(ClientSessionBinding.java:135)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.operation.FindOperation$1.call(FindOperation.java:728)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.operation.FindOperation$1.call(FindOperation.java:725)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.operation.OperationHelper.withReadConnectionSource(OperationHelper.java:463)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.operation.FindOperation.execute(FindOperation.java:725)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.operation.FindOperation.execute(FindOperation.java:89)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:194)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:175)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.DBCursor.initializeCursor(DBCursor.java:989)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.DBCursor.hasNext(DBCursor.java:172)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at org.apache.hop.mongo.wrapper.cursor.DefaultCursorWrapper.hasNext(DefaultCursorWrapper.java:34)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at org.apache.hop.pipeline.transforms.mongodbinput.MongoDbInput.processRow(MongoDbInput.java:91)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     ... 2 more
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 - Caused by: com.mongodb.MongoCommandException: Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server myserver:port. The full response is {"ok": 0.0, "errmsg": "Authentication failed.", "code": 18, "codeName": "AuthenticationFailed"}
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:175)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:303)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:259)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:83)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:33)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.SaslAuthenticator.sendSaslContinue(SaslAuthenticator.java:162)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.SaslAuthenticator.access$200(SaslAuthenticator.java:40)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     at com.mongodb.internal.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:67)
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 -     ... 26 more
      2022/03/25 12:06:56 - MONGO_ESTUDIANTES.0 - Finished processing (I=0, O=0, R=0, W=0, U=0, E=1)
      2022/03/25 12:06:56 - Preview pipeline for MONGO_ESTUDIANTES - Pipeline detected one or more transforms with errors.
      2022/03/25 12:06:56 - Preview pipeline for MONGO_ESTUDIANTES - Pipeline is killing the other transforms!
      2022/03/25 12:06:56 - Preview pipeline for MONGO_ESTUDIANTES - Pipeline duration : 1.319 seconds [  1.318" ]
      2022/03/25 12:06:56 - Preview pipeline for MONGO_ESTUDIANTES - Execution finished on a local pipeline engine with run configuration 'local'

      Attachments

        Activity

          People

            Unassigned Unassigned
            AnaMGH Ana González Hernández
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: