diff --git a/pkg/machines/ssh_endpoint.go b/pkg/machines/ssh_endpoint.go index b23a7238..4794a429 100644 --- a/pkg/machines/ssh_endpoint.go +++ b/pkg/machines/ssh_endpoint.go @@ -28,6 +28,7 @@ type SSHEndpoint struct { ProxyID string `json:"ProxyId,omitempty"` Port int URI *url.URL `json:"Uri"` + KeyAlgo string endpoint } @@ -62,6 +63,11 @@ func (s *SSHEndpoint) GetFingerprint() string { return s.Fingerprint } +// GetKeyAlgo returns the algorithm used with this SSH endpoints fingerprint +func (s *SSHEndpoint) GetKeyAlgo() string { + return s.KeyAlgo +} + // GetHost returns the host associated with this SSH endpoint. func (s *SSHEndpoint) GetHost() string { return s.Host @@ -82,6 +88,7 @@ func (s *SSHEndpoint) MarshalJSON() ([]byte, error) { Port int ProxyID string `json:"ProxyId,omitempty"` URI string `json:"Uri"` + KeyAlgo string resources.Resource }{ AccountID: s.AccountID, @@ -92,6 +99,7 @@ func (s *SSHEndpoint) MarshalJSON() ([]byte, error) { Port: s.Port, ProxyID: s.ProxyID, URI: s.URI.String(), + KeyAlgo: s.KeyAlgo, Resource: s.Resource, } diff --git a/pkg/machines/ssh_endpoint_test.go b/pkg/machines/ssh_endpoint_test.go index cfe4bddd..dc83eeb0 100644 --- a/pkg/machines/ssh_endpoint_test.go +++ b/pkg/machines/ssh_endpoint_test.go @@ -24,6 +24,7 @@ func CreateTestSSHEndpoint(t *testing.T) *SSHEndpoint { } proxyID := "proxy-id" port := 22 + keyalgo := "ssh-rsa" sshEndpoint := NewSSHEndpoint(host, port, fingerprint) require.NoError(t, sshEndpoint.Validate()) @@ -35,6 +36,7 @@ func CreateTestSSHEndpoint(t *testing.T) *SSHEndpoint { sshEndpoint.ModifiedOn = &lastModifiedOn sshEndpoint.Links = links sshEndpoint.ProxyID = proxyID + sshEndpoint.KeyAlgo = keyalgo require.NoError(t, sshEndpoint.Validate()) @@ -73,6 +75,7 @@ const sshEndpointAsJSON string = `{ "Host": "example.com", "Port": 22, "Fingerprint": "22:22:22:22:22:22:22:22:22:22:22:22:22:22:22", + "KeyAlgo": "ssh-rsa", "Uri": "ssh://example.com:22/", "ProxyId": "proxy-id", "DotNetCorePlatform": "linux-x64",