Skip to content

Commit

Permalink
Merge pull request #1291 from 24sama/master
Browse files Browse the repository at this point in the history
fix: all-in-one mode generate rsa-sha2-512 signature key
  • Loading branch information
ks-ci-bot authored May 23, 2022
2 parents 16e9181 + 35cc1ef commit 8b14d16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/common/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (d *DefaultLoader) Load() (*kubekeyapiv1alpha2.Cluster, error) {
}

allInOne := kubekeyapiv1alpha2.Cluster{}
if output, err := exec.Command("/bin/sh", "-c", "if [ ! -f \"$HOME/.ssh/id_rsa\" ]; then ssh-keygen -t rsa -P \"\" -f $HOME/.ssh/id_rsa && ls $HOME/.ssh;fi;").CombinedOutput(); err != nil {
if output, err := exec.Command("/bin/sh", "-c", "if [ ! -f \"$HOME/.ssh/id_rsa\" ]; then ssh-keygen -t rsa-sha2-512 -P \"\" -f $HOME/.ssh/id_rsa && ls $HOME/.ssh;fi;").CombinedOutput(); err != nil {
return nil, errors.New(fmt.Sprintf("Failed to generate public key: %v\n%s", err, string(output)))
}
if output, err := exec.Command("/bin/sh", "-c", "echo \"\n$(cat $HOME/.ssh/id_rsa.pub)\" >> $HOME/.ssh/authorized_keys && awk ' !x[$0]++{print > \"'$HOME'/.ssh/authorized_keys\"}' $HOME/.ssh/authorized_keys").CombinedOutput(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/local_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewLocalRuntime(debug, ingoreErr bool) (LocalRuntime, error) {
return localRuntime, fmt.Errorf("current user is %s. Please use root", u.Username)
}

if output, err := exec.Command("/bin/sh", "-c", "if [ ! -f \"$HOME/.ssh/id_rsa\" ]; then ssh-keygen -t rsa -P \"\" -f $HOME/.ssh/id_rsa && ls $HOME/.ssh;fi;").CombinedOutput(); err != nil {
if output, err := exec.Command("/bin/sh", "-c", "if [ ! -f \"$HOME/.ssh/id_rsa\" ]; then ssh-keygen -t rsa-sha2-512 -P \"\" -f $HOME/.ssh/id_rsa && ls $HOME/.ssh;fi;").CombinedOutput(); err != nil {
return localRuntime, errors.New(fmt.Sprintf("Failed to generate public key: %v\n%s", err, string(output)))
}
if output, err := exec.Command("/bin/sh", "-c", "echo \"\n$(cat $HOME/.ssh/id_rsa.pub)\" >> $HOME/.ssh/authorized_keys && awk ' !x[$0]++{print > \"'$HOME'/.ssh/authorized_keys\"}' $HOME/.ssh/authorized_keys").CombinedOutput(); err != nil {
Expand Down

0 comments on commit 8b14d16

Please sign in to comment.