mirror of https://github.com/docker/cli.git
Merge pull request #1971 from thaJeztah/18.09_backport_skip_windows_permissions_check
[18.09 backport] Windows: skip permissions check on key
This commit is contained in:
commit
1de93b845b
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/docker/cli/cli"
|
"github.com/docker/cli/cli"
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
|
@ -69,12 +70,14 @@ func loadPrivKey(streams command.Streams, keyPath string, options keyLoadOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPrivKeyBytesFromPath(keyPath string) ([]byte, error) {
|
func getPrivKeyBytesFromPath(keyPath string) ([]byte, error) {
|
||||||
fileInfo, err := os.Stat(keyPath)
|
if runtime.GOOS != "windows" {
|
||||||
if err != nil {
|
fileInfo, err := os.Stat(keyPath)
|
||||||
return nil, err
|
if err != nil {
|
||||||
}
|
return nil, err
|
||||||
if fileInfo.Mode()&nonOwnerReadWriteMask != 0 {
|
}
|
||||||
return nil, fmt.Errorf("private key file %s must not be readable or writable by others", keyPath)
|
if fileInfo.Mode()&nonOwnerReadWriteMask != 0 {
|
||||||
|
return nil, fmt.Errorf("private key file %s must not be readable or writable by others", keyPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
from, err := os.OpenFile(keyPath, os.O_RDONLY, notary.PrivExecPerms)
|
from, err := os.OpenFile(keyPath, os.O_RDONLY, notary.PrivExecPerms)
|
||||||
|
|
Loading…
Reference in New Issue