fleet/orbit/pkg/constant/constant_windows.go
Tomas Touceda 3ac8494d23 Add 'orbit/' from commit 'ab3047bb39f1e2be331d1ff18b4eb768619033c4'
git-subtree-dir: orbit
git-subtree-mainline: d5974aad97
git-subtree-split: ab3047bb39
2021-08-04 16:58:25 -03:00

35 lines
988 B
Go

//+build windows
package constant
import (
"github.com/pkg/errors"
"golang.org/x/sys/windows"
)
const (
PlatformName = "windows"
// DefaultExecutableMode is the default file mode to apply to created
// executable files. For Windows this doesn't do anything besides setting
// read-only. See https://golang.org/pkg/os/#Chmod.
DefaultExecutableMode = 0o700
)
var (
// These identifiers can be found in
// https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/security-identifiers-in-windows
// and are used in the same fashion as in osquery. See
// https://github.com/osquery/osquery/blob/d2be385d71f401c85872f00d479df8f499164c5a/tools/deployment/chocolatey/tools/osquery_utils.ps1.
SystemSID = mustSID("S-1-5-18")
AdminSID = mustSID("S-1-5-32-544")
UserSID = mustSID("S-1-5-32-545")
)
func mustSID(identifier string) *windows.SID {
sid, err := windows.StringToSid(identifier)
if err != nil {
panic(errors.Wrap(err, "create sid"))
}
return sid
}