14 Commits
Author SHA1 Message Date
Eric f145c778b8 Website: log number of android enterprise requests in the past minute (#50780)
Related to: https://github.com/fleetdm/fleet/issues/49212

Changes:
- Updated the custom hook to create `sails.androidProxyApiRequestCount`,
and to log and reset the value every minute
- Updated android proxy endpoints to increment
`sails.androidProxyApiRequestCount` every time a request to the Android
management API is sent

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Monitoring**
* Added comprehensive tracking for Android Management API requests
across enrollment, enterprise, device, application, policy, and command
operations.
* Added periodic request-count logging and automatic resets when Android
Enterprise credentials are configured.
* Improved reporting alignment with minute-based API limits while
keeping logs quiet during periods without requests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-07 11:58:35 -05:00
Eric 632b4d924b Website: use shared Google API auth client in android proxy endpoints. (#47810)
Closes: https://github.com/fleetdm/fleet/issues/46496

Changes:
- Updated the website's custom hook to create a Google API auth client
and make it available at `sails.googleAuthClient`
- Updated Android proxy endpoints to use the shared Google API auth
client.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Optimized Google API authentication handling for Android management
features to improve system performance and reliability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-20 18:38:55 -05:00
Eric b2151decda Website: Add API rate limit alert to Android proxy endpoints (#35637)
Closes: https://github.com/fleetdm/fleet/issues/34358

Changes:
- Updated Android enterprise proxy endpoints to log an additional
warning to alert us if we exceed the Android management API rate limit.
2025-11-12 15:37:21 -06:00
Magnus Jensen 7e46d63db8 Android Proxy: Pass authClient to all calls (#35456)
This is another attempt at debugging/solving the current android proxy
bug.

This tries to not use the global google options, and instead just passes
the authClient directly to all google calls.

The other PR with wait, did initially succeed for me, but then failed
right after.
2025-11-11 09:29:18 -03:00
Magnus Jensen a3170ad8d9 Android Proxy: Wait 1 second + add back retry with big delays (#35449)
Another debugging attempt, at the Android Proxy create enterprise bug.
2025-11-10 17:19:04 -03:00
Magnus Jensen da27c3f08b Android Proxy: debug token scopes for android enterprise creation (#35237)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Attempt at debugging #34776 

Another attempt to further debug this issue. This attempt tries to
verify that the scopes for the token is correct, and is not overriden by
another call to the scopes.

The reason is that the `www-authenticate` response header is saying
`error="insufficient_scope"`
2025-11-06 11:14:42 -03:00
Magnus Jensen c1428f4a98 Remove sails flow.build around getIamPolicy call (#35225)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Attempt at solving #34776 

This was verified by extracting the create topic, and getIamPolicy, and
without the flow.build it worked fine, but when added it started
failing.
2025-11-05 15:54:57 -03:00
Jordan MontgomeryandEric 4bedbca6c2 Add a bit of time to the Android proxy creation retry (#35174)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #34776 

Adds delay to subsequent retries on creation of Android enterprise

---------

Co-authored-by: Eric <eashaw@sailsjs.com>
2025-11-05 09:13:13 -05:00
Eric 1e6b45acdc Website: retry getIamPolicy and setIamPolicy methods in create-android-enterprise (#35165)
Related to: https://github.com/fleetdm/fleet/issues/34776

Changes:
- Updated the create-android-enterprise endpoint to retry the
getIamPolicy and setIamPolicy methods when creating a new android
enterprise.
2025-11-04 14:55:35 -05:00
Magnus Jensen 50c15bd999 add warn log statement to get the error of a 400 if it's not an invalid token error (#35054)
This PR adds a small log warn statement to the fleetdm proxy for a 400
error on creating enterprise that is not an invalid token.

See this slack thread about the issue, and missing error log to further
debug the issue, unless running it locally, and then it is sometimes not
reproducable.
2025-10-31 12:52:39 -03:00
Eric 1799c824b1 Website: Update Android proxy endpoints exits (#34135)
Changes:
- Updated the website's Android proxy endpoints to use action2 exit
signals.
2025-10-10 17:11:42 -05:00
Carlo 1ebf13219a Pass along particular 4xx errors from Google (#32817)
Fixes #32703. Intercept and pass along some 4xx errors from Google.
2025-09-11 11:57:29 -04:00
Eric 9438cf1346 Website: Update create-android-enterprise exits (#31538)
Closes: https://github.com/fleetdm/fleet/issues/31506

Changes:
- Updated the `create-android-enterprise` action to return a 409
response if a database record already exists for the Android enterprise.
2025-08-01 16:12:39 -05:00
EricandVictor Lyuboslavsky 4272df375a Website: Add android proxy endpoints (#28267)
Related to: https://github.com/fleetdm/fleet/issues/26270

Changes:
- Added a new database model: `AndroidEnterprise`
- Added one new website dependency: `googleapis@148.0.0`
- Added `android-proxy/create-android-signup-url`: an endpoint that
returns a signup url used to grant access to Fleet's Android MDM
integration.
- Added `android-proxy/create-android-enterprise`: An endpoint that
creates an Android enterprise for a Fleet server
- Added `android-proxy/create-android-enrollment-token`: An endpoint
that returns an enrollment token for an Android enterprise
- Added `android-proxy/modify-android-policies`: An endpoint used to
update policies of an Android enterprise
- Added `android-proxy/delete-one-android-enterprise`: an endpoint that
deletes an Android enterprise

---------

Co-authored-by: Victor Lyuboslavsky <victor@fleetdm.com>
2025-06-12 13:23:49 -05:00