@@ -3,7 +3,6 @@ package sshd
33import (
44 "fmt"
55 "io/ioutil"
6- "os/exec"
76
87 "golang.org/x/crypto/ssh"
98
@@ -31,7 +30,7 @@ const (
3130func ParseHostKeys (c cookoo.Context , p * cookoo.Params ) (interface {}, cookoo.Interrupt ) {
3231 log .Debugf (c , "Parsing ssh host keys" )
3332 hostKeyTypes := p .Get ("keytypes" , []string {"rsa" , "dsa" , "ecdsa" }).([]string )
34- pathTpl := p .Get ("path" , "/etc/ ssh/ssh_host_%s_key " ).(string )
33+ pathTpl := p .Get ("path" , "/var/run/secrets/deis/builder/ ssh/ssh-host-%s-key " ).(string )
3534 hostKeys := make ([]ssh.Signer , 0 , len (hostKeyTypes ))
3635 for _ , t := range hostKeyTypes {
3736 path := fmt .Sprintf (pathTpl , t )
@@ -45,17 +44,6 @@ func ParseHostKeys(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Inte
4544 }
4645 }
4746 }
48- if c .Get ("enableV1" , false ).(bool ) {
49- path := "/etc/ssh/ssh_host_key"
50- if key , err := ioutil .ReadFile (path ); err != nil {
51- log .Errf (c , "Failed to read ssh_host_key" )
52- } else if hk , err := ssh .ParsePrivateKey (key ); err == nil {
53- log .Infof (c , "Parsed host key %s." , path )
54- hostKeys = append (hostKeys , hk )
55- } else {
56- log .Errf (c , "Failed to parse host key %s: %s" , path , err )
57- }
58- }
5947 return hostKeys , nil
6048}
6149
@@ -115,15 +103,3 @@ func Configure(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrup
115103
116104 return cfg , nil
117105}
118-
119- // GenSSHKeys generates the default set of SSH host keys.
120- func GenSSHKeys (c cookoo.Context , p * cookoo.Params ) (interface {}, cookoo.Interrupt ) {
121- log .Debugf (c , "Generating ssh keys for sshd" )
122- // Generate a new key
123- out , err := exec .Command ("ssh-keygen" , "-A" ).CombinedOutput ()
124- if err != nil {
125- log .Infof (c , "ssh-keygen: %s" , out )
126- return nil , err
127- }
128- return nil , nil
129- }
0 commit comments