Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows friendly changes after walking through getting started guide #1441

Merged
merged 2 commits into from Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitattributes
Expand Up @@ -6,3 +6,8 @@
website/ linguist-vendored
website/* linguist-vendored
website/** linguist-vendored

# windows is funny about line endings see https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings for more details
# test TestCertificateChain in server/service/service_certificate_test.go was having issues on Windows
server/service/testdata/server.key text eol=lf
server/service/testdata/server.pem text eol=lf
2 changes: 1 addition & 1 deletion docs/3-Contributing/1-Building-Fleet.md
Expand Up @@ -41,7 +41,7 @@ sudo npm install -g yarn

To install dependecies, we recommend using [Chocolatey](https://chocolatey.org/install). Chocolatey must be run in Powershell as an Administrator. Assuming your setup does not include any of our requirements, please run:
```
choco install nodejs git golang docker make
choco install nodejs git golang docker make python2
edwardsb marked this conversation as resolved.
Show resolved Hide resolved
```

Note: all packages default to the latest versions. To specify a version, place `--version <version-number>` after each package. You may also install all packages manually from their websites if you prefer.
Expand Down
13 changes: 9 additions & 4 deletions server/config/config.go
Expand Up @@ -3,6 +3,7 @@ package config
import (
"fmt"
"os"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -334,9 +335,9 @@ func (man Manager) addConfigs() {
man.addConfigBool("pubsub.add_attributes", false, "Add PubSub attributes in addition to the message body")

// Filesystem
man.addConfigString("filesystem.status_log_file", "/tmp/osquery_status",
man.addConfigString("filesystem.status_log_file", fmt.Sprintf("%s%c%s", os.TempDir(), os.PathSeparator, "osquery_status"),
"Log file path to use for status logs")
man.addConfigString("filesystem.result_log_file", "/tmp/osquery_result",
man.addConfigString("filesystem.result_log_file", fmt.Sprintf("%s%c%s", os.TempDir(), os.PathSeparator, "osquery_result"),
edwardsb marked this conversation as resolved.
Show resolved Hide resolved
"Log file path to use for result logs")
man.addConfigBool("filesystem.enable_log_rotation", false,
"Enable automatic rotation for osquery log files")
Expand Down Expand Up @@ -659,6 +660,10 @@ func (man Manager) loadConfigFile() {
// TestConfig returns a barebones configuration suitable for use in tests.
// Individual tests may want to override some of the values provided.
func TestConfig() FleetConfig {
var testLogFile = "/dev/null"
if runtime.GOOS == "windows" {
testLogFile = "NUL"
}
return FleetConfig{
App: AppConfig{
TokenKeySize: 24,
Expand Down Expand Up @@ -686,8 +691,8 @@ func TestConfig() FleetConfig {
DisableBanner: true,
},
Filesystem: FilesystemConfig{
StatusLogFile: "/dev/null",
ResultLogFile: "/dev/null",
StatusLogFile: testLogFile,
ResultLogFile: testLogFile,
},
}
}