예제 #1
0
func (s *ServerController) SSHConnect(payload *colonycore.Server) (sshclient.SshSetting, *ssh.Client, error) {
	client := sshclient.SshSetting{}
	client.SSHHost = payload.Host

	if payload.SSHType == "File" {
		client.SSHAuthType = sshclient.SSHAuthType_Certificate
		client.SSHKeyLocation = payload.SSHFile
	} else {
		client.SSHAuthType = sshclient.SSHAuthType_Password
		client.SSHUser = payload.SSHUser
		client.SSHPassword = payload.SSHPass
	}

	theClient, err := client.Connect()

	return client, theClient, err
}
예제 #2
0
func (s *Server) Connect() (sshclient.SshSetting, *ssh.Client, error) {
	client := sshclient.SshSetting{}
	client.SSHHost = s.Host

	if s.SSHType == "File" {
		client.SSHAuthType = sshclient.SSHAuthType_Certificate
		client.SSHKeyLocation = s.SSHFile
	} else {
		client.SSHAuthType = sshclient.SSHAuthType_Password
		client.SSHUser = s.SSHUser
		client.SSHPassword = s.SSHPass
	}

	theClient, err := client.Connect()

	return client, theClient, err
}
예제 #3
0
func (s *ServerController) SSHConnect(payload *colonycore.Server) (sshclient.SshSetting, *ssh.Client, error) {
	client := sshclient.SshSetting{}
	client.SSHHost = "192.168.56.103:22"

	client.SSHAuthType = 0
	client.SSHUser = "******"
	client.SSHPassword = "******"

	//fmt.Println(client) {192.168.56.103:22 eaciit1 12345  0}

	theClient, err := client.Connect()

	return client, theClient, err
}