Skip to content

Commit

Permalink
chore: allow set security descriptor of namedpipe by environment vari…
Browse files Browse the repository at this point in the history
…able `LISTEN_NAMEDPIPE_SDDL`
  • Loading branch information
wwqgtxx committed Sep 27, 2024
1 parent cd2d1c6 commit 2afa279
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion adapter/inbound/listen_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package inbound

import (
"net"
"os"

"github.com/metacubex/wireguard-go/ipc/namedpipe"
"golang.org/x/sys/windows"
Expand All @@ -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
}
Expand Down

0 comments on commit 2afa279

Please sign in to comment.