brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bostko <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Add documentation and additional ...
Date Thu, 26 Nov 2015 23:36:51 GMT
Github user bostko commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1074#discussion_r46010405
  
    --- 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 --
    
    @aledsage this was succeeding for me. I found that I have to use "IdentitiesOnly=yes"
in order to deny ssh to try keys other than the specified keys as a parameter or from the
config file.
    Check http://linux.die.net/man/5/ssh_config
    Do you think it is reasonable make a configurable IdentitiesOnly parameter in the SshTool
in order to use it for such tests?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message