示例#1
0
文件: registry.go 项目: tob1k/deisctl
func getChecker() *ssh.HostKeyChecker {
	if !Flags.StrictHostKeyChecking {
		return nil
	}
	keyFile := ssh.NewHostKeyFile(Flags.KnownHostsFile)
	return ssh.NewHostKeyChecker(keyFile)
}
示例#2
0
文件: fleetctl.go 项目: rswart/fleet
// getChecker creates and returns a HostKeyChecker, or nil if any error is encountered
func getChecker() *ssh.HostKeyChecker {
	if !globalFlags.StrictHostKeyChecking {
		return nil
	}

	keyFile := ssh.NewHostKeyFile(globalFlags.KnownHostsFile)
	return ssh.NewHostKeyChecker(keyFile, askToTrustHost, nil)
}
示例#3
0
文件: fleet.go 项目: pulcy/j2
// getChecker creates and returns a HostKeyChecker, or nil if any error is encountered
func getChecker(config FleetConfig) *ssh.HostKeyChecker {
	if !config.StrictHostKeyChecking {
		return nil
	}

	keyFile := ssh.NewHostKeyFile(config.KnownHostsFile)
	return ssh.NewHostKeyChecker(keyFile)
}
示例#4
0
文件: cmd.go 项目: nullstyle/fleet
func getChecker() *ssh.HostKeyChecker {
	if !(*flagset.Lookup("strict-host-key-checking")).Value.(flag.Getter).Get().(bool) {
		return nil
	}

	knownHostsFile := (*flagset.Lookup("known-hosts-file")).Value.(flag.Getter).Get().(string)
	keyFile := ssh.NewHostKeyFile(knownHostsFile)
	return ssh.NewHostKeyChecker(keyFile, askToTrustHost, nil)
}
示例#5
0
文件: fleetctl.go 项目: pulcy/j2
// getChecker creates and returns a HostKeyChecker, or nil if any error is encountered
func getChecker(cCmd *cobra.Command) *ssh.HostKeyChecker {
	strictHostKeyChecking, _ := cmdFleet.PersistentFlags().GetBool("strict-host-key-checking")
	if !strictHostKeyChecking {
		return nil
	}

	knownHostsFile, _ := cmdFleet.PersistentFlags().GetString("known-hosts-file")
	keyFile := ssh.NewHostKeyFile(knownHostsFile)
	return ssh.NewHostKeyChecker(keyFile)
}