mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 18:32:58 +08:00
feat: sftp HostKeyAlgorithms (#255)
This commit is contained in:
@@ -8,6 +8,7 @@ import org.apache.commons.io.Charsets
|
|||||||
import org.apache.commons.io.FileUtils
|
import org.apache.commons.io.FileUtils
|
||||||
import org.apache.commons.io.IOUtils
|
import org.apache.commons.io.IOUtils
|
||||||
import org.apache.commons.lang3.StringUtils
|
import org.apache.commons.lang3.StringUtils
|
||||||
|
import org.apache.sshd.client.ClientBuilder
|
||||||
import org.apache.sshd.client.SshClient
|
import org.apache.sshd.client.SshClient
|
||||||
import org.apache.sshd.client.session.ClientSession
|
import org.apache.sshd.client.session.ClientSession
|
||||||
import org.apache.sshd.common.config.keys.writer.openssh.OpenSSHKeyPairResourceWriter
|
import org.apache.sshd.common.config.keys.writer.openssh.OpenSSHKeyPairResourceWriter
|
||||||
@@ -83,11 +84,19 @@ class SFTPPtyTerminalTab(windowScope: WindowScope, host: Host) : PtyHostTerminal
|
|||||||
commands.add("UserKnownHostsFile=${File(Application.getBaseDataDir(), "known_hosts").absolutePath}")
|
commands.add("UserKnownHostsFile=${File(Application.getBaseDataDir(), "known_hosts").absolutePath}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Compression
|
// Compression
|
||||||
commands.add("-o")
|
commands.add("-o")
|
||||||
commands.add("Compression=yes")
|
commands.add("Compression=yes")
|
||||||
|
|
||||||
|
// HostKeyAlgorithms 让 SFTP 命令的顺序和 sshd 的一致 这样可以避免 known_hosts 文件不一致问题
|
||||||
|
val hostKeyAlgorithms = ClientBuilder.setUpDefaultSignatureFactories(true).joinToString(",") { it.name }
|
||||||
|
commands.add("-o")
|
||||||
|
commands.add("HostKeyAlgorithms=${hostKeyAlgorithms}")
|
||||||
|
|
||||||
|
// 不使用配置文件
|
||||||
|
commands.add("-F")
|
||||||
|
commands.add("/dev/null")
|
||||||
|
|
||||||
// port
|
// port
|
||||||
commands.add("-P")
|
commands.add("-P")
|
||||||
commands.add(host.port.toString())
|
commands.add(host.port.toString())
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ termora.doorman.mnemonic.incorrect=Incorrect mnemonic
|
|||||||
|
|
||||||
|
|
||||||
# Hosts
|
# Hosts
|
||||||
termora.host.verify-server-key=Host [{0}] key has been changed!<br/><br/>{1} key fingerprint is {2}<br/><br/>Are you sure you want to continue connecting?
|
termora.host.verify-server-key=Host [{0}] key has been changed<br/><br/>{1} key fingerprint is {2}<br/><br/>Are you sure you want to continue connecting?
|
||||||
termora.host.modified-server-key=HOST [{0}] IDENTIFICATION HAS CHANGED!<br/><br/>Expected: {1} key fingerprint is {2}<br/><br/>Actual: {3} key fingerprint is {4}<br/><br/>Are you sure you want to continue connecting?
|
termora.host.modified-server-key=HOST [{0}] IDENTIFICATION HAS CHANGED<br/><br/>Expected: {1} key fingerprint is {2}<br/><br/>Actual: {3} key fingerprint is {4}<br/><br/>Are you sure you want to continue connecting?
|
||||||
|
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ termora.doorman.mnemonic.incorrect=助记词错误
|
|||||||
|
|
||||||
|
|
||||||
# Hosts
|
# Hosts
|
||||||
termora.host.verify-server-key=主机 [{0}] 密钥已经改变!<br/><br/>{1} 的指纹 {2}<br/><br/>你确定要继续连接吗?
|
termora.host.verify-server-key=主机 [{0}] 密钥已经改变<br/><br/>{1} 的指纹 {2}<br/><br/>你确定要继续连接吗?
|
||||||
termora.host.modified-server-key=主机 [{0}] 身份已发生变化!<br/><br/>期待: {1} 的指纹 {2}<br/><br/>实际: {3} 的指纹 {4}<br/><br/>你确定要继续连接吗?
|
termora.host.modified-server-key=主机 [{0}] 身份已发生变化<br/><br/>期待: {1} 的指纹 {2}<br/><br/>实际: {3} 的指纹 {4}<br/><br/>你确定要继续连接吗?
|
||||||
|
|
||||||
|
|
||||||
termora.setting=设置
|
termora.setting=设置
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ termora.doorman.mnemonic.incorrect=助記詞錯誤
|
|||||||
|
|
||||||
|
|
||||||
# Hosts
|
# Hosts
|
||||||
termora.host.verify-server-key=主機 [{0}] 金鑰已經改變!<br/><br/>{1} 的指紋 {2}<br/><br/>你確定要繼續連線嗎?
|
termora.host.verify-server-key=主機 [{0}] 金鑰已經改變<br/><br/>{1} 的指紋 {2}<br/><br/>你確定要繼續連線嗎?
|
||||||
termora.host.modified-server-key=主機 [{0}] 身分已變更!<br/><br/>期待: {1} 的指紋 {2}<br/><br/>實際: {3} 的指紋 {4}<br/><br/>你確定要繼續連線嗎?
|
termora.host.modified-server-key=主機 [{0}] 身分已變更<br/><br/>期待: {1} 的指紋 {2}<br/><br/>實際: {3} 的指紋 {4}<br/><br/>你確定要繼續連線嗎?
|
||||||
|
|
||||||
|
|
||||||
termora.setting=設定
|
termora.setting=設定
|
||||||
|
|||||||
Reference in New Issue
Block a user