Install the windows service as "NT AUTHORITY\NetworkService"

Untested

Maybe
Fixes #686
This commit is contained in:
Frank Denis 2019-01-10 22:43:43 +01:00
parent b886585486
commit 17db0a658f
4 changed files with 16 additions and 0 deletions

View File

@ -35,6 +35,9 @@ func main() {
Description: "Encrypted/authenticated DNS proxy",
WorkingDirectory: pwd,
}
if serviceUserName := serviceStartupUserName(); serviceUserName != nil {
svcConfig.UserName = *serviceUserName
}
svcFlag := flag.String("service", "", fmt.Sprintf("Control the system service: %q", service.ControlAction))
app := &App{}
svc, err := service.New(app, svcConfig)

View File

@ -12,6 +12,10 @@ import (
"github.com/jedisct1/dlog"
)
func serviceStartupUserName() *string {
return nil
}
func (proxy *Proxy) dropPrivilege(userStr string, fds []*os.File) {
currentUser, err := user.Current()
if err != nil && currentUser.Uid != "0" {

View File

@ -14,6 +14,10 @@ import (
"github.com/jedisct1/dlog"
)
func serviceStartupUserName() *string {
return nil
}
func (proxy *Proxy) dropPrivilege(userStr string, fds []*os.File) {
currentUser, err := user.Current()
if err != nil && currentUser.Uid != "0" {

View File

@ -2,4 +2,9 @@ package main
import "os"
func serviceStartupUserName() *string {
userName := "NT AUTHORITY\\NetworkService"
return &userName
}
func (proxy *Proxy) dropPrivilege(userStr string, fds []*os.File) {}