From 2afa2798b176f079fe44ef659f11f21559c9bf91 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Fri, 27 Sep 2024 18:31:50 +0800 Subject: [PATCH] chore: allow set security descriptor of namedpipe by environment variable `LISTEN_NAMEDPIPE_SDDL` --- adapter/inbound/listen_windows.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/adapter/inbound/listen_windows.go b/adapter/inbound/listen_windows.go index 0dc8e8ca..d19239da 100644 --- a/adapter/inbound/listen_windows.go +++ b/adapter/inbound/listen_windows.go @@ -2,6 +2,7 @@ package inbound import ( "net" + "os" "github.com/metacubex/wireguard-go/ipc/namedpipe" "golang.org/x/sys/windows" @@ -14,7 +15,11 @@ const SupportNamedPipe = true const windowsSDDL = "D:PAI(A;OICI;GWGR;;;BU)(A;OICI;GWGR;;;SY)" func ListenNamedPipe(path string) (net.Listener, error) { - securityDescriptor, err := windows.SecurityDescriptorFromString(windowsSDDL) + sddl := os.Getenv("LISTEN_NAMEDPIPE_SDDL") + if sddl == "" { + sddl = windowsSDDL + } + securityDescriptor, err := windows.SecurityDescriptorFromString(sddl) if err != nil { return nil, err }