From 507be61e8ca1971231ee7df059f500cf6c41c9b3 Mon Sep 17 00:00:00 2001 From: max furman Date: Sat, 13 Nov 2021 14:22:23 -0800 Subject: [PATCH] Use a more distint map key to indicate template version - make the key a variable that can be reused on the CLI side. --- authority/ssh.go | 2 +- templates/values.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/authority/ssh.go b/authority/ssh.go index da93acaf..d5d6ce45 100644 --- a/authority/ssh.go +++ b/authority/ssh.go @@ -103,7 +103,7 @@ func (a *Authority) GetSSHConfig(ctx context.Context, typ string, data map[strin } // Backwards compatibility for version of the cli older than v0.18.0 - if o.Name == "step_includes.tpl" && (data == nil || data["Version"] != "v2") { + if o.Name == "step_includes.tpl" && (data == nil || data[templates.SSHTemplateVersionKey] != "v2") { o.Type = templates.File o.Path = strings.TrimPrefix(o.Path, "${STEPPATH}/") } diff --git a/templates/values.go b/templates/values.go index 3cace69d..c3362527 100644 --- a/templates/values.go +++ b/templates/values.go @@ -4,6 +4,10 @@ import ( "golang.org/x/crypto/ssh" ) +// SSHTemplateVersionKey is a key that can be submitted by a client to select +// the template version that will be returned by the server. +var SSHTemplateVersionKey = "StepSSHTemplateVersion" + // Step represents the default variables available in the CA. type Step struct { SSH StepSSH