Add initial support for ssh config.

Related to smallstep/cli#170
This commit is contained in:
Mariano Cano 2019-10-03 19:03:38 -07:00 committed by max furman
parent 083e203c46
commit 7b8bb6deb4
9 changed files with 372 additions and 14 deletions

View file

@ -29,6 +29,7 @@ import (
"github.com/smallstep/certificates/authority"
"github.com/smallstep/certificates/authority/provisioner"
"github.com/smallstep/certificates/logging"
"github.com/smallstep/certificates/templates"
"github.com/smallstep/cli/crypto/tlsutil"
"github.com/smallstep/cli/jose"
"golang.org/x/crypto/ssh"
@ -513,6 +514,7 @@ type mockAuthority struct {
getRoots func() ([]*x509.Certificate, error)
getFederation func() ([]*x509.Certificate, error)
getSSHKeys func() (*authority.SSHKeys, error)
getSSHConfig func(typ string) ([]templates.Output, error)
}
// TODO: remove once Authorize is deprecated.
@ -625,6 +627,13 @@ func (m *mockAuthority) GetSSHKeys() (*authority.SSHKeys, error) {
return m.ret1.(*authority.SSHKeys), m.err
}
func (m *mockAuthority) GetSSHConfig(typ string) ([]templates.Output, error) {
if m.getSSHConfig != nil {
return m.getSSHConfig(typ)
}
return m.ret1.([]templates.Output), m.err
}
func Test_caHandler_Route(t *testing.T) {
type fields struct {
Authority Authority