host download tokens

This commit is contained in:
Mikaël Cluseau
2023-02-13 15:57:30 +01:00
parent 1e3ac9a0fb
commit bde41c9859
6 changed files with 117 additions and 39 deletions

View File

@ -133,33 +133,6 @@ func templateFuncs(sslCfg *cfsslconfig.Config) map[string]any {
},
})
},
"ssh_host_keys": func(dir, cluster, host string) (s string, err error) {
pairs, err := getSSHKeyPairs(host)
if err != nil {
return
}
files := make([]config.FileDef, 0, len(pairs)*2)
for _, pair := range pairs {
basePath := path.Join(dir, "ssh_host_"+pair.Type+"_key")
files = append(files, []config.FileDef{
{
Path: basePath,
Mode: 0600,
Content: pair.Private,
},
{
Path: basePath + ".pub",
Mode: 0644,
Content: pair.Public,
},
}...)
}
return asYaml(files)
},
}
}