Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1074#discussion_r46030081
  
    --- Diff: 
core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/SshToolAbstractIntegrationTest.java
 ---
    @@ -264,8 +271,44 @@ public void testSshKeyWithPassphrase() throws 
Exception {
         }
     
         @Test(groups = {"Integration"})
    +    public void testSshKeyWithNoKeyDefaultsToIdrsa() throws Exception {
    +        final SshTool localtool = 
newTool(ImmutableMap.<String,Object>builder()
    +                .put(SshTool.PROP_HOST.getName(), "localhost")
    +                .build());
    +        tools.add(localtool);
    +        localtool.connect();
    +        assertEquals(localtool.execScript(MutableMap.<String,Object>of(), 
ImmutableList.of("date")), 0);
    +    }
    +
    +    @Test(groups = {"Integration"})
    +    public void testSshKeyWithPrivateKeyData() throws Exception {
    +        final SshTool localtool = 
newTool(ImmutableMap.<String,Object>builder()
    +                .put(SshTool.PROP_HOST.getName(), "localhost")
    +                .put(SshTool.PROP_PRIVATE_KEY_DATA.getName(), new 
String(Files.toByteArray(new File(Os.tidyPath(SSH_DEFAULT_KEYFILE))), 
StandardCharsets.UTF_8))
    +                .build());
    +        localtool.connect();
    +
    +        assertEquals(localtool.execScript(MutableMap.<String,Object>of(), 
ImmutableList.of("date")), 0);
    +
    +        // Also needs the negative test to prove that we're really using 
an ssh-key with a passphrase
    +        try {
    +            final SshTool localtool2 = 
newTool(ImmutableMap.<String,Object>builder()
    +                    .put(SshTool.PROP_HOST.getName(), "localhost")
    +                    .put(SshTool.PROP_PRIVATE_KEY_DATA.getName(), "invalid 
data")
    +                    .build());
    +            localtool2.connect();
    +            localtool2.execScript(MutableMap.<String,Object>of(), 
ImmutableList.of("date"));
    --- End diff --
    
    @bostko i've never encountered a situation where the default 
`identitiesOnly=no` causes a problem.  can you tell what settings (presumably 
in the `sshd` config on your localhost) make this necessary?
    
    for integration tests on localhost you should be able to undo those.
    
    we could allow arbitrary tool-specific ssh-tool configuration to be 
specified in `brooklyn.properties` in the first instance, only introducing an 
`identitiesOnly=yes` parameter if the issue recurs.
    
    definitely open a jira issue in case other people hit this, including info 
on the ssh client and server config, and the errors which result.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to