Top Description Fields Constructors Methods
org.apache.sshd.client.keyverifier

public Class DefaultKnownHostsServerKeyVerifier

extends KnownHostsServerKeyVerifier
Class Inheritance
Imports
java.io.File, .IOException, java.nio.file.LinkOption, .Path, java.security.GeneralSecurityException, java.util.Collections, .List, .Map, .Objects, org.apache.sshd.client.config.hosts.KnownHostEntry, org.apache.sshd.client.session.ClientSession, org.apache.sshd.common.util.io.IoUtils

Monitors the ~/.ssh/known_hosts file of the user currently running the client, updating and re-loading it if necessary. It also (optionally) enforces the same permissions regime as OpenSSH.
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private final boolean
Inherited from org.apache.sshd.client.keyverifier.KnownHostsServerKeyVerifier:
KNOWN_HOSTS_FILE_OPTIONSTRICT_CHECKING_OPTIONupdateLock

Constructor Summary

AccessConstructor and Description
public
public
public
public
DefaultKnownHostsServerKeyVerifier(ServerKeyVerifier delegate, boolean strict, Path file, LinkOption... options)

Method Summary

Modifier and TypeMethod and Description
public final boolean

Returns:

If true then makes sure that the containing folder has 0700 access and the file 0644

Note

for Windows it does not check these permissions

isStrict
()

protected List<KnownHostsServerKeyVerifier.HostEntryPair>
Inherited from org.apache.sshd.client.keyverifier.KnownHostsServerKeyVerifier:
acceptIncompleteHostKeysacceptKnownHostEntriesacceptModifiedServerKeyacceptUnknownHostKeyfindKnownHostEntriesgetDelegateVerifiergetFallbackPublicKeyEntryResolvergetHostValueDigestergetKnownHostSuppliergetModifiedServerKeyAcceptorhandleKnownHostsFileUpdateFailurehandleModifiedServerKeyUpdateFailurehandleRevokedKeyprepareKnownHostEntryprepareModifiedServerKeyLineresolveHostKeyresolveHostNetworkIdentitiessetLoadedHostsEntriessetModifiedServerKeyAcceptorupdateKnownHostsFileupdateModifiedServerKeyupdateModifiedServerKeyverifyServerKey

Field Detail

strictback to summary
private final boolean strict

Constructor Detail

DefaultKnownHostsServerKeyVerifierback to summary
public DefaultKnownHostsServerKeyVerifier(ServerKeyVerifier delegate)
DefaultKnownHostsServerKeyVerifierback to summary
public DefaultKnownHostsServerKeyVerifier(ServerKeyVerifier delegate, boolean strict)
DefaultKnownHostsServerKeyVerifierback to summary
public DefaultKnownHostsServerKeyVerifier(ServerKeyVerifier delegate, boolean strict, File file)
DefaultKnownHostsServerKeyVerifierback to summary
public DefaultKnownHostsServerKeyVerifier(ServerKeyVerifier delegate, boolean strict, Path file, LinkOption... options)

Method Detail

isStrictback to summary
public final boolean isStrict()
Returns:boolean

If true then makes sure that the containing folder has 0700 access and the file 0644

Note

for Windows it does not check these permissions

See Also
validateStrictConfigFilePermissions(Path, LinkOption...)
reloadKnownHostsback to summary
protected List<KnownHostsServerKeyVerifier.HostEntryPair> reloadKnownHosts(ClientSession session, Path file) throws IOException, GeneralSecurityException

Overrides org.apache.sshd.client.keyverifier.KnownHostsServerKeyVerifier.reloadKnownHosts.

Parameters
session:ClientSession

Doc from org.apache.sshd.client.keyverifier.KnownHostsServerKeyVerifier.reloadKnownHosts.

The ClientSession that triggered this request

file:Path

Doc from org.apache.sshd.client.keyverifier.KnownHostsServerKeyVerifier.reloadKnownHosts.

The Path to reload from

Returns:List<KnownHostsServerKeyVerifier.HostEntryPair>

Doc from org.apache.sshd.client.keyverifier.KnownHostsServerKeyVerifier.reloadKnownHosts.

A List of the loaded HostEntryPairs - may be null/empty

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.client.keyverifier.KnownHostsServerKeyVerifier.reloadKnownHosts.

If failed to parse the file

GeneralSecurityException:

Doc from org.apache.sshd.client.keyverifier.KnownHostsServerKeyVerifier.reloadKnownHosts.

If failed to resolve the encoded public keys