gopli icon indicating copy to clipboard operation
gopli copied to clipboard

panic: Failed to create fetcher instance: ssh: must specify HostKeyCallback

Open ed9 opened this issue 9 years ago • 0 comments

Was using with Amazon EC2 instances you get this thrown back at you. I have strict host checking enabled.

ed$ gopli sync -from myfrom -to myto -c configuration.toml 
2017/04/05 19:01:57 [Setting] loading toml configuration...
2017/04/05 19:01:57 [Setting] loaded toml configuration
panic: Failed to create fetcher instance: ssh: must specify HostKeyCallback

goroutine 1 [running]:
github.com/timakin/gopli/command.CmdSync(0xc4200aa140)
	/src/github.com/timakin/gopli/command/sync.go:21 +0x74f
github.com/codegangsta/cli.HandleAction(0x127e2c0, 0x12ebfa0, 0xc4200aa140, 0xc420074300, 0x0)
	/src/github.com/codegangsta/cli/app.go:487 +0x7c
github.com/codegangsta/cli.Command.Run(0x12dcdc4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/src/github.com/codegangsta/cli/command.go:207 +0xb72
github.com/codegangsta/cli.(*App).Run(0xc42009c4e0, 0xc420010080, 0x8, 0x8, 0x0, 0x0)
	/src/github.com/codegangsta/cli/app.go:250 +0x7d0
main.main()
	/src/github.com/timakin/gopli/main.go:22 +0x1ac

config file if needed

[database]
	[database.myfrom]
		host = "****"
		management_system = "mysql"
		name = "****"
		user = "****"
		password = "****"
        
	[database.myto]
		host = "****"
		management_system = "mysql"
		name = "****"
		user = "****"
		password = "****"

[ssh]
	[ssh.myfrom]
		host = "*ec2ipaddress*"
		port = "****"
		user = "****"
		key = "****"

	[ssh.myto]
		host = "*ec2ipaddress*"
		port = "****"
		user = "****"
		key = "****"

Trying to read trough your code to see if there's any way around this or maybe I can fix this myself, if anything comes up will report.

Seems like - if you edit your database.go file and add function

func HostKeyCallback(hostname string, remote net.Addr, key ssh.PublicKey) error {
	
	return nil
}

obviously have to put the contents that verify the hostname

and then in your "generateSSHSign" where you specify the "config" variable you also add a key of "HostKeyCallback" pointing to that function it should all work

ed9 avatar Apr 05 '17 12:04 ed9