Commit graph

16 commits

Author SHA1 Message Date
Scott Gress
379156e578
Use new exclude_fleet_maintained_apps flag (#25674)
for #25427 

This PR updates the calls to the "list software titles" API to include
the `exclude_fleet_maintained_apps=true` flag.

I tested this with https://github.com/fleetdm/fleet/pull/25649
successfully.
2025-01-30 11:25:33 -06:00
Eric
d8897e0cca
Msp dashboard: Improve speed of profile-related actions (#25221)
Related to: #25170

Changes:
- Updated the `view-profiles`, `get-profiles`, `edit-profile`, and
`upload-profile` actions to send requests to the connected Fleet
instances and process results simultaneously.


I tested these changes while connected to a Fleet instance running on
the same network as my device, here is what I saw:
- Loading the profiles page with four profiles assigned to 22 teams:
	- Current version: 3232ms
	- This PR: 699ms
- Uploading a configuration profile with custom label targets to 22
teams:
	- Current version: 5660ms
	- This PR: 865ms
- Editing a configuration profile that is assigned to 22 teams labels:
	- Current version: 6622ms
	- This PR: 1300ms
- Replacing an existing configuration profile assigned to 22 teams:
	- Current version: 6483ms
	- This PR: 1773ms
- Fetching up-to-date configuration profile information from the Fleet
instance after a change is made:
	- Current version: 2857ms
	- This PR: 736ms
2025-01-14 12:09:23 -06:00
Eric
ecab28b000
MSP Dashboard: Add Entra SSO Hook (#24740)
Related to: #24688

Changes:
- Added two new dependencies: `jsonwebtoken` and `@azure/msal-node`
- Added a new hook: `entra-sso`. A hook that replaces the default
authentication mechanism with Microsoft Entra SSO.
- Added a new action: signup-sso-user-or-redirect. This action finds or
creates user records for authenticated SSO users and attaches the user
record to the user's session.
- updated the is-logged-in policy to check if an SSO user's token is
still valid.
- Added a link to the account page to the app's header navigation.
2025-01-03 10:14:13 -06:00
Scott Gress
556b79e2d2
Prevent Axios from fully buffering files uploaded from MSP dashboard (#24927)
for #24829 

See https://github.com/axios/axios/issues/1045 -- by default Axios
buffers uploaded files into memory fully, to support redirects. For
large file uploads this means we get OOM errors, especially when sending
to multiple teams. There's a few other optimizations we can put in place
here but in the short term we can fix the buffering issue by setting
`maxRedirects: 0` on the requests.

I tested this by adding an `onUploadProgress` handler to the Axios
request that dumps memory usage, and uploading a 209mb software file to
3 teams. Before the update, the readout ticket up continuously (the
first number is the # of bytes uploaded):

```
1540129 {rss: 161652736, heapTotal: 65880064, heapUsed: 55625552, external: 28411157, arrayBuffers: 24338844}
edit-software.js:177
1554313 {rss: 149254144, heapTotal: 65880064, heapUsed: 52445200, external: 25193635, arrayBuffers: 21121327}
edit-software.js:177
2339833 {rss: 151703552, heapTotal: 66404352, heapUsed: 52269280, external: 12664377, arrayBuffers: 8592064}
...a minute later...
192708641 {rss: 619323392, heapTotal: 95240192, heapUsed: 55320960, external: 618952429, arrayBuffers: 614879965}
edit-software.js:177
201523233 {rss: 634613760, heapTotal: 95240192, heapUsed: 58514992, external: 636581613, arrayBuffers: 632509154}
edit-software.js:177
209326677 {rss: 637399040, heapTotal: 95240192, heapUsed: 56800016, external: 639441633, arrayBuffers: 635369173}
```

so we start at ~161mb, and by the time we're done, we're using 637mb of
RAM. Render's free tier has a 250mb limit on apps.

With `maxRedirects: 0`, we see:

```
2669337 {rss: 151846912, heapTotal: 66404352, heapUsed: 53297400, external: 26446868, arrayBuffers: 22374419}
edit-software.js:177
2279929 {rss: 152641536, heapTotal: 66404352, heapUsed: 53453664, external: 27233300, arrayBuffers: 23160851}
edit-software.js:177
2228585 {rss: 153038848, heapTotal: 66404352, heapUsed: 53537096, external: 27626516, arrayBuffers: 23554067}
...a minute later...
209326677 {rss: 146989056, heapTotal: 92094464, heapUsed: 53802856, external: 14617518, arrayBuffers: 10545071}
edit-software.js:177
209326677 {rss: 153051136, heapTotal: 92094464, heapUsed: 55376336, external: 22447478, arrayBuffers: 18375026}
edit-software.js:177
209326677 {rss: 152129536, heapTotal: 92094464, heapUsed: 51857632, external: 22447478, arrayBuffers: 16540013}
```

showing that we start and finish with around the same amount of RAM
used.
2024-12-19 15:51:47 -06:00
Eric
6540ec7601
MSP dashboard: Update edit-script and edit-profile inputs (#24567)
Changes:
- Updated the edit-script and edit-profile actions to make sure that new
team IDs are always numbers.
2024-12-09 14:54:46 -06:00
Eric
102f9f3cb1
MSP Dashboard: Add labels to profiles page (#23145)
#22073

Changes:
- Added the ability to use labels to assign configuration profiles on
the profiles page.
2024-12-05 17:39:47 -06:00
Eric
52d8e45d7f
Msp dashboard: Update package.json and axios usage. (#24344)
Changes:
- (msp dashboard) Updated axios usage in upload-software and
edit-software to use the postForm method.
- Added form-data as a dependency to make sure the app uses
form-data@4.0.1
2024-12-03 15:42:42 -06:00
Eric
eb1c2f5c44
Msp dashboard: Add more debug logging to software actions. (#24339)
Changes:
- (msp dashboard) Updated the edit-software and upload-software endpoints to log more
information about errors when requests to upload a software installer
fail.
2024-12-03 14:25:11 -06:00
Eric
93d6c029f4
Msp dashboard: Update software endpoints (#24299)
Changes:
- Updated the software page to display different error messages when
requests to software endpoints fail.
- Updated the edit software endpoint to:
- have three new exits, `softwareAlreadyExistsOnThisTeam`,
`couldNotReadVersion` and `softwareDeletionFailed`
- Create database records for newly undeployed software after it has
been removed from all teams on a Fleet instance.
- Return a `softwareAlreadyExistsOnThisTeam` response if undeployed
software is being transferred to a team it is already deployed to.
- Return a `couldNotReadVersion` response if the Fleet instance cannot
read the version information from an uploaded software installer
- Return a `softwareDeletionFailed` response if an installer cannot be
deleted via an API request (If it is configured to be installed during
the macOS setup experience)
- Updated the upload-software endpoint to return a `couldNotReadVersion`
response if the Fleet instance cannot read the version information from
an uploaded software installer
2024-12-02 22:28:03 -06:00
Eric
6d468cada4
Msp dashboard: Update error handling in software related actions (#24283)
Changes:
- Updated the edit-software endpoint to:
- log a detailed warning when a request to get a stream of an existing
software installer returns a non-200 repsonse
- Use the modify package API endpoint when a software installer is
replaced.
- include the nested response from the Fleet instance in error messages
- Updated the delete-software endpoint to return a
'softwareDeletionFailed` exit when a specified software installer is
included in the macOS setup experience and cannot be deleted via API
requests.
- Updated the software page to show an error message with a link to the
controls page on the connected Fleet instance if the delete-software
endpoint returns a `softwareDeletionFailed` exit
2024-12-02 14:46:07 -06:00
Eric
d694d0572f
Msp dash: follow-up changes to software page after QA (#23210)
https://github.com/fleetdm/fleet/issues/21928#issuecomment-2436371970

Changes:
- updated the edit-software endpoint to make sure that text values
related to software installers (pre-install query, install script,
post-install script, uninstall script) are updated for all teams when
software is edited, and to delete software on the fleet instance when
the installer is replaced and all teams are removed.
- updated the ace editor component to emit an input event when text is
pasted inside of it.
- Updated the error messages in the upload software modal
- Fixed an issue where the edit software endpoint would return a 400
response when all teams are removed from a software installer when a new
installer package is provided.
2024-10-24 17:00:01 -05:00
Eric
1e593375f8
Msp dashboard: Update error handling in software-related actions (#23065)
For: https://github.com/fleetdm/confidential/issues/8473

Changes:
- Updated the cloud error components message
- Updated the upload-software action to log errors about failed requests
to the Fleet API
- Updated the edit-software action to log errors about failed requests
to the Fleet API, and to delete temporary files when requests fail.
- Updated the software page to clear cloud errors when modals are
closed.
2024-10-21 21:13:06 -05:00
Eric
0da7afb332
Bulk operations dashboard: Add software page (#22584)
Related to #21928

Changes:
- Added a /software page, a page where users can manage
(upload/edit/download/delete) software installers on their Fleet
instance across multiple teams at once.
- ~~Removed the `deploy-bulk-operations-dashboard-on-heroku` GitHub
action (This dashboard will be hosted in Render in the future)~~
Reverted this change to unblock merging this PR, I will remove this file
in a separate PR.
2024-10-15 10:17:05 -05:00
Eric
5ae005a423
Bulk operations dashboard: update edit-script (#21527)
Changes:
- Fixed a bug where an undeployed script would have a duplicate file
extension when it is deployed to a team on a Fleet instance
2024-08-23 15:32:59 -06:00
Eric
e43119cf76
Bulk operations dashboard: styles and bug fix (#21521)
Changes:
- Fixed button styles
- Fixed a bug that prevented deploying a profile/script to a team while
replacing the profile/script
2024-08-22 23:10:47 -06:00
Eric
debb2d1790
Add app to manage scripts and profiles. (#21450)
Related to: #20296 

Changes:
- Added `ee/bulk-operations-dashboard`, a Sails.js app that lets users
manage configuration profiles and scripts across multiple teams on a
Fleet instance.
- Added a Github workflow to deploy the app to Heroku
- Added a Github workflow to test changes to the bulk operations
dashboard.
2024-08-22 14:59:15 -06:00