Skip to content

Commit cff2274

Browse files
committed
update
1 parent 1b4de0c commit cff2274

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

connect.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func (c *Connect) CreateClient(host, port, user string, authMethods []ssh.AuthMe
139139
// append default files
140140
c.KnownHostsFiles = append(c.KnownHostsFiles, "~/.ssh/known_hosts")
141141
}
142-
config.HostKeyCallback = c.verifyAndAppendNew
142+
config.HostKeyCallback = c.VerifyAndAppendNew
143143
} else {
144144
config.HostKeyCallback = ssh.InsecureIgnoreHostKey()
145145
}

knownhosts.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ type OverwriteInventory struct {
3636
// If is no problem, error returns Nil.
3737
//
3838
// 【参考】: https://github.com/tatsushid/minssh/blob/57eae8c5bcf5d94639891f3267f05251f05face4/pkg/minssh/minssh.go#L190-L237
39-
func (c *Connect) verifyAndAppendNew(hostname string, remote net.Addr, key ssh.PublicKey) (err error) {
39+
func (c *Connect) VerifyAndAppendNew(hostname string, remote net.Addr, key ssh.PublicKey) (err error) {
4040
// set TextAskWriteKnownHosts default text
4141
if len(c.TextAskWriteKnownHosts) == 0 {
4242
c.TextAskWriteKnownHosts += "The authenticity of host '{{.Address}} ({{.RemoteAddr}})' can't be established.\n"
4343
c.TextAskWriteKnownHosts += "RSA key fingerprint is {{.Fingerprint}}\n"
44-
c.TextAskWriteKnownHosts += "Are you sure you want to continue connecting (yes/no)?"
44+
c.TextAskWriteKnownHosts += "Are you sure you want to continue connecting (yes/no)? "
4545
}
4646

4747
// set TextAskOverwriteKnownHosts default text
4848
if len(c.TextAskOverwriteKnownHosts) == 0 {
4949
c.TextAskOverwriteKnownHosts += "The authenticity of host '{{.Address}} ({{.RemoteAddr}})' can't be established.\n"
5050
c.TextAskOverwriteKnownHosts += "Old key: {{.OldKeyText}}\n"
51-
c.TextAskOverwriteKnownHosts += "Are you sure you want to overwrite {{.Fingerprint}}, continue connecting (yes/no)?"
51+
c.TextAskOverwriteKnownHosts += "Are you sure you want to overwrite {{.Fingerprint}}, continue connecting (yes/no)? "
5252
}
5353

5454
// check count KnownHostsFiles

0 commit comments

Comments
 (0)