Skip to content

Commit aea2a7c

Browse files
committed
Update sshd_config.tpl to a Match all block.
Fixes smallstep#479
1 parent 7d119c2 commit aea2a7c

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

authority/ssh_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ func TestAuthority_GetSSHConfig(t *testing.T) {
450450
{Name: "config.tpl", Type: templates.File, Comment: "#", Path: "ssh/config", Content: []byte("Match exec \"step ssh check-host %h\"\n\tUserKnownHostsFile /home/user/.step/ssh/known_hosts\n\tProxyCommand step ssh proxycommand %r %h %p\n")},
451451
}
452452
hostOutputWithUserData := []templates.Output{
453-
{Name: "sshd_config.tpl", Type: templates.File, Comment: "#", Path: "/etc/ssh/sshd_config", Content: []byte("TrustedUserCAKeys /etc/ssh/ca.pub\nHostCertificate /etc/ssh/ssh_host_ecdsa_key-cert.pub\nHostKey /etc/ssh/ssh_host_ecdsa_key")},
453+
{Name: "sshd_config.tpl", Type: templates.File, Comment: "#", Path: "/etc/ssh/sshd_config", Content: []byte("Match all\n\tTrustedUserCAKeys /etc/ssh/ca.pub\n\tHostCertificate /etc/ssh/ssh_host_ecdsa_key-cert.pub\n\tHostKey /etc/ssh/ssh_host_ecdsa_key")},
454454
}
455455

456456
tmplConfigErr := &templates.Templates{
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
TrustedUserCAKeys /etc/ssh/ca.pub
2-
HostCertificate /etc/ssh/{{.User.Certificate}}
3-
HostKey /etc/ssh/{{.User.Key}}
1+
Match all
2+
TrustedUserCAKeys /etc/ssh/ca.pub
3+
HostCertificate /etc/ssh/{{.User.Certificate}}
4+
HostKey /etc/ssh/{{.User.Key}}

templates/values.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ var DefaultSSHTemplateData = map[string]string{
9999
`,
100100

101101
// sshd_config.tpl adds the configuration to support certificates
102-
"sshd_config.tpl": `TrustedUserCAKeys /etc/ssh/ca.pub
103-
HostCertificate /etc/ssh/{{.User.Certificate}}
104-
HostKey /etc/ssh/{{.User.Key}}`,
102+
"sshd_config.tpl": `Match all
103+
TrustedUserCAKeys /etc/ssh/ca.pub
104+
HostCertificate /etc/ssh/{{.User.Certificate}}
105+
HostKey /etc/ssh/{{.User.Key}}`,
105106

106107
// ca.tpl contains the public key used to authorized clients
107108
"ca.tpl": `{{.Step.SSH.UserKey.Type}} {{.Step.SSH.UserKey.Marshal | toString | b64enc}}

0 commit comments

Comments
 (0)