Commit Graph

10029 Commits

Author SHA1 Message Date
Sarah Gillespie
f19dc8abe0
Add GET software/versions and GET software/versions/:id endpoints (#15450) 2023-12-06 08:30:49 -06:00
Sharon Katz
d40555e7cd
Script for comparing two CIS PDF files (#15307) 2023-12-06 09:21:12 -05:00
Luke Heath
f89d78d065
Update air guitar process (#15451)
Now that Mike is not attending all design reviews, we are going to
assign the finished air guitar issue to Noah, and he will bring to a
review session with Mike.
2023-12-05 17:03:04 -06:00
Jacob Shandling
6c25646499 Merge branch 'main' into 14415 2023-12-05 13:59:02 -08:00
Jacob Shandling
bb56e288e5
UI – 14415 frontend - host details (#15437)
## Addresses the first major part of #15011 (item 2) – Host Details >
Queries tab

<img width="1274" alt="Screenshot 2023-12-04 at 1 09 31 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/47075ebb-eb98-48f5-82ab-af4022932376">
<img width="678" alt="Screenshot 2023-12-04 at 1 09 57 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/db48ca6d-e73b-4a90-b782-f9ee265927f1">

- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-12-05 13:58:02 -08:00
Lucas Manuel Rodriguez
33ceb0ab9f
Update edge case bug in ds.UpdateHostDeviceMapping (#15454)
Found by @mna while working on #14779.

Sort of an edge case but the change is simple enough to fix it.
2023-12-05 18:25:11 -03:00
Lucas Manuel Rodriguez
57351011fa
Fix deadlock when replacing (upserting) host_batteries (#15447)
#14779

This PR fixes the deadlock when upserting to `host_batteries`.
Which probably happens because InnoDB uses row-locking.

I was able to reproduce in main with the new test
`TestHosts/ReplaceHostBatteriesDeadlock`.
I refactored `ds.ReplaceHostBatteries` to use the same upsert pattern as
`ds.ReplaceHostDeviceMapping` (given `battery` is assumed to return just
a few rows per host). With such pattern the tests does not fail with
deadlock errors anymore.

Here are some of the techniques MySQL recommends:
https://dev.mysql.com/doc/refman/5.7/en/innodb-deadlocks-handling.html
Basically by changing the upsert pattern the deadlock goes away (It's
hard to know exactly why the original code deadlocks).

Here's the deadlock trace from load test performed in October:
```
2023-10-26T17:19:17.244707Z 0 [Note] [MY-012468] [InnoDB] Transactions deadlock detected, dumping detailed information. (lock0lock.cc:6482)
2023-10-26T17:19:17.244756Z 0 [Note] [MY-012469] [InnoDB]  *** (1) TRANSACTION:  (lock0lock.cc:6496)
TRANSACTION 3069771944, ACTIVE 0 sec inserting
mysql tables in use 1, locked 1
LOCK WAIT 7 lock struct(s), heap size 1136, 5 row lock(s), undo log entries 1
MySQL thread id 75, OS thread handle 70369297350384, query id 658 10.12.3.201 fleet update
INSERT INTO
      host_batteries (
        host_id,
        serial_number,
        cycle_count,
        health
      )
    VALUES
      (27472, '0000', 505, 'Good'),(27472, '0001', 730, 'Good')
    ON DUPLICATE KEY UPDATE
      cycle_count = VALUES(cycle_count),
      health = VALUES(health),
      updated_at = CURRENT_TIMESTAMP
2023-10-26T17:19:17.244800Z 0 [Note] [MY-012469] [InnoDB]  *** (1) HOLDS THE LOCK(S):  (lock0lock.cc:6496)
RECORD LOCKS space id 867 page no 320 n bits 280 index PRIMARY of table `fleet`.`host_batteries` trx id 3069771944 lock_mode X locks gap before rec
Record lock, heap no 205 PHYSICAL RECORD: n_fields 9; compact format; info bits 0
 0: len 4; hex 00526996; asc  Ri ;;
 1: len 6; hex 0000b6f900d0; asc       ;;
 2: len 7; hex 82000033370110; asc    37  ;;
 3: len 4; hex 0000d829; asc    );;
 4: len 4; hex 30303030; asc 0000;;
 5: len 4; hex 8000065b; asc    [;;
 6: len 4; hex 506f6f72; asc Poor;;
 7: len 4; hex 653a9f95; asc e:  ;;
 8: len 4; hex 653a9f95; asc e:  ;;

2023-10-26T17:19:17.245027Z 0 [Note] [MY-012469] [InnoDB]  *** (1) WAITING FOR THIS LOCK TO BE GRANTED:  (lock0lock.cc:6496)
RECORD LOCKS space id 867 page no 320 n bits 280 index PRIMARY of table `fleet`.`host_batteries` trx id 3069771944 lock_mode X locks gap before rec insert intention waiting
Record lock, heap no 205 PHYSICAL RECORD: n_fields 9; compact format; info bits 0
 0: len 4; hex 00526996; asc  Ri ;;
 1: len 6; hex 0000b6f900d0; asc       ;;
 2: len 7; hex 82000033370110; asc    37  ;;
 3: len 4; hex 0000d829; asc    );;
 4: len 4; hex 30303030; asc 0000;;
 5: len 4; hex 8000065b; asc    [;;
 6: len 4; hex 506f6f72; asc Poor;;
 7: len 4; hex 653a9f95; asc e:  ;;

2023-10-26T17:19:17.245239Z 0 [Note] [MY-012469] [InnoDB]  *** (2) TRANSACTION:  (lock0lock.cc:6496)
TRANSACTION 3069771958, ACTIVE 0 sec inserting
mysql tables in use 1, locked 1
LOCK WAIT 7 lock struct(s), heap size 1136, 5 row lock(s), undo log entries 1
MySQL thread id 9, OS thread handle 70369296809712, query id 708 10.12.2.156 fleet update
INSERT INTO
      host_batteries (
        host_id,
        serial_number,
        cycle_count,
        health
      )
    VALUES
      (59161, '0000', 1384, 'Fair'),(59161, '0001', 396, 'Good')
    ON DUPLICATE KEY UPDATE
      cycle_count = VALUES(cycle_count),
      health = VALUES(health),
      updated_at = CURRENT_TIMESTAMP
2023-10-26T17:19:17.245272Z 0 [Note] [MY-012469] [InnoDB]  *** (2) HOLDS THE LOCK(S):  (lock0lock.cc:6496)
RECORD LOCKS space id 867 page no 320 n bits 280 index PRIMARY of table `fleet`.`host_batteries` trx id 3069771958 lock_mode X locks gap before rec
Record lock, heap no 205 PHYSICAL RECORD: n_fields 9; compact format; info bits 0
 0: len 4; hex 00526996; asc  Ri ;;
 1: len 6; hex 0000b6f900d0; asc       ;;
 2: len 7; hex 82000033370110; asc    37  ;;
 3: len 4; hex 0000d829; asc    );;
 4: len 4; hex 30303030; asc 0000;;
 5: len 4; hex 8000065b; asc    [;;
 6: len 4; hex 506f6f72; asc Poor;;
 7: len 4; hex 653a9f95; asc e:  ;;
 8: len 4; hex 653a9f95; asc e:  ;;

2023-10-26T17:19:17.245504Z 0 [Note] [MY-012469] [InnoDB]  *** (2) WAITING FOR THIS LOCK TO BE GRANTED:  (lock0lock.cc:6496)
RECORD LOCKS space id 867 page no 320 n bits 280 index PRIMARY of table `fleet`.`host_batteries` trx id 3069771958 lock_mode X locks gap before rec insert intention waiting
Record lock, heap no 205 PHYSICAL RECORD: n_fields 9; compact format; info bits 0
 0: len 4; hex 00526996; asc  Ri ;;
 1: len 6; hex 0000b6f900d0; asc       ;;
 2: len 7; hex 82000033370110; asc    37  ;;
 3: len 4; hex 0000d829; asc    );;
 4: len 4; hex 30303030; asc 0000;;
 5: len 4; hex 8000065b; asc    [;;
 6: len 4; hex 506f6f72; asc Poor;;
 7: len 4; hex 653a9f95; asc e:  ;;
 8: len 4; hex 653a9f95; asc e:  ;;

2023-10-26T17:19:17.245730Z 0 [Note] [MY-012469] [InnoDB] *** WE ROLL BACK TRANSACTION (2)  (lock0lock.cc:6496)
```

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality
2023-12-05 18:24:58 -03:00
George Karr
a59b609f6f
Fix copy for OS settings (#15453)
remedy #15412
2023-12-05 11:54:36 -06:00
Noah Talerman
86febbfdd2
Update Windows MDM setup guide (#15448)
- Make reuses SCEP certificate and key obvious
2023-12-05 09:40:06 -06:00
Andrew Baker
5cb37d9c62
Drew bakerfdm patch 1 (#15434) 2023-12-05 10:00:27 -05:00
Mike McNeil
b140a5af59
2023-12-01 Handbook: Github labels (#15399)
@lukeheath Could you have a look at the todos in the note? Your call on
when to prioritize these changes, but wanted to get the exceptions
tracked ASAP to stop the sprawl

(i.e. 2 more labels were created this week that don't match the
convention-- addressed separately and not listed here)
2023-12-04 16:13:39 -06:00
mostlikelee
5677d734de Merge branch 'main' into 14415 2023-12-04 14:38:28 -07:00
Eric
3fe08fecba
Website: Handle scrolling to in-page links when query parameters are provided. (#15423)
Closes: #15415

Changes:
- Updated the documentation and handbook page scripts to navigate users
who visit a URL with a hash link with query parameters attached to the
correct section.
2023-12-04 14:59:26 -06:00
Lucas Manuel Rodriguez
9b40573f54
Fix installed_from_dep value in activity for DEP re-enrolling (#15419)
#12037 

![Screenshot 2023-12-04 at 17 03
03](https://github.com/fleetdm/fleet/assets/2073526/e44cee72-1f1a-4a10-be80-26f0e06c8c91)

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality
2023-12-04 17:14:16 -03:00
Sharon Katz
29580a242d
15135 remove atom package (#15410) 2023-12-04 14:26:26 -05:00
Noah Talerman
e673cc6caa
Update Enroll hosts doc page (#15279)
- Remove section about plain osquery and launcher. Using fleetd is best
practice and we want all new Fleet users to follow this best practice.
If they can't we want to learn why.
- Replace "Fleetd configuration options" section with a tip. Easier to
maintain as we add/update flags.
2023-12-04 11:19:16 -05:00
Noah Talerman
bd54184510
Puppet module docs (#15336)
- We learned from a customer that the Puppet module requires global
admin
2023-12-04 11:18:18 -05:00
Noah Talerman
4bf2635453
Enroll hosts docs (#15374)
- Move "Grant full disk access for macOS hosts" to Advanced section
2023-12-04 11:16:55 -05:00
Sarah Gillespie
0db59a7a25
Add cron for software titles feature (#15422) 2023-12-04 10:09:23 -06:00
Tim Lee
dc3fc5e6f5
15378 record empty data results (#15403) 2023-12-04 08:31:35 -07:00
Martin Angers
f5f66ebe63
Unify profiles database identifier to profile_uuid for macOS and Windows profiles. (#15297) 2023-12-04 10:04:06 -05:00
Martin Angers
88612cdf8c
Add back Windows OS Updates documentation changes (#15363) 2023-12-04 09:50:06 -05:00
Lucas Manuel Rodriguez
ab0700b4e0
Fix osquery result logging when queries are configured outside of Fleet (#15393)
#15168

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Added/updated tests.
- [X] Manual QA for all new/changed functionality.

The issue can be reproduced by running `osqueryd` with
`--config_plugin=filesystem --config_path=/path/to/config.json`
This means the osquery config is fetched from a file rather than from
Fleet's agent settings.
The `/path/to/config.json` has the agent settings, e.g.:
```
{
  "decorators": {
    "load": [
      "SELECT uuid AS host_uuid FROM system_info;",
      "SELECT hostname AS hostname FROM system_info;"
    ]
  },
  "options": {
    "disable_distributed": false,
    "distributed_interval": 10,
    "distributed_plugin": "tls",
    "distributed_tls_max_attempts": 3,
    "logger_tls_endpoint": "/api/osquery/log",
    "logger_tls_period": 10,
    "pack_delimiter": "/"
  },
  "schedule": {
    "USB devices": {
      "query": "SELECT * FROM usb_devices;",
      "interval": 15
    },
    "OS version": {
      "query": "SELECT * FROM os_version;",
      "interval": 10
    }
  },
  "packs": {
    "Elsewhere": {
      "queries": {
        "Osquery Info": {
          "query": "SELECT * FROM osquery_info;",
          "interval": 30,
          "platform": "",
          "version": "",
          "snapshot": true
        }
      }
    }
  }
}
```

The three queries should be logged to Fleet's configured result logging
destination (default is `filesystem`).
2023-12-04 11:18:49 -03:00
Roberto Dip
a7be0be9e9
improve mdm_windows query to account for multiple registry entries (#15391)
for #15362, this adjusts the query we use to get MDM details for windows
to account for hosts that might have more than one matching value in the
registry for any of the items we query.
2023-12-04 11:03:05 -03:00
Martin Angers
6fd06d6486
Add back Windows Profiles documentation changes (#15358) 2023-12-04 08:41:37 -05:00
Sarah Gillespie
5835cad7e4
Revise copy for OS updates feature to reflect cross-platform support (#15402) 2023-12-02 13:43:18 -06:00
Eric
294c060f2b
Website: Fix website header transition. (#15424)
Closes: #15420

Changes:
- Adjusted the styles in layout.less to bring back the header transition
that was unintentionally disabled in #14339
2023-12-01 18:19:20 -06:00
Eric
f14ab358fe
2023-11-21 Website: Add new usage statistics (#15263)
Closes: #15255

Changes:
- Added the usage statistics added in
https://github.com/fleetdm/fleet/pull/14216 to the inputs of the
`receive-usage-analytics` webhook.
- Updated the `receive-usage-analytics` webhook to send the new usage
statistics to Datadog.
- Added attributes for the new usage statistics to the
`HistoricalUsageSnapshot` model.
- Removed the `columnName` from the `hostsStatusWebHookEnabled`
attribute of the `HistoricalUsageSnapshot` model, the name of this
column will be changed in the database when the new columns are added to
the databse table.
- Updated the usage statistics documentation to have the new statistics.


This PR requires database migrations. When this is approved and ready to
merge, we will need to:
- [ ] Merge this PR
- [ ] Put fleetdm.com into maintenance mode while the "Deploy Fleet
website" GH action runs.
- [ ] Add the new columns to the database table
- [ ] Change the name of the `hostStatusWebhookEnabled` column to
`hostsStatusWebHookEnabled`
- [ ] Set the default values for the new columns on the existing
records.
- [ ] When the website has finished redeploying, take it out of
maintenance mode.
2023-12-01 17:59:41 -06:00
Luke Heath
6d3230c1fa
Fix links to the website containing anchors and URL params (#15414) 2023-12-01 14:20:44 -06:00
Jacob Shandling
eaa124eb1b
UI – Fix bug with line breaks in example command (#15331)
## Addresses #14970 

Command fails for correct reason (no real path provided), instead of
reading it as multiple commands due to line breaks:

<img width="801" alt="Screenshot 2023-11-27 at 4 27 21 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/c30b183a-d8e4-4b90-85be-9097dcd7315c">

- [x] Changes file added for user-visible changes in `changes/`
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-12-01 09:11:56 -08:00
Jacob Shandling
32805c1681
UI – Show line breaks in Policy details modals (#15354)
## Addresses #14484 

<img width="653" alt="Screenshot 2023-11-28 at 2 05 26 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/7af9d880-d3fd-443b-94f6-8135f5ce506a">


- [x] Changes file added for user-visible changes in `changes/`
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-12-01 09:11:36 -08:00
Gabriel Hernandez
24068230c6
Ensure macOS min version form is open by default on the os updates page (#15405)
ensures the mac min version form is open by default on the os updates
page

- [x] Manual QA for all new/changed functionality
2023-12-01 15:54:20 +00:00
Sarah Gillespie
b660715e56
Add database migrations to support software titles feature (#15401)
Issue #15222
2023-12-01 11:33:07 -03:00
Gabriel Hernandez
dc1ba8a395
make query table doc dropdown truncation consistant (#15386)
relates to #14441

Makes the truncation consistent for the dropdown options on the query
table selector.

- [x] Manual QA for all new/changed functionality
2023-12-01 12:14:47 +00:00
Noah Talerman
9041673ba9
Update features.yml (#15372)
- Add customer codename to Windows profiles feature
- Update date for this customers requests
2023-11-30 22:58:40 -06:00
Andrew Baker
e32b5b2f36
Update README.md (#15404)
Removing unnecessary stub

Podcast in the communications link

Based on request from: https://github.com/fleetdm/fleet/pull/15392/files
2023-11-30 22:57:18 -06:00
Andrew Baker
6f7dbc88f3
Handbook podcast upload steps. (#15392) 2023-11-30 22:43:51 -06:00
Alex Mitchell
6604afd63f
2023-12-01 Update communications.md (#15397)
Fixed misspelling of "platform" from "platfrom"
2023-11-30 22:23:26 -06:00
Victor Lyuboslavsky
a7ae828581
Adding extension_id and browser columns to software table. (#15285)
https://github.com/fleetdm/confidential/issues/2118
API doc changes are at: https://github.com/fleetdm/fleet/pull/15092

This change affects Chrome-based and Firefox browsers. I tried Safari,
but it appears that latest Safari extensions simply show up as regular
apps on macOS.

# Checklist for submitter
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
  - Tested detail query changes on macOS, Windows, Ubuntu, and ChromeOS
  - Tested Chrome, Edge, Brave, and Firefox browsers

Testing notes:
1. Install some browser extensions.
2. Update fleet to this change.
3. Refresh hosts, and trigger vulnerabilities job (which updates host
software).
4. Do something like `GET
https://localhost:8080/api/v1/fleet/software?query=Password%20Manager`
to see `extension_id` and `browser` for the hosts that have updated.
2023-11-30 19:06:17 -06:00
Sarah Gillespie
976eeba61d
Add validations to disallow custom MDM profiles that contain names reserved by Fleet (#15373) 2023-11-30 17:19:18 -06:00
Robert Fairburn
b31e45244d
Some loadtesting improvements to solve common issues (#15360) 2023-11-30 16:36:04 -06:00
Jahziel Villasana-Espinoza
837602a271
fix: prevent table from rerendering when opening modals (#15375)
> Addresses #14851 

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-11-30 17:21:35 -05:00
Roberto Dip
e413da22da
fix uuid for platforms accordion item (#15396)
for https://github.com/fleetdm/fleet/issues/15395
2023-11-30 18:58:38 -03:00
Tim Lee
4ece43b143
14969 vuln software seeding tool (#15116) 2023-11-30 13:01:50 -07:00
Roberto Dip
b50fc0c0d3
provide teamID when fetching OS version counts (#15387)
for #15388
2023-11-30 15:38:16 -03:00
JD
4cab3be0d1
Article: 4.41.0 release (#15376)
Fleet 4.41.0 release article and echelon 1 article.

---------

Co-authored-by: Eric <eashaw@sailsjs.com>
2023-11-30 09:11:04 -08:00
Roberto Dip
b07fbdc1d7
implement profile verification for windows (#15348)
for #14426.

In order to prevent import cycles and be able to use some type
definitions/constants I followed the same pattern we did for macOS by
creating a new package named `syncml`. This makes the changelog look
bigger than it actually is, so I split it into two commits to make it
easier to review:

-
[d7c233d](d7c233d54c)
moves the relevant bits to this new package
-
[7531a07](7531a0742b)
implements profile verification
2023-11-30 09:17:07 -03:00
Mike McNeil
120293e59c
Update homepage.ejs (#15379)
# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [ ] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Documented any permissions changes (docs/Using
Fleet/manage-access.md)
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] Manual QA for all new/changed functionality
  - For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
2023-11-30 00:27:55 -06:00
Robert Fairburn
5a99186fe2
Some documentation updates (#15369) 2023-11-29 17:23:49 -06:00
Neil Blazevic
3da2529a13
Update standard query library docs w link (#15131) 2023-11-29 17:15:40 -06:00