fix linting errors
parent
ce17200bd8
commit
a8463f3453
|
@ -17,10 +17,10 @@ limitations under the License.
|
|||
package kic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"os/exec"
|
||||
"context"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -215,20 +215,20 @@ func (d *Driver) prepareSSH() error {
|
|||
klog.Infof("ensuring only current user has permissions to key file located at : %s...", keyPath)
|
||||
|
||||
// Get the SID of the current user
|
||||
currentUserSidCmd := exec.CommandContext(ctx, path, "-NoProfile","-NonInteractive","([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value")
|
||||
currentUserSidCmd := exec.CommandContext(ctx, path, "-NoProfile", "-NonInteractive", "([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value")
|
||||
currentUserSidOut, currentUserSidErr := currentUserSidCmd.CombinedOutput()
|
||||
if currentUserSidErr != nil {
|
||||
klog.Warningf("unable to determine current user's SID. minikube tunnel may not work.")
|
||||
} else {
|
||||
icaclsArguments := fmt.Sprintf(`"%s" /grant:r *%s:F /inheritancelevel:r`, keyPath, strings.TrimSpace(string(currentUserSidOut)))
|
||||
icaclsCmd := exec.CommandContext(ctx, path, "-NoProfile","-NonInteractive","icacls.exe", icaclsArguments)
|
||||
icaclsCmd := exec.CommandContext(ctx, path, "-NoProfile", "-NonInteractive", "icacls.exe", icaclsArguments)
|
||||
icaclsCmdOut, icaclsCmdErr := icaclsCmd.CombinedOutput()
|
||||
|
||||
if icaclsCmdErr != nil {
|
||||
return errors.Wrap(icaclsCmdErr, "unable to execute icacls to set permissions")
|
||||
}
|
||||
|
||||
if !strings.Contains(string(icaclsCmdOut),"Successfully processed 1 files; Failed processing 0 files") {
|
||||
if !strings.Contains(string(icaclsCmdOut), "Successfully processed 1 files; Failed processing 0 files") {
|
||||
klog.Errorf("icacls failed applying permissions - err - [%s], output - [%s]", icaclsCmdErr, strings.TrimSpace(string(icaclsCmdOut)))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue