Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-19671

Missing SSH passphrase causes a misleading error: "Cannot decode connection params"

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • None
    • Repository (Other)
    • None
    • 0
    • 1
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      Problem Definition

      Bamboo fails with a misleading error when the SSH passphrase is left empty and the SSH private key requires it to have a value when creating a git reposiory.
      This is the misleading error: "Cannot decode connection params"

      The server logs won't give you enough details to clarify this scenario. This is what we see in the logs:

      2018-02-06 12:24:11,902 INFO [http-nio-8085-exec-12] [AccessLogFilter] admin PUT http://localhost:8085/bamboo/rest/api/latest/repository/testConnection 323095kb
      2018-02-06 12:24:11,906 INFO [http-nio-8085-exec-12] [RepositoryResource] Testing connection to repository (type: Git, location: ssh://localhost:7999/bitbucket/tes/javahello.git)
      2018-02-06 12:24:11,917 INFO [http-nio-8085-exec-12] [RepositoryResource] Failed to connect to repository (type: Git, location: ssh://localhost:7999/bitbucket/tes/javahello.git, time: 10.85 ms, errors: [Cannot decode connection params])

      We are able to see the full stacktrace if we ignore the error and configure a plan to use that repository. The change detection will fail for the plan and the following stack will be available:

      com.atlassian.bamboo.repository.RepositoryException: Cannot decode connection params
        at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.beforeRepositoryAccess(NativeGitOperationHelper.java:228)
        at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.lambda$getRemoteRefs$1(NativeGitOperationHelper.java:575)
        at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:38)
        at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:34)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
        at com.atlassian.bamboo.collections.AlwaysInvalidatingCacheDecorator.get(AlwaysInvalidatingCacheDecorator.java:64)
        at com.atlassian.bamboo.collections.AlwaysInvalidatingCacheDecorator.getUnchecked(AlwaysInvalidatingCacheDecorator.java:125)
        at com.atlassian.bamboo.util.CallableResultCache.call(CallableResultCache.java:141)
        at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getRemoteRefs(NativeGitOperationHelper.java:586)
        at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.resolveBranch(NativeGitOperationHelper.java:538)
        at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:637)
        at com.atlassian.bamboo.plugins.git.v2.GitChangeDetector.collectChanges(GitChangeDetector.java:71)
        at com.atlassian.bamboo.plugins.git.v2.GitChangeDetector.collectChangesSinceRevision(GitChangeDetector.java:50)
        at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:481)
        at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.lambda$createBuildRepositoryChanges$1(DefaultChangeDetectionManager.java:382)
        at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)
        at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:344)
        at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:290)
        at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:199)
        at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:152)
        at com.atlassian.bamboo.v2.trigger.ManualBuildDetectionAction.performDelayedChangeDetection(ManualBuildDetectionAction.java:154)
        at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$1.getChainState(ChainExecutionManagerImpl.java:240)
        at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:315)
        at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:232)
        at sun.reflect.GeneratedMethodAccessor1652.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
        at com.sun.proxy.$Proxy198.delayedStart(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor1652.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy198.delayedStart(Unknown Source)
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.lambda$call$0(PlanExecutionManagerImpl.java:374)
        at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:136)
        at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:133)
        at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:162)
        at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:133)
        at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:187)
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:373)
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:366)
        at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)
        at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:75)
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:655)
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$400(PlanExecutionManagerImpl.java:130)
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1.run(PlanExecutionManagerImpl.java:362)
        at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
        at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
        at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
        at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
        at java.lang.Thread.run(Thread.java:745)
      Caused by: org.bouncycastle.openssl.PEMException: Unable to create OpenSSL PBDKF: Could not generate secret key
        at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source)
        at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source)
        at org.bouncycastle.openssl.jcajce.PEMUtilities.crypt(Unknown Source)
        at org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder$1$1.decrypt(Unknown Source)
        at org.bouncycastle.openssl.PEMEncryptedKeyPair.decryptKeyPair(Unknown Source)
        at com.atlassian.bamboo.crypto.BouncyCastleProviderUtils.decrypt(BouncyCastleProviderUtils.java:79)
        at com.atlassian.bamboo.crypto.BouncyCastleProviderUtils.toJavaKeyPair(BouncyCastleProviderUtils.java:66)
        at com.atlassian.bamboo.plugins.ssh.ProxyConnectionDataBuilderImpl.withKeyFromReader(ProxyConnectionDataBuilderImpl.java:90)
        at com.atlassian.bamboo.plugins.ssh.ProxyConnectionDataBuilderImpl.withKeyFromString(ProxyConnectionDataBuilderImpl.java:69)
        at com.atlassian.bamboo.plugins.ssh.ProxyConnectionDataBuilderImpl.withKeyFromString(ProxyConnectionDataBuilderImpl.java:30)
        at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.beforeRepositoryAccess(NativeGitOperationHelper.java:210)
        ... 63 more
      Caused by: java.security.spec.InvalidKeySpecException: Could not generate secret key
        at javax.crypto.SecretKeyFactory.generateSecret(SecretKeyFactory.java:347)
        ... 74 more
      Caused by: java.lang.IllegalArgumentException: password empty
        at org.bouncycastle.jcajce.provider.symmetric.OpenSSLPBKDF$PBKDF.engineGenerateSecret(Unknown Source)
        at javax.crypto.SecretKeyFactory.generateSecret(SecretKeyFactory.java:336)
        ... 74 more

      Suggested Solution

      Show the full stacktrace in the Bamboo logs and a meaningful error when testing the connection through the UI.
      It seems that error is not considered an error for Bamboo which is logging this error as an info restricting the stacktrace.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dsantos Daniel Santos
              Votes:
              11 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated: