From 8794f8a66aaf2a3bfaa0b56798cd26d6e5948282 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Wed, 7 Aug 2024 12:21:00 +0530 Subject: [PATCH] Rename GetRsaPrivateKeyPath to GetECDSAPrivateKeyPath for backward compatibility We were using RSA Algo long time ago and this function is used to provide a backward compatibility for that version of crc but since in previous commit we have updated the ssh algo from ecdsa to ed25519, to have the backward compatibility for some released version we are renaming this function. --- pkg/crc/constants/constants.go | 6 +++--- pkg/crc/machine/ip.go | 2 +- pkg/crc/machine/virtualmachine.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/crc/constants/constants.go b/pkg/crc/constants/constants.go index bc4c78056a..b65ac9d8a3 100644 --- a/pkg/crc/constants/constants.go +++ b/pkg/crc/constants/constants.go @@ -185,9 +185,9 @@ func GetHostDockerSocketPath() string { return filepath.Join(MachineInstanceDir, DefaultName, "docker.sock") } -// For backward compatibility to v 1.20.0 -func GetRsaPrivateKeyPath() string { - return filepath.Join(MachineInstanceDir, DefaultName, "id_rsa") +// For backward compatibility to v 2.40.0 +func GetECDSAPrivateKeyPath() string { + return filepath.Join(MachineInstanceDir, DefaultName, "id_ecdsa") } func GetKubeAdminPasswordPath() string { diff --git a/pkg/crc/machine/ip.go b/pkg/crc/machine/ip.go index 22ca8bbb19..f03b2a8d15 100644 --- a/pkg/crc/machine/ip.go +++ b/pkg/crc/machine/ip.go @@ -21,6 +21,6 @@ func (client *client) ConnectionDetails() (*types.ConnectionDetails, error) { IP: ip, SSHPort: vm.SSHPort(), SSHUsername: constants.DefaultSSHUser, - SSHKeys: []string{constants.GetPrivateKeyPath(), constants.GetRsaPrivateKeyPath(), vm.bundle.GetSSHKeyPath()}, + SSHKeys: []string{constants.GetPrivateKeyPath(), constants.GetECDSAPrivateKeyPath(), vm.bundle.GetSSHKeyPath()}, }, nil } diff --git a/pkg/crc/machine/virtualmachine.go b/pkg/crc/machine/virtualmachine.go index f8af367c55..ff9c89eae2 100644 --- a/pkg/crc/machine/virtualmachine.go +++ b/pkg/crc/machine/virtualmachine.go @@ -106,5 +106,5 @@ func (vm *virtualMachine) SSHRunner() (*ssh.Runner, error) { if err != nil { return nil, err } - return ssh.CreateRunner(ip, vm.SSHPort(), constants.GetPrivateKeyPath(), constants.GetRsaPrivateKeyPath(), vm.bundle.GetSSHKeyPath()) + return ssh.CreateRunner(ip, vm.SSHPort(), constants.GetPrivateKeyPath(), constants.GetECDSAPrivateKeyPath(), vm.bundle.GetSSHKeyPath()) }