fleet/server/service
Lucas Manuel Rodriguez 328004d679
Log failed login attempts as activities (#9430)
#9119

To test the SSO changes locally you can use:

https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Testing-and-local-development.md#testing-sso

@RachelElysia Please take a look at the UI changes (All I did was
copy/paste and amend the changes for the new activity type.)

IMO we shouldn't display an avatar because there's no "actual user"
involved in these failed login attempts activities (by "actual user" I
mean the user attributed to the activity):

<img width="446" alt="Screenshot 2023-01-19 at 10 41 05"
src="https://user-images.githubusercontent.com/2073526/213524771-b85901ce-eec0-4cf3-919c-73162285e20b.png">

- [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 API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)
- ~[ ] Documented any permissions changes~
- ~[ ] 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.~
- [X] Added/updated tests
- [X] 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-01-20 12:43:22 -03:00
..
async Ingest pending MDM hosts (#9065) 2022-12-26 15:32:39 -06:00
externalsvc Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
middleware Set authz checked when rate limiting device endpoints (#6702) 2022-07-18 14:22:49 -03:00
mock Add distributed discovery query support for detail queries, add orbit… (#4597) 2022-03-15 16:51:00 -03:00
osquery_utils Add summary of hardcoded detail queries (#9425) 2023-01-19 17:44:03 -03:00
redis_policy_set Migrate team-related endpoints to new pattern (#3740) 2022-01-19 10:52:14 -05:00
schedule Fix race on TestTriggerMultipleInstances (#9122) 2022-12-26 12:32:37 -03:00
testdata add endpoint to serve the kolide certificate back to the user (#1025) 2017-01-20 14:32:10 -05:00
activities.go Log failed login attempts as activities (#9430) 2023-01-20 12:43:22 -03:00
activities_test.go add attribute to GET /activities endpoint with pagination metadata (#9279) 2023-01-18 12:57:11 +00:00
appconfig.go Flag when the Apple BM terms have expired (#9091) 2023-01-06 17:44:20 -03:00
appconfig_test.go Add new configuration option to set default team for Apple Business Manager (#9062) 2023-01-03 16:14:18 -06:00
apple_mdm.go use nanomdm's multi service + integration tests and fixes (#9269) 2023-01-16 17:06:30 -03:00
apple_mdm_test.go use nanomdm's multi service + integration tests and fixes (#9269) 2023-01-16 17:06:30 -03:00
base_client.go Orbit: log response body to ease troubleshooting (#9096) 2022-12-23 13:21:49 -03:00
base_client_errors.go Add fleetctl trigger command (#8877) 2022-12-06 09:56:54 -06:00
base_client_test.go enhance support for orbit and fleet desktop in osquery-perf (#8217) 2022-10-28 14:27:21 -03:00
campaigns.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
campaigns_test.go Make activities typed and auto-generate docs for each type (#9069) 2022-12-23 13:05:16 -03:00
carves.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
carves_test.go report errors that can occur during file carving (#8972) 2022-12-09 13:21:30 -03:00
client.go Add Apple MDM functionality (#7940) 2022-10-05 19:53:54 -03:00
client_appconfig.go Validate team and appconfig payloads, with dry-run and force modes (#7731) 2022-09-19 13:53:44 -04:00
client_apple_mdm.go Add Apple MDM functionality (#7940) 2022-10-05 19:53:54 -03:00
client_carves.go Introduce API version 2022-04, deprecate use of /global in paths (#4731) 2022-04-05 11:35:53 -04:00
client_debug.go don't clear errors automatically when reading them from Redis (#5623) 2022-05-10 11:44:43 -03:00
client_hosts.go Add display_name to more results (#8204) 2022-10-14 11:14:18 -03:00
client_labels.go Introduce API version 2022-04, deprecate use of /global in paths (#4731) 2022-04-05 11:35:53 -04:00
client_live_query.go Send custom headers for live queries (#8991) 2022-12-12 07:56:35 -08:00
client_live_query_test.go Add display_name to more results (#8204) 2022-10-14 11:14:18 -03:00
client_mdm.go Add command get mdm-apple-bm to fleetctl (#8949) 2022-12-12 15:45:53 -05:00
client_packs.go Introduce API version 2022-04, deprecate use of /global in paths (#4731) 2022-04-05 11:35:53 -04:00
client_policies.go Introduce API version 2022-04, deprecate use of /global in paths (#4731) 2022-04-05 11:35:53 -04:00
client_queries.go Introduce API version 2022-04, deprecate use of /global in paths (#4731) 2022-04-05 11:35:53 -04:00
client_sessions.go Introduce API version 2022-04, deprecate use of /global in paths (#4731) 2022-04-05 11:35:53 -04:00
client_setup.go fleetctl preview to use v1 setup path, to support previous versions of fleet (#5331) 2022-04-25 10:02:21 -03:00
client_software.go add upgrade tests (#6596) 2022-07-19 15:11:51 -06:00
client_targets.go Add display_name to more results (#8204) 2022-10-14 11:14:18 -03:00
client_teams.go Validate team spec unknown keys (#8265) 2022-10-24 08:49:44 -04:00
client_trigger.go Add fleetctl trigger command (#8877) 2022-12-06 09:56:54 -06:00
client_users.go Introduce API version 2022-04, deprecate use of /global in paths (#4731) 2022-04-05 11:35:53 -04:00
cron_schedues_test.go Fix cron trigger bug (#8950) 2022-12-16 12:00:42 -06:00
cron_schedules.go Implement schedule triggers (#8747) 2022-11-28 13:28:06 -06:00
debug_handler.go Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
debug_handler_test.go Add fleetctl debug migrations command to get missing migrations (#2967) 2021-11-22 14:06:12 -03:00
device_client.go Fleet desktop should use lightweight endpoint for getting failing policies count (#8159) 2022-10-12 17:13:43 -03:00
device_client_test.go Fleet desktop should use lightweight endpoint for getting failing policies count (#8159) 2022-10-12 17:13:43 -03:00
devices.go Implement API endpoint for MDM manual enrollment profile download (#9232) 2023-01-16 10:22:12 -05:00
endpoint_campaigns.go Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
endpoint_middleware.go Orbit remote management for flags (#7246) 2022-09-24 00:30:23 +05:30
endpoint_middleware_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
endpoint_setup.go Add read replica testing helpers and fix non-sso login bug (#4908) 2022-04-04 16:52:05 -07:00
endpoint_utils.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
endpoint_utils_test.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
frontend.go add browser-related security headers to HTML responses (#8180) 2022-10-12 10:19:21 -03:00
global_policies.go Run authorization check before processing policy spec (#9270) 2023-01-18 12:26:32 -03:00
global_policies_test.go Make activities typed and auto-generate docs for each type (#9069) 2022-12-23 13:05:16 -03:00
global_schedule.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
global_schedule_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
handler.go use nanomdm's multi service + integration tests and fixes (#9269) 2023-01-16 17:06:30 -03:00
handler_test.go Implement API endpoint for MDM manual enrollment profile download (#9232) 2023-01-16 10:22:12 -05:00
hosts.go Fix panic in hosts/{id}/mdm endpoint when host does not have MDM data (#9123) 2022-12-27 16:22:37 -03:00
hosts_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
http_auth.go Remove unused request-id in context (#3632) 2022-01-13 14:12:56 -08:00
http_auth_test.go Make activities typed and auto-generate docs for each type (#9069) 2022-12-23 13:05:16 -03:00
http_publicip.go Log all successful logins as activity and all attempts with ip in stderr. (#9095) 2022-12-21 18:29:51 +01:00
installer.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
installer_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
integration_core_test.go Log failed login attempts as activities (#9430) 2023-01-20 12:43:22 -03:00
integration_desktop_test.go Ingest pending MDM hosts (#9065) 2022-12-26 15:32:39 -06:00
integration_ds_only_test.go Support async saving of hosts' last seen time (#5640) 2022-05-10 11:29:17 -04:00
integration_enterprise_test.go Implement API endpoint for MDM manual enrollment profile download (#9232) 2023-01-16 10:22:12 -05:00
integration_live_queries_test.go Ingest pending MDM hosts (#9065) 2022-12-26 15:32:39 -06:00
integration_logger_test.go Ingest pending MDM hosts (#9065) 2022-12-26 15:32:39 -06:00
integration_mdm_test.go Fix a flaky integration test (#9382) 2023-01-17 15:33:27 -05:00
integration_sandbox_test.go add browser-related security headers to HTML responses (#8180) 2022-10-12 10:19:21 -03:00
integration_sso_test.go Log failed login attempts as activities (#9430) 2023-01-20 12:43:22 -03:00
invites.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
invites_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
jitter.go Migrate special-case endpoints to new pattern (#4511) 2022-03-08 11:27:38 -05:00
jitter_test.go Migrate special-case endpoints to new pattern (#4511) 2022-03-08 11:27:38 -05:00
labels.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
labels_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
live_queries.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
mdm.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
mdm_test.go Implement fleetctl get mdm-apple (#8786) 2022-12-05 11:35:45 -05:00
mem_failing_policies_set_test.go Fix failing policy sets for redis cluster mode (#3725) 2022-01-17 15:16:54 -05:00
metrics.go Issue 1362 fleetctl user roles (#1397) 2021-07-16 15:28:13 -03:00
metrics_appconfig.go Validate team and appconfig payloads, with dry-run and force modes (#7731) 2022-09-19 13:53:44 -04:00
metrics_change_email.go Update go-kit to 0.4.0 (#1411) 2017-03-15 08:55:30 -07:00
metrics_invites.go Add v4 suffix in go.mod (#1224) 2021-06-25 21:46:51 -07:00
metrics_labels.go Add v4 suffix in go.mod (#1224) 2021-06-25 21:46:51 -07:00
metrics_sessions.go add back-end implementation for SSO JIT provisioning (#7182) 2022-08-15 14:42:33 -03:00
metrics_users.go Add v4 suffix in go.mod (#1224) 2021-06-25 21:46:51 -07:00
orbit.go Notify orbit via the GET config endpoint that the DEP profile needs to be renewed (#9373) 2023-01-17 13:19:48 -05:00
orbit_client.go Notify orbit via the GET config endpoint that the DEP profile needs to be renewed (#9373) 2023-01-17 13:19:48 -05:00
osquery.go Add feature to change or disable Fleet's hardcoded detail queries (#9117) 2023-01-09 08:56:10 -03:00
osquery_test.go Add feature to change or disable Fleet's hardcoded detail queries (#9117) 2023-01-09 08:56:10 -03:00
packs.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
packs_test.go Make activities typed and auto-generate docs for each type (#9069) 2022-12-23 13:05:16 -03:00
queries.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
queries_test.go Make activities typed and auto-generate docs for each type (#9069) 2022-12-23 13:05:16 -03:00
scheduled_queries.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
scheduled_queries_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
service.go Add new configuration option to set default team for Apple Business Manager (#9062) 2023-01-03 16:14:18 -06:00
service_appconfig.go Generate audit logs for activities (#9001) 2022-12-23 19:04:13 -03:00
service_appconfig_test.go Generate audit logs for activities (#9001) 2022-12-23 19:04:13 -03:00
service_campaign_test.go Make activities typed and auto-generate docs for each type (#9069) 2022-12-23 13:05:16 -03:00
service_campaigns.go Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
service_errors.go Improve developer documentation: Update seed data documentation (#7904) 2022-10-05 12:42:45 -04:00
service_users.go Make activities typed and auto-generate docs for each type (#9069) 2022-12-23 13:05:16 -03:00
sessions.go Log failed login attempts as activities (#9430) 2023-01-20 12:43:22 -03:00
sessions_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
software.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
software_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
status.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
targets.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
targets_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
team_policies.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
team_policies_test.go Make activities typed and auto-generate docs for each type (#9069) 2022-12-23 13:05:16 -03:00
team_schedule.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
team_schedule_test.go Refactor license so it is stored in the context (#8544) 2022-11-15 09:08:05 -05:00
teams.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
teams_test.go Make activities typed and auto-generate docs for each type (#9069) 2022-12-23 13:05:16 -03:00
testing_client.go Add feature to change or disable Fleet's hardcoded detail queries (#9117) 2023-01-09 08:56:10 -03:00
testing_utils.go use nanomdm's multi service + integration tests and fixes (#9269) 2023-01-16 17:06:30 -03:00
translator.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
transport.go Add mdm enrollment pending filter to API endpoints (#9137) 2023-01-03 11:26:23 -06:00
transport_error.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
transport_error_test.go Create errors with ctxerr, add the call to store them in redis (#2786) 2021-11-15 09:11:38 -05:00
transport_setup.go Update go-kit to 0.4.0 (#1411) 2017-03-15 08:55:30 -07:00
transport_test.go Add v4 suffix in go.mod (#1224) 2021-06-25 21:46:51 -07:00
trigger.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
user_roles.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
users.go Set interface for response types (#9121) 2022-12-27 11:26:59 -03:00
users_test.go Make activities typed and auto-generate docs for each type (#9069) 2022-12-23 13:05:16 -03:00
validation_setup.go Use new error handling approach in other packages (#2954) 2021-11-22 09:13:26 -05:00