Skip to content

Commit

Permalink
Windows friendly changes after walking through getting started guide (#…
Browse files Browse the repository at this point in the history
…1441)

* update .gitattributes to be explicit about line endings with regards to the test certs
* update building-fleet guide to include python2 dependency on windows
* update configuration to default to OS specific temporary directories
  • Loading branch information
edwardsb authored Jul 22, 2021
1 parent 484c615 commit 799243f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
```

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
14 changes: 10 additions & 4 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package config
import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -334,9 +336,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", filepath.Join(os.TempDir(), "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", filepath.Join(os.TempDir(), "osquery_result"),
"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 +661,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 +692,8 @@ func TestConfig() FleetConfig {
DisableBanner: true,
},
Filesystem: FilesystemConfig{
StatusLogFile: "/dev/null",
ResultLogFile: "/dev/null",
StatusLogFile: testLogFile,
ResultLogFile: testLogFile,
},
}
}

0 comments on commit 799243f

Please sign in to comment.