Skip to content

Commit a5696f1

Browse files
committed
Add any option to fingerprint host config setting
1 parent db79e0f commit a5696f1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/scala/com/decodified/scalassh/HostConfig.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ object HostKeyVerifiers {
221221
catch { case e: Exception => Left("Could not read %s due to %s".format(knownHostsFile, e)) }
222222
} else Left(knownHostsFile.toString + " not found")
223223
}
224-
def forFingerprint(fingerprint: String) = new HostKeyVerifier {
225-
def verify(hostname: String, port: Int, key: PublicKey) = SecurityUtils.getFingerprint(key) == fingerprint
224+
def forFingerprint(fingerprint: String) = fingerprint match {
225+
case "any" | "ANY" => DontVerify
226+
case fp => new HostKeyVerifier {
227+
def verify(hostname: String, port: Int, key: PublicKey) = SecurityUtils.getFingerprint(key) == fp
228+
}
226229
}
227230
}

0 commit comments

Comments
 (0)