Skip to content

Add ED25519 SSH key algorithm support to CLI #396

Description

@deamwork

Problem

The Infisical backend server supports issuing SSH credentials with ED25519 key algorithm, but the CLI cannot utilize this feature because:

  1. The underlying go-sdk doesn't define the ED25519 constant
  2. The CLI's algoToFileName map doesn't have an ED25519 mapping
  3. The error message tells users that valid values are only: RSA_2048, RSA_4096, EC_prime256v1, EC_secp384r1

This prevents users from accessing the modern ED25519 key type via the CLI, even though the backend supports it.

Root Cause

The CLI inherits its limitations from the go-sdk. The go-sdk needs to add ED25519 support first, then the CLI must:

  1. Update the algoToFileName map to include ED25519
  2. Update the error message validation text

ref: Infisical/go-sdk#77

Evidence

Backend supports ED25519 as default:
https://github.com/Infisical/infisical/blob/fc5d42baf0259fd205f5ba8ae69a667c3406c40a/backend/src/ee/routes/v1/ssh-certificate-router.ts#L117

CLI missing ED25519 mapping:
https://github.com/Infisical/cli/blob/main/packages/cmd/ssh.go#L65-L70

var algoToFileName = map[infisicalSdkUtil.CertKeyAlgorithm]string{
	infisicalSdkUtil.RSA2048:   "id_rsa_2048",
	infisicalSdkUtil.RSA4096:   "id_rsa_4096",
	infisicalSdkUtil.ECDSAP256: "id_ecdsa_p256",
	infisicalSdkUtil.ECDSAP384: "id_ecdsa_p384",
	// Missing: ED25519
}

Error message needs update:
https://github.com/Infisical/cli/blob/main/packages/cmd/ssh.go#L221-L224

util.HandleError(fmt.Errorf("invalid keyAlgorithm: %s", keyAlgorithm),
	"Valid values: RSA_2048, RSA_4096, EC_prime256v1, EC_secp384r1")

Possible solution

  1. Wait for go-sdk PR to merge (adds ED25519 constant)
  2. Update algoToFileName map in cli/packages/cmd/ssh.go to include ED25519:
    var algoToFileName = map[infisicalSdkUtil.CertKeyAlgorithm]string{
        infisicalSdkUtil.RSA2048:   "id_rsa_2048",
        infisicalSdkUtil.RSA4096:   "id_rsa_4096",
        infisicalSdkUtil.ECDSAP256: "id_ecdsa_p256",
        infisicalSdkUtil.ECDSAP384: "id_ecdsa_p384",
        infisicalSdkUtil.ED25519:   "id_ed25519",
    }
  3. Update the error message to include ED25519

Expected Behavior

Users should be able to run:

infisical ssh issue-credentials \
  --certificateTemplateId <template-id> \
  --principals <username> \
  --keyAlgorithm ED25519 \
  --outFilePath ~/.ssh/

And successfully receive ED25519-based SSH credentials.

  • algoToFileName map includes ED25519 → "id_ed25519" mapping
  • Error validation message includes ED25519 as a valid option
  • CLI can issue SSH credentials with ED25519 key algorithm
  • Generated key file is named id_ed25519
  • Change is backward compatible

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions