Commit Graph

742 Commits

Author SHA1 Message Date
Roberto Dip
e34b320ed5 Merge remote-tracking branch 'origin/main' into feat-macos-ddm 2024-03-27 11:58:22 -03:00
Martin Angers
8abee3e72d
Merge branch 'main' into feat-prefill-account-name 2024-03-27 09:53:02 -04:00
Lucas Manuel Rodriguez
ea92433c34
Disabling calendar policies removes scheduled calendar events (#17882)
#17230

Fix for the following scenarios:
- Team has only one policy with calendar enabled. Events are created on
user calendars. Then the user disables the calendar on such policy.
Expected behavior: Events on the user calendar should be cleaned up in
that scenario.
- Policy `platform` is edited (which removes `policy_membership`
entries) and we'd like to have the calendar event removed for the hosts
that do not apply anymore.

To cover these scenarios I changed `ds.GetTeamHostsPolicyMemberships` so
that it also returns hosts that have a calendar event AND have no
results on policies (returned as passing=1).
E.g. this could happen if there ARE calendar events for a team but with
a platform that doesn't match the host (so it has no results).
2024-03-27 10:33:09 -03:00
Martin Angers
98bccf54e3 Fix test with expected Google Calendar integration 2024-03-27 08:39:41 -04:00
Martin Angers
b449900602 Regenerate schema.sql 2024-03-27 08:19:21 -04:00
Lucas Manuel Rodriguez
51cd71f464
Fix concurrency bug in calendar cron (#17832)
#17441
2024-03-26 13:39:37 -05:00
Lucas Manuel Rodriguez
9090d8541f
Calendar update event if meeting occurring now (#17815)
#17441

---------

Co-authored-by: Victor Lyuboslavsky <victor.lyuboslavsky@gmail.com>
2024-03-26 13:39:37 -05:00
Victor Lyuboslavsky
2e56563280
Adding retry logic when rate limited by Google Calendar API. (#17810)
Adding retry logic when rate limited by Google Calendar API.
2024-03-26 13:39:37 -05:00
Lucas Manuel Rodriguez
355379aa0b
Fleet calendar process 100 hosts at a time (#17806)
Add concurrency for #17441.
2024-03-26 13:39:37 -05:00
Victor Lyuboslavsky
62049b04bd
Added TestEventForDifferentHost for calendar_cron. (#17802)
Added TestEventForDifferentHost for calendar_cron.
2024-03-26 13:39:37 -05:00
Lucas Manuel Rodriguez
c6e2e8d6c4
Always create event next 3rd Tuesday (#17799)
Fix to always create events for next 3rd Tuesday #17441
2024-03-26 13:39:37 -05:00
Lucas Manuel Rodriguez
31fe9d17b9
More fixes to support users with hosts in same team and hosts in different teams (#17789)
#17441
2024-03-26 13:39:37 -05:00
Lucas Manuel Rodriguez
e8f177dd43
Additional changes to happy path and cleanup cron job (#17757)
#17441 & #17442
2024-03-26 13:39:37 -05:00
Victor Lyuboslavsky
e4ba41ac85
Latest changes to configs (#17724)
- Remove email from team configs
- Accept api_key_json for global config
2024-03-26 13:39:37 -05:00
Victor Lyuboslavsky
196d8ce5b7
Calendar interface updates and mock calendar (#17701)
- Updated calendar interface to use updated `genBodyFn`
- The mock calendar is enabled by specifying `calendar-mock@example.com`
as the service account email.
2024-03-26 13:39:36 -05:00
Lucas Manuel Rodriguez
9a8ac02bc1
Happy path implementation of the calendar cron job (#17713)
Happy path for #17441.
2024-03-26 13:39:36 -05:00
Victor Lyuboslavsky
63e9d49dfc
Calendar config updates -- policy table now has calendar_events_enabled (#17645)
# Checklist for submitter
- [ ] 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] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [x] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [x] Manual QA for all new/changed functionality
2024-03-26 13:39:36 -05:00
Victor Lyuboslavsky
1c311b73be
Fleet in your calendar configs (#17462)
Sub-task for #17230 

# Configuration changes
App configuration:
```yaml
integrations:
  google_calendar:
    - email: name@service-account.com
      private_key: ***
      domain: fleetdm.com
```
Team configuration:
```yaml
integrations:
  google_calendar:
    email: name@service-account.com
    enable_calendar_events: true
    policies:
      - name: My policy
        id: 12
    webhook_url: https://example.com/policy-remediation
```

Note: Policy is looked up by name when configuration is set. The policy
id is set/updated by the server for internal use.

# Checklist for submitter
<!-- 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/`.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-03-26 13:39:36 -05:00
Roberto Dip
95df7e2b0b
implement DDM cron and protocol bits (#17791)
for #17399
2024-03-25 17:32:27 -03:00
Gabriel Hernandez
8d2deb37e5 Merge branch 'main' into feat-prefill-account-name 2024-03-25 11:38:20 +00:00
Gabriel Hernandez
577d5c27ea Merge branch 'main' into feat-macos-ddm 2024-03-25 11:11:40 +00:00
Dante Catalfamo
bd3e775e67
Windows MDM Fix Manual Detection (#17721)
#15565 

Replace the use of the isFederated registry key with a keys that check
for AAD (Azure Active Directory, now Entra ID)

Federated enrollment (`isFederated`) seems to be when windows uses a
Discovery MDM endpoint to get its policy and management endpoint
configuration. This is always the case when a client is enrolled with
fleet, so installations always show up as automatic.

It's being replaced by a different key, `AADResourceID`, which appears
to identify the resource that controls the automated deployment. In my
tests it only appears to be populated when the computer is enrolled
through automated deployments. This key appears on both Windows 10 and
11.

There is a similar key, `AADTenantID`, which appears to identify the
client (tenant) to the Azure cloud. I haven't seen this ID in our
systems, so it is likely exclusively used in Azure. Both this key and
`AADResourceID` seem to always be set at the same time, so we only
check for the `AADResourceID`.

I've also added documentation on the registry keys I've analyzed for future reference.
2024-03-21 15:09:05 -04:00
Sarah Gillespie
01e3b94e55
Update backend APIs for macOS DDM (#17734)
Co-authored-by: Jahziel Villasana-Espinoza <jahziel@fleetdm.com>
2024-03-20 14:15:07 -05:00
Martin Angers
b0ab7bbdc4
Add enable_release_device_manually setting to team and no-team (#17698) 2024-03-19 13:21:16 -04:00
Gabriel Hernandez
8a137ffe1f Merge branch 'main' into feat-macos-ddm 2024-03-19 11:54:12 +00:00
Tim Lee
57d6c88a63
Policy Result Control in osquery-perf (#17649) 2024-03-15 16:04:46 -06:00
Sarah Gillespie
48b31a02ae
Add DDM service struct, basic handlers, and test client (#17671) 2024-03-15 15:20:15 -03:00
Lucas Manuel Rodriguez
cf64d85deb
Add visual studio extensions to software inventory (#17501)
#17003

- [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 support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [x] Added/updated tests
- [X] Manual QA for all new/changed functionality
2024-03-14 16:33:12 -03:00
Lucas Manuel Rodriguez
4c671e7a15
Fix scheduled query results in osquery-perf for frequencies > 1m (#17576)
This is a bug in the generation of results of scheduled queries in
osquery-perf.
It seems the bug has been around since we added scheduled query result
support in osquery-perf.

PS: In my Fleet downtime tests for
https://github.com/fleetdm/fleet/issues/16423 I probably missed this
because I was using a high frequency queries (150s intervals IIRC).
2024-03-14 12:59:57 -03:00
Jahziel Villasana-Espinoza
2b9487197c
feat: script content cleanup and column removal (#17374)
> Related issue: #17374

# 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] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
- [x] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [x] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [x] Manual QA for all new/changed functionality
2024-03-13 15:53:08 -04:00
Martin Angers
c358bde87b
osquery-perf: add support for Windows MDM enrollment and session management. (#17522) 2024-03-13 09:29:25 -04:00
Victor Lyuboslavsky
ad5c0a90be
Team user should not access OS version on another team. (#17347)
#17117 
For `fleet/os_versions` and `/fleet/os_versions/[id]`, team users can no
longer access os versions on hosts from other teams.

### Team admin /os_versions - only returns os versions for the user's
team(s)
GET https://localhost:8080/api/v1/fleet/os_versions

### Team admin /os_versions/:id on 'No Team' - 403
GET https://localhost:8080/api/v1/fleet/os_versions/5

### Global admin /os_versions/:id?team_id does not exist anywhere - 404
GET https://localhost:8080/api/v1/fleet/os_versions/999999?team_id=1

# Checklist for submitter

<!-- 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] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-03-13 08:20:00 -05:00
Victor Lyuboslavsky
b174a476a2
Fixing unreleased spec bug in team host status webhook feature. (#17502)
Fixing unreleased spec bug in team host status webhook feature #17094.
Bug #17498
# Checklist for submitter

<!-- 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/`.
  - Not needed. Part of new feature.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-03-08 15:09:33 -06:00
Victor Lyuboslavsky
a173be8f52
For fleetctl gitops, when MDM configs are not explicitly defined in gitops yml file, they are now set to default values. (#17223)
For fleetctl gitops, when MDM configs are not explicitly defined in
gitops yml file, they are now set to default values.
#17209

Gitops role can now read org config/settings. This is used to determine
whether license is Premium.
Doc changes for permission access:
https://github.com/fleetdm/fleet/pull/17238

# 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] Documented any permissions changes (docs/Using
Fleet/manage-access.md)
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-03-07 13:20:14 -06:00
Sarah Gillespie
1e43cd813c
Use --team flag for run-script command (#17373) 2024-03-05 11:54:26 -06:00
Sarah Gillespie
c29f0abf92
Update API and CLI to enable running scripts by name and team id (#17322)
TODO:
- Integration tests

# 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
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] 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)).
2024-03-05 08:53:17 -06:00
Martin Angers
98bc2dc29a Fix conflicts 2024-03-05 08:11:28 -05:00
Roberto Dip
d2cf75cb13
remove binaries accidentally added in 730f8850 (#17344)
Accidentally added as part of the feature work for wipe. Should fix
https://github.com/fleetdm/fleet/security/code-scanning/1090
2024-03-04 13:18:01 -06:00
Victor Lyuboslavsky
592a7450e3
Enabling setting host status webhook at the team level via REST API and fleetctl apply/gitops. (#17186)
Enabling setting host status webhook at the team level via REST API and
fleetctl apply/gitops.
#14916

Example payload:
```json
{
    "data": {
        "days_unseen": 3,
        "host_ids": [
            10724,
            10726,
            10738,
            10739,
            10740,
            10741,
            10742,
            10744,
            10745,
            10746,
            10747,
            10748,
            10749
        ],
        "team_id": 3,
        "total_hosts": 15,
        "unseen_hosts": 13
    },
    "text": "More than 86.67% of your hosts have not checked into Fleet for more than 3 days. You've been sent this message because the Host status webhook is enabled in your Fleet instance."
}
```

# Checklist for submitter

- [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
2024-03-04 12:35:27 -06:00
Lucas Manuel Rodriguez
4acb713bf1
osquery-perf changes for Fleet downtime load test (#17310)
Including all the osquery-perf changes needed to perform #16423.
2024-03-04 15:10:10 -03:00
Jahziel Villasana-Espinoza
33a0324ebb
feat: adding, reading, and deleting flows for scripts updated to use new table (#17305)
> Related issues: #16842, #16843

# 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] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
- [x] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [x] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [x] Manual QA for all new/changed functionality
2024-03-04 11:00:08 -05:00
Gabriel Hernandez
4fa50778ac merge main into feat-mdm-wipe-host 2024-03-01 17:08:41 +00:00
Sarah Gillespie
e0cb59d4cb
Surface MDM devices where DEP assignment failed (#16973) 2024-03-01 10:52:19 -06:00
Gabriel Hernandez
2efe53cc14
Add fleetctl cli wipe command (#17087)
relates to #10494

implement the fleetctl wipe commands

- [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

---------

Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2024-02-29 17:13:25 +00:00
Gabriel Hernandez
4ee65ce184 Merge branch 'main' into feat-mdm-wipe-host 2024-02-29 11:22:31 +00:00
Victor Lyuboslavsky
22dd392da7
Fixing code review comments. (#17240)
Fixing code review comments from
https://github.com/fleetdm/fleet/pull/16855
Also, moving `CleanupDistributedQueryCampaigns` back to once an hour, so
that it is not disabled.
2024-02-28 10:53:37 -06:00
Victor Lyuboslavsky
f215adee5b
Added --server_frequent_cleanups_enabled (FLEET_SERVER_FREQUENT_CLEANUPS_ENABLED) flag (#17235)
Added --server_frequent_cleanups_enabled
(FLEET_SERVER_FREQUENT_CLEANUPS_ENABLED) flag to enable 15 minute cron
job to clean up stale data. Currently disabled by default.

#17197 

# 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.
- [ ] Added/updated tests
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Sharon Katz <121527325+sharon-fdm@users.noreply.github.com>
2024-02-28 09:59:25 -06:00
Gabriel Hernandez
b692d7fa05 Merge branch 'main' into feat-mdm-wipe-host 2024-02-28 11:54:45 +00:00
Martin Angers
6c0e56ea73
Address multiple redis-related issues observed with live queries (#16855)
#16331 

Doc updates in a separate PR:
https://github.com/fleetdm/fleet/pull/17214

# Checklist for submitter

- [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 (smoke-tested locally
with osquery-perf simulating 100 hosts, ran a live query, a saved live
query, stopped naturally and stopped before the end, and again via
fleetctl)

---------

Co-authored-by: Victor Lyuboslavsky <victor@fleetdm.com>
Co-authored-by: Victor Lyuboslavsky <victor.lyuboslavsky@gmail.com>
2024-02-27 19:35:27 -06:00
Jahziel Villasana-Espinoza
205338bfa3
feat: update error message for script timeouts (#17215)
> Related issue: #16019

# 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
2024-02-27 16:19:34 -05:00