ConSol-Monitoring / snclient

SNClient+ - Cross platform monitoring agent
MIT License
48 stars 9 forks source link

Admin permissions to check service state #32

Closed h4ppywastaken closed 10 months ago

h4ppywastaken commented 1 year ago

Currently the logon account for the snClient service has to be in the administrator group in order to check a Windows service state. This is due to golang requesting "SC_MANAGER_ALL_ACCESS" when opening the service control manager: https://cs.opensource.google/go/x/sys/+/refs/tags/v0.10.0:windows/svc/mgr/mgr.go h, err := windows.OpenSCManager(s, nil, windows.SC_MANAGER_ALL_ACCESS)

I have found this here: https://github.com/winlabs/gowin32/blob/0d265587d3c90d3dca04c4927c845b5334ade86f/service.go#L394 ...which apparently allows to read service state with less properties and should be sufficient for monitoring.

There is also an issue open with golang about this: https://github.com/golang/go/issues/51465

ArisNeander commented 10 months ago

I have a patch that might solve this issue: https://github.com/ConSol-Monitoring/snclient/pull/55

sni commented 10 months ago

should be better with the next release.