Add elevation for dangerous ssh flags

This commit is contained in:
Theodor S. Midtlien
2026-07-24 21:30:10 +02:00
parent 0bb73b3730
commit cd98648a67
11 changed files with 383 additions and 5 deletions
+23
View File
@@ -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")
}