-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip reading keys from SSH agent with IdentitiesOnly configuration di…
…rective is found in ~/.ssh/config
- Loading branch information
Showing
3 changed files
with
99 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
ssh/src/main/java/ch/cyberduck/core/sftp/openssh/OpenSSHIdentitiesOnlyConfigurator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package ch.cyberduck.core.sftp.openssh; | ||
|
||
/* | ||
* Copyright (c) 2012 David Kocher. All rights reserved. | ||
* http://cyberduck.ch/ | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* Bug fixes, suggestions and comments should be sent to: | ||
* dkocher@cyberduck.ch | ||
*/ | ||
|
||
import ch.cyberduck.core.LocalFactory; | ||
import ch.cyberduck.core.sftp.openssh.config.transport.OpenSshConfig; | ||
|
||
public class OpenSSHIdentitiesOnlyConfigurator { | ||
private final OpenSshConfig configuration; | ||
|
||
public OpenSSHIdentitiesOnlyConfigurator() { | ||
this(new OpenSshConfig(LocalFactory.get(LocalFactory.get(LocalFactory.get(), ".ssh"), "config"))); | ||
} | ||
|
||
public OpenSSHIdentitiesOnlyConfigurator(final OpenSshConfig configuration) { | ||
this.configuration = configuration; | ||
} | ||
|
||
public boolean isIdentitiesOnly(final String alias) { | ||
final Boolean identitiesOnly = configuration.lookup(alias).isIdentitiesOnly(); | ||
if(null == identitiesOnly) { | ||
return false; | ||
} | ||
return identitiesOnly; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
final StringBuilder sb = new StringBuilder("OpenSSHHostnameConfigurator{"); | ||
sb.append("configuration=").append(configuration); | ||
sb.append('}'); | ||
return sb.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters