Fix error 'could not load known_host' saat koneksi
Di Android tidak ada file known_hosts di path JVM default, sehingga sshj loadKnownHosts() melempar peringatan 'could not load known_host'. Karena v1 pakai PromiscuousVerifier (accept-all) dengan TODO known_host pinning di backlog, loadKnownHosts() tidak berguna dan dihapus. Auth password tetap jalan.
This commit is contained in:
@@ -138,7 +138,10 @@ class SshEngine(
|
|||||||
val config: Config = DefaultConfig()
|
val config: Config = DefaultConfig()
|
||||||
val c = SSHClient(config)
|
val c = SSHClient(config)
|
||||||
c.useCompression()
|
c.useCompression()
|
||||||
c.loadKnownHosts()
|
// Catatan: tidak memanggil loadKnownHosts() — di Android tidak ada file
|
||||||
|
// known_hosts di path default JVM, jadi sshj hanya akan melempar peringatan
|
||||||
|
// "could not load known_host". Host-key pinning (known_hosts) direncanakan
|
||||||
|
// di backlog; untuk v1 kita terima host key (PromiscuousVerifier).
|
||||||
// Validate host keys: in this v1 we accept any host key but warn.
|
// Validate host keys: in this v1 we accept any host key but warn.
|
||||||
// TODO: real known-host pinning (store fingerprint per profile).
|
// TODO: real known-host pinning (store fingerprint per profile).
|
||||||
c.addHostKeyVerifier(PromiscuousVerifier())
|
c.addHostKeyVerifier(PromiscuousVerifier())
|
||||||
|
|||||||
Reference in New Issue
Block a user