cli icon indicating copy to clipboard operation
cli copied to clipboard

[Bug]: `step ssh config` with contexts adds snippet including the wrong file

Open cholyoak opened this issue 1 year ago • 2 comments

Steps to Reproduce

Run step ssh config to configure an SSH client. When the CA is configured without contexts it adds a snippet to ~/.ssh/config:

Host *
  Include "$HOME/.step/ssh/includes"

and then creates this file at $HOME/.step/ssh/includes. But when the CA is configured with a context the snippet is the same, but the file actually created is at $HOME/.step/authorities/<ca>/ssh/config.

The snippet template (unchanged from the default) includes:

Include "{{.User.StepPath}}/ssh/config"

When using contexts the .User.StepPath ought to be updated to the correct file path, or other relevant variables be made to the templates so they can insert the right value.

Your Environment

  • OS - Linux (Debian Bullseye)
  • step CLI Version - 0.24.4

Expected Behavior

The snippet in $HOME/.step/ssh/includes should include the authority relevant path when using contexts, like:

Include "$HOME/.step/authorities/<ca name>/ssh/config"

Actual Behavior

The snippet in $HOME/.step/ssh/includes includes the standard path, like:

Include "$HOME/.step/ssh/config"

Additional Context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

cholyoak avatar Jul 25 '23 04:07 cholyoak