fleet/orbit/pkg/constant/constant_windows.go
Lucas Manuel Rodriguez f4d3159cc9
Fleetctl to package .app bundles for osquery (and changes for orbit to support them) (#4393)
* WIP

* WIP2

* Fix orbit and fleetctl tests

* Amend macos-app default

* Add some fixes

* Use fleetctl updates roots command

* Add more fixes to Updater

* Fixes to app publishing and downloading

* Add more changes to support fleetctl cross generation

* Amend comment

* Add pkg generation to ease testing

* Make more fixes

* Add changes entry

* Add legacy targets (until our TUF system exposes the new app)

* Fix fleetctl preview

* Fix bool flag

* Fix orbit logic for disabled-updates and dev-mode

* Fix TestPreview

* Remove constant and fix zip-slip attack (codeql)

* Return unknown error

* Fix updater's checkExec

* Add support for executable signing in init_tuf.sh

* Try only signing orbit

* Fix init_tuf.sh targets, macos-app only for osqueryd

* Specify GOARCH to support M1s

* Add workflow to generate osqueryd.app.tar.gz

* Use 5.2.2 on init_tuf.sh

* Add unit test for tar.gz target

* Use artifacts instead of releases

* Remove copy paste residue

* Trigger workflow on PR

* Fixes to ease handling of artifact

* Fix, do not use target name as dir

* Remove workaround
2022-03-15 16:04:12 -03:00

35 lines
968 B
Go

//go:build windows
// +build windows
package constant
import (
"fmt"
"golang.org/x/sys/windows"
)
const (
// 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(fmt.Errorf("create sid: %w", err))
}
return sid
}