Commit Graph

1346 Commits

Author SHA1 Message Date
Michal Nicpon
10b3179b63
Add fleetctl generate mdm-apple (#8812) 2022-12-07 18:24:42 +01:00
Martin Angers
d4a3730610
Add new configuration options for Apple Business Manager (#8886) 2022-12-06 15:50:56 -05:00
gillespi314
43b1241a0c
Add fleetctl trigger command (#8877) 2022-12-06 09:56:54 -06:00
Frank Sievertsen
e0766d21a3
Add ability to mark policy as critical. (#8896) 2022-12-06 15:59:20 +01:00
gillespi314
6fb3a87ae9
Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
Martin Angers
866829dbfa
Implement fleetctl get mdm-apple (#8786) 2022-12-05 11:35:45 -05:00
Martin Angers
f5fc316ad3
Add options for configuring APNS and SCEP keys/certs in Fleet server (#8730) 2022-12-05 10:22:56 -05:00
Roberto Dip
f52e294718
try using DATE_ADD in test to ensure the timestamp is handled correctly (#8915)
rel:  https://github.com/fleetdm/fleet/issues/8768 thanks to @gillespi314 for the idea, the test consistently fails with:

```
 === RUN   TestHosts/TestHostOrder
    hosts_test.go:5392: 
        	Error Trace:	/home/runner/work/fleet/fleet/server/datastore/mysql/hosts_test.go:5392
        	            				/home/runner/work/fleet/fleet/server/datastore/mysql/hosts_test.go:5416
        	            				/home/runner/work/fleet/fleet/server/datastore/mysql/hosts_test.go:139
        	Error:      	"[]" should have 3 item(s), but has 0
        	Test:       	TestHosts/TestHostOrder
```

and the relevant code around line `5416`:

```go
	_, err = ds.writer.Exec(`UPDATE hosts SET created_at = created_at + id`)
	require.NoError(t, err)

	hosts, err = ds.ListHosts(ctx, fleet.TeamFilter{User: test.UserAdmin}, fleet.HostListOptions{
		ListOptions: fleet.ListOptions{
			OrderKey:       "created_at",
			After:          "2010-10-22T20:22:03Z",
			OrderDirection: fleet.OrderAscending,
		},
	})
	require.NoError(t, err)
	chk(hosts, "0001", "0004", "0003")
```

This PR changes it to be `UPDATE hosts SET created_at = DATE_ADD(created_at, INTERVAL id DAY)` instead, which seems to fix the issue (so far 3 runs without issues)
2022-12-02 17:25:12 -03:00
Roberto Dip
837fef4bc4
ensure we provide a future date in MSRC test (#8897)
This test was failing in Dec 2022, because in this line:

```go
_, err := sut.GetFeed((now.AddDate(0, 1, 0)).Month(), now.Year())
```

`(now.AddDate(0, 1, 0)).Month()` returns `"January"` , and `now.Year()` returns `2022` , so we were sending a date in the past.
2022-12-01 11:29:07 -03:00
gillespi314
49f7180a14
Use POST instead of GET for trigger endpoint (#8888) 2022-11-30 11:57:42 -06:00
Artemis Tosini
486590186a
orbit: Correctly handle errors in authenticatedRequest. Fixes #8472 (#8860) 2022-11-29 11:54:36 -05:00
gillespi314
d5c096fa02
Implement schedule triggers (#8747) 2022-11-28 13:28:06 -06:00
Frank Sievertsen
8fc32acf00
Store details (query_name and query_sql) about live query in activity feed (#8842) 2022-11-28 16:42:32 +01:00
gillespi314
4a73d4a887
Adjust flaky tests (#8811) 2022-11-25 12:09:55 -06:00
Tomas Touceda
fe1fa4d78c
Clone AppConfig and ScheduledQuery list by hand to improve CPU usage (#8794)
* Close AppConfig and ScheduledQuery list by hand to improve CPU usage

* Address review comments

* Update remaining mocks
2022-11-23 12:04:06 -03:00
Roberto Dip
d9bf269c60
add dev flag to aid UI development (#8789) 2022-11-22 14:26:36 -03:00
Martin Angers
dc6bfdec57
Add support for missing OS-specific osquery flags in agent options (#8743) 2022-11-21 10:32:17 -05:00
gillespi314
b99ce3865b
Adjust cron schedule tests (#8754) 2022-11-18 11:26:51 -06:00
Roberto Dip
b6f7efe164
add <PayloadOrganization> to MDM enrollment payload (#8752)
The value of this attribute is used by macOS in "System Preferences >
Profiles" to display a note saying "This Mac is supervised and managed
by <xyz>".

When <PayloadOrganization> is not set, it uses the URL of the MDM server
for the message, which looks unpolished.
2022-11-18 11:25:44 -03:00
gillespi314
267aaf0dbe
Add holdLock and releaseLock methods to schedule package (#8464) 2022-11-16 15:14:38 -06:00
Jan Christian Grünhage
8fee954dba
fix: check device mounted at filesystem root for encryption (#8719) 2022-11-15 10:50:58 -05:00
Tomas Touceda
9a801dec8d
detect void as a linux platform as well (#8717)
Co-authored-by: Jan Christian Grünhage <jan.christian@gruenhage.xyz>
2022-11-15 12:26:18 -03:00
Martin Angers
472c8bafb3
Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
Martin Angers
7f519e44d2
Add migration to drop gigs/percent disk space from hosts (#8646) 2022-11-15 08:27:40 -05:00
Martin Angers
54bb5448a0
Fix missing valid properties in validation of FIM and YARA agent options (#8707) 2022-11-14 15:50:41 -05:00
Michal Nicpon
9ad1721efd
fix issue with duplicate vulns detected using nvd (#8613)
The OVAL analyzer falsely assumes that any vulnerabilities detected on a
host only come from OVAL. However, it is possible that NVD detects
vulnerabilities on these hosts even though it excludes software from
deb_packages and rpm_packages. For example, a python package twisted
v22.20 has a vulnerability CVE-2022-39348 detected by NVD. The OVAL
analyzer would delete this vulnerability, and it would be re-inserted by
the NVD scanner on the next run. This creates a loop.

The fix is to only delete vulnerabilities that are actually detected
using OVAL. We already store this in the source column in the
software_cve table.
2022-11-10 10:28:00 -07:00
Frank Sievertsen
0dbbad8e10
Exclude windows servers from mdm aggregation and lists (#8585) 2022-11-08 10:29:40 +01:00
Frank Sievertsen
4743d31870
Support low_disk_space filter for endpoint /labels/{id}/hosts (#8598) 2022-11-08 09:19:34 +01:00
Tomas Touceda
5d3e27d169
Use tx instead of writer within withTx style code to prevent deadlocks (#8554) 2022-11-03 10:57:50 -03:00
Martin Angers
7fbe394b94
Ingest disk encryption flag for hosts, return in GET /hosts/{id} endpoint (#8526) 2022-11-02 15:44:02 -04:00
Frank Sievertsen
f9728b8435
allow created_at and updated_at as hosts filter (with "after") (#8535) 2022-11-02 15:51:31 +01:00
Mo Zhu
74b8e29cfe
add arch and linuxmint to list of linux distros (#8532)
* add arch and linuxmint to allowlist of linux distros

* fix comma in array

* refer to list of linux distros, not allowlist
2022-11-01 16:24:59 -07:00
Michal Nicpon
1571837d75
initialize empty slice for host counts usage statistics (#8510) 2022-11-01 15:49:02 -06:00
Martin Angers
8f21e026e3
Fix bug with fleetctl apply for teams, clear agent options only if key is present (#8508) 2022-11-01 15:22:45 -04:00
Frank Sievertsen
baa1ddc0f2
Add MDM detection for windows and mdm endpoints (#8479) 2022-11-01 18:22:07 +01:00
Roberto Dip
c51927e873
enhance support for orbit and fleet desktop in osquery-perf (#8217)
This improves osquery-perf with support for a more realistic orbit + fleet desktop simulation as described in #8212

This was based on the work done by @sharvilshah in his branch.
2022-10-28 14:27:21 -03:00
Juan Fernandez
53e112d264
Feature 7494: Use the MSRC security bulletin artifacts for detecting Win OS vulnerabilities (#7889)
Use the MSRC security bulletin artifacts for detecting Win OS vulnerabilities
2022-10-28 11:12:21 -04:00
Michal Nicpon
3801f1c6d1
improve primary ip host detail query (#8407)
Previously, the primary ip was determined using the interface with the most traffic. This had a few issues and required explicitly filtering out certain interfaces that we don't want eg loopback, docker.

Instead, use the default route to determine the primary (private) ip. If there are multiple, use the one with the lowest metric and prefer ipv4 addresses.
2022-10-27 16:34:49 -06:00
Lucas Manuel Rodriguez
1fa5475e6e
Log denylisted queries as errors (#8294) 2022-10-27 11:17:14 -05:00
Roberto Dip
fdcbbaac7e
Add method to fleetDesktopResponse to satisfy the errorer interface (#8457) 2022-10-26 16:17:11 -03:00
Martin Angers
49e910270b
Add vulnerability scores to Jira/Zendesk tickets for premium users (#8346) 2022-10-26 10:42:09 -04:00
gillespi314
51e6369653
Fix password reset request expiration (#8246) 2022-10-25 09:46:41 -05:00
Martin Angers
229b349118
Fix more hosts filters-related API docs (#8335) 2022-10-25 08:17:51 -04:00
Michal Nicpon
d11db25ba9
add subject to scep payload (#8267) 2022-10-24 14:01:20 -06:00
gillespi314
881194b3b4
Add orbit version and osquery version usage statistics (#8229) 2022-10-24 11:12:56 -05:00
Martin Angers
e19191161e
Validate team spec unknown keys (#8265) 2022-10-24 08:49:44 -04:00
Juan Fernandez
9444016571
Fixed bug with CPE matching, UTM.app was matching to the incorrect CPE (#8149)
Fixed bug with CPE matching, UTM.app was matching to the incorrect CPE.
2022-10-24 12:46:18 +00:00
Michal Nicpon
3f3c0b34c4
fix missing host when ordering by display name (#8376) 2022-10-20 14:56:58 -06:00
Martin Angers
a63c3ac475
Fix error returned when ordering by display_name (#8350) 2022-10-19 17:05:10 -04:00
Roberto Dip
d0cde1aaaa
Use the same HTTP server config as the production server in tests (#8254)
* Use the same HTTP server config as the production server in tests

This abstracts the default config we use to run the server into a
function so it can be used in tests to run an HTTP server using the same
configuration.

Additionally, this fixes a data race in tests, as an HTTP server
configuration can't be changed once you call `server.Start()`[1]

[1]:
https://cs.opensource.google/go/go/+/refs/tags/go1.19.2:src/net/http/httptest/server.go;l=40;drc=19309779ac5e2f5a2fd3cbb34421dafb2855ac21
2022-10-19 07:42:21 -03:00