Class ManuallyProvidedKeyVerificationStrategy
- java.lang.Object
-
- hudson.plugins.sshslaves.verifiers.SshHostKeyVerificationStrategy
-
- hudson.plugins.sshslaves.verifiers.ManuallyProvidedKeyVerificationStrategy
-
- All Implemented Interfaces:
Describable<SshHostKeyVerificationStrategy>
public class ManuallyProvidedKeyVerificationStrategy extends SshHostKeyVerificationStrategy
Checks a key provided by a remote hosts matches a key specified as being required by the user that configured this strategy. This would be equivalent of someone manually setting a value in their known hosts file before attempting an SSH connection on a Unix/Linux machine.- Since:
- 1.13
- Author:
- Michael Clarke
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ManuallyProvidedKeyVerificationStrategy.ManuallyProvidedKeyVerificationStrategyDescriptor
-
Nested classes/interfaces inherited from class hudson.plugins.sshslaves.verifiers.SshHostKeyVerificationStrategy
SshHostKeyVerificationStrategy.SshHostKeyVerificationStrategyDescriptor
-
-
Constructor Summary
Constructors Constructor Description ManuallyProvidedKeyVerificationStrategy(String key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getKey()
HostKey
getParsedKey()
String[]
getPreferredKeyAlgorithms(SlaveComputer computer)
Provides a list of preferred key algorithms for this strategy and computer.boolean
verify(SlaveComputer computer, HostKey hostKey, TaskListener listener)
Check if the given key is valid for the host identifier.-
Methods inherited from class hudson.plugins.sshslaves.verifiers.SshHostKeyVerificationStrategy
getDescriptor
-
-
-
-
Constructor Detail
-
ManuallyProvidedKeyVerificationStrategy
@DataBoundConstructor public ManuallyProvidedKeyVerificationStrategy(String key)
-
-
Method Detail
-
getKey
public String getKey()
-
getParsedKey
public HostKey getParsedKey()
-
verify
public boolean verify(SlaveComputer computer, HostKey hostKey, TaskListener listener) throws Exception
Description copied from class:SshHostKeyVerificationStrategy
Check if the given key is valid for the host identifier.- Specified by:
verify
in classSshHostKeyVerificationStrategy
- Parameters:
computer
- the computer this connection is being initiated forhostKey
- the key that was transmitted by the remote host for the current connection. This is the key that should be checked to see if we trust it by the current verifier.listener
- the connection listener to write any output log to- Returns:
- whether the provided HostKey is trusted and the current connection can therefore continue.
- Throws:
Exception
-
getPreferredKeyAlgorithms
public String[] getPreferredKeyAlgorithms(SlaveComputer computer) throws IOException
Description copied from class:SshHostKeyVerificationStrategy
Provides a list of preferred key algorithms for this strategy and computer.- Overrides:
getPreferredKeyAlgorithms
in classSshHostKeyVerificationStrategy
- Returns:
- a list of algorithms; empty or null lists will be ignored
- Throws:
IOException
- See Also:
Connection.setServerHostKeyAlgorithms(java.lang.String[])
-
-