mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-08 06:29:08 +02:00
Add elevation for dangerous ssh flags
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
//go:build windows
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// isProcessPrivileged reports whether the current process token is elevated
|
||||
// (running as administrator / LocalSystem).
|
||||
func isProcessPrivileged() bool {
|
||||
return windows.GetCurrentProcessToken().IsElevated()
|
||||
}
|
||||
|
||||
// runElevated should re-run exe with args elevated via a UAC prompt
|
||||
// (ShellExecuteEx with the "runas" verb).
|
||||
//
|
||||
// TODO(ssh-elevation): implement ShellExecuteEx("runas") + wait for the child.
|
||||
func runElevated(_ string, _ []string) error {
|
||||
return fmt.Errorf("automatic privilege elevation is not yet implemented on Windows, re-run netbird as administrator")
|
||||
}
|
||||
Reference in New Issue
Block a user