Skip to content

Commit

Permalink
Merge pull request #30 from anjannath/sshkey_perm_win
Browse files Browse the repository at this point in the history
Fix ssh key permissions in windows
  • Loading branch information
praveenkumar authored Aug 27, 2020
2 parents 7d42fed + 7da9b61 commit 4f91040
Show file tree
Hide file tree
Showing 17 changed files with 736 additions and 0 deletions.
131 changes: 131 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@
[prune]
go-tests = true
unused-packages = true

[[constraint]]
branch = "master"
name = "github.com/hectane/go-acl"
14 changes: 14 additions & 0 deletions libmachine/ssh/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"runtime"

gossh "golang.org/x/crypto/ssh"
"github.com/hectane/go-acl"
)

var (
Expand Down Expand Up @@ -86,6 +87,10 @@ func (kp *KeyPair) WriteToFile(privateKeyPath string, publicKeyPath string) erro
if err := f.Chmod(0600); err != nil {
return err
}
case "windows":
if err = windowsChmod(v.File, 0600); err != nil {
return err
}
}
}

Expand Down Expand Up @@ -122,3 +127,12 @@ func GenerateSSHKey(path string) error {

return nil
}

// change windows acl based permissions on file
func windowsChmod(filePath string, fileMode os.FileMode) error {
if err := acl.Chmod(filePath, fileMode); err != nil {
return err
}
return nil
}

9 changes: 9 additions & 0 deletions vendor/github.com/hectane/go-acl/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions vendor/github.com/hectane/go-acl/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 98 additions & 0 deletions vendor/github.com/hectane/go-acl/api/acl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/hectane/go-acl/api/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/hectane/go-acl/api/posix.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4f91040

Please sign in to comment.