Commit Graph

501 Commits

Author SHA1 Message Date
Zach Wasserman
6f6464f206
Migrate remaining URLs to fleetdm.com (#116) 2020-12-10 11:26:00 -08:00
Zach Wasserman
9ff16a370c
Improve MySQL transaction error logging (#113)
Clarify what exactly happened when logging these errors.
2020-12-10 11:05:15 -08:00
Zach Wasserman
beb7e8b965
Add host enrollment cooldown period (#112)
This addresses an issue some users experienced in which performance
problems were encountered when hosts were "competing" for enrollment
using the same osquery host identifier. The issue is addressed by adding
a cooldown period for host enrollment, preventing the same (as judged by
osquery host identifier) host from enrolling more than once per minute.

When users end up in the problematic scenario, they will see quite a bit
of error logs due to this issue. For now that's probably a good thing as
users need to be aware of the lack of visibility. We can explore rate
limiting the logging if that becomes an issue for someone.

Fixes #102
2020-12-10 11:04:58 -08:00
Zach Wasserman
bb921bc973
Allow scheduling same query more than once in UI (#96)
Fixes #88
2020-12-04 09:50:39 -08:00
noahtalerman
51cfb07f64
Implement global colors. Add italic font. (#64)
The goal of this PR was to insert new colors, remove legacy colors, and update only the styles accordingly. The Nunito Sans Italic font was also added.

Later PRs will include layout, copy, and style change to individual components. These later changes will more exactly resemble the current mockups.
2020-11-24 08:59:03 -08:00
noahtalerman
8df16949f5
Add fleet assets including logos, 404 image, and 500 image. (#61)
This is the second PR as part of the Fleet UI Refresh #38.

The goal of this PR was to insert all updated Fleet assets and remove all old assets. More style changes, including the exact sizing and placement of the new images, will occur in a future PR.
2020-11-23 11:22:42 -08:00
noahtalerman
23ce98ec51
Add Nunito Sans font and update global styles. (#59)
This is the first PR as a part of the Fleet UI Refresh #38.

Changes include:

- Add Nunito Sans font files and modify global styles to reflect the font change.
- Modify global font variables to reflect new sizing and weight naming conventions.
-- New sizing and naming conventions:
--- SIZE: xx-small: 12px, x-small: 14px, small: 16px, medium: 20px, large: 24px, x-large: 28px
--- WEIGHT: regular: 400, bold: 700
- Remove the old Oxygen font files.

Changes to other style sheets reflect the changes to the new font sizing and weight naming conventions for global variables. The changes don't necessarily use the correct size (as illustrated by mockups). Those "up to spec" sizing changes are to come.
2020-11-19 16:51:22 -08:00
Zach Wasserman
eea6aa5c64
Fix unexpected print of migration status warning (#50)
Replace the now-deleted migration
server/datastore/mysql/migrations/data/20181119180000_DeleteSoftDeletedEntities.go
with a new migration containing the same timestamp. This allows Fleet to
see the appropriate migration state for users upgrading from previous
versions without actually modifying the DB.

Fixes #48
2020-11-18 11:44:06 -08:00
Zach Wasserman
e7912c2d31
Minor code/comment cleanups (#47)
- Fixes an initialization error panic to a fatal log
2020-11-18 11:10:55 -08:00
Zach Wasserman
0bb9d69ece
Add debug endpoints and associated fleetctl commands (#45)
Adds endpoints and fleetctl commands to retrieve various debug profiles
from the Fleet server.

The best summary is from the help text:

```
fleetctl debug
NAME:
   fleetctl debug - Tools for debugging Fleet

USAGE:
   fleetctl debug command [command options] [arguments...]

COMMANDS:
   profile    Record a CPU profile from the Fleet server.
   cmdline    Get the command line used to invoke the Fleet server.
   heap       Report the allocated memory in the Fleet server.
   goroutine  Get stack traces of all goroutines (threads) in the Fleet server.
   trace      Record an execution trace on the Fleet server.
   archive    Create an archive with the entire suite of debug profiles.

OPTIONS:
   --config value   Path to the Fleet config file (default: "/Users/zwass/.fleet/config") [$CONFIG]
   --context value  Name of Fleet config context to use (default: "default") [$CONTEXT]
   --help, -h       show help
```
2020-11-17 17:12:37 -08:00
Zach Wasserman
ab94d94da0
Fix fleetctl Windows issues (#40)
- Properly set the path for the config file on Windows.
- Check for appropriate settings for TLS config.

Fixes #39
2020-11-17 16:02:14 -08:00
billcobbler
618ba56484
Add host additional info filters (#28)
This change adds the ability to filter additional host info via the list hosts endpoint; a continuation from [here](https://github.com/kolide/fleet/pull/2330), but now filtering is accomplished via SQL. 

Additional object without filter:
```
curl 'https://localhost:8080/api/v1/kolide/hosts'
...
"additional": {
        "macs": [
          {
            "mac": "00:00:00:00:00:00"
          },
          {
            "mac": "02:42:c0:a8:10:05"
          }
        ],
        "time": [
          {
            "day": "13",
            "hour": "3",
            "year": "2020",
            "month": "10",
            "minutes": "43",
            "seconds": "11",
            "weekday": "Tuesday",
            "datetime": "2020-10-13T03:43:11Z",
            "iso_8601": "2020-10-13T03:43:11Z",
            "timezone": "GMT",
            "timestamp": "Tue Oct 13 03:43:11 2020 UTC",
            "unix_time": "1602560591",
            "local_time": "1602560591",
            "local_timezone": "UTC"
          }
},
...
```

Additional object with filter:
```
curl 'https://localhost:8080/api/v1/kolide/hosts?additional_info_filters=macs,notreal'
...
"additional": {
        "macs": [
          {
            "mac": "00:00:00:00:00:00"
          },
          {
            "mac": "02:42:c0:a8:10:05"
          }
        ],
        "notreal": null
},
...
```
2020-11-13 16:33:25 -08:00
Zach Wasserman
8f435a95ba
Allow @ character in usernames (#37)
PR #9 unintentionally exposed the validation that prevented the @
character in usernames. We have decided there is no reason to block this
character.

Fixes #36
2020-11-13 15:52:20 -08:00
Zach Wasserman
6cbd10965c
Add dev infrastructure and docs for Prometheus monitoring (#33)
- Set up a simple example of Prometheus monitoring in the development
  docker-compose.yml.
- Add documentation for configuring Prometheus.
2020-11-12 19:06:56 -08:00
Mike Arpaia
af96e52a00
Update the Go import paths to new repo name (#27) 2020-11-11 09:59:12 -08:00
noahtalerman
ecacbf212b
Changes to additional links for transition to fleetdm (#21) 2020-11-04 21:48:39 -08:00
Zachary Wasserman
a1720db58e
Fix regression creating packs (#17)
This is another error introduced in
https://github.com/kolide/fleet/pull/2327 we did not catch previously
due to insufficient unit test coverage. Test is now added.
2020-11-04 21:18:02 -08:00
Zachary Wasserman
e452cc6a8a
Add file carving support (#15)
- Add endpoints for osquery to register and continue a carve.
- Implement client functionality for retrieving carve details and contents in fleetctl.
- Add documentation on using file carving with Fleet.

Addresses kolide/fleet#1714
2020-11-04 20:45:16 -08:00
Zachary Wasserman
7c923d9d19
Implement fleetctl user create (#9)
- Allow user creation via `fleetctl user create`
- Cleanup and rename existing methods for clarity

Fixes https://github.com/kolide/fleet/issues/2306
2020-11-04 17:06:55 -08:00
Zachary Wasserman
fca44bb032
Make enroll secret and node key validation case-sensitive (#5)
- Modify column collation to make comparisons case-sensitive.
- Add tests for case-sensitivity.

Fixes https://github.com/kolide/fleet/issues/2333
2020-11-04 12:09:00 -08:00
Zachary Wasserman
2e333a4e2e
Fix regression in list hosts (#6)
Changes in https://github.com/kolide/fleet/pull/2327 broke the MySQL
syntax for listing hosts with online status. This was not caught due to
the lack of a unit test for the functionality. This PR adds a unit test
and fixes the regression.
2020-11-04 12:03:06 -08:00
Brendan Shaklovitz
c6b285c56e
Remove soft-deletion pattern (#2327)
* Perform migration to delete any entries with `deleted` set, and
subsequently drop columns `deleted` and `deleted_at`.
* Remove `deleted` and `deleted_at` references.

Closes #2146
2020-10-22 10:51:26 -07:00
Brendan Shaklovitz
8246b4d1f8
fleetctl: allow disabling packs via apply (#2325)
Closes issue #2240
2020-10-21 16:29:27 -07:00
Brendan Shaklovitz
59ba129718
Consistent use of constants in fleetctl (#2320)
Refactor fleetctl get & apply to use constants for spec kinds

Closes #2283
2020-10-08 10:16:07 -07:00
Zachary Wasserman
e8e4bc9879
Fix cleanup of orphaned queries (#2316)
The expiration logic was incorrect leading to queries not being cleaned
up properly. Tests added for the whole subroutine.

Fixes #2302
2020-10-06 09:30:24 -07:00
Zachary Wasserman
50dbdb3db4
Add explicit int64 for parsing physical_memory column (#2315)
Addresses an error when Fleet is compiled for a 32-bit architecture.

May not be comprehensive of all related errors.

Fixes #2314.
2020-10-05 17:03:32 -07:00
Zachary Wasserman
f2d3683d80
Log host identifier in EnrollAgent service logging (#2313)
This can help identify circumstances in which multiple hosts are
providing the same identifier and clobbering the node key for each
other.
2020-10-02 13:23:54 -07:00
Kilian
c61ba759dd
Add redis use_tls cfg (#2311)
Adding config parameter 'redis.use_tls' to enable tls communications with redis e.g. AWS ElastiCache

Closes #2247
2020-10-01 16:25:48 -07:00
Iain Steers
da99617882
Add DeleteHost func to service pkg (#2312) 2020-10-01 16:14:18 -07:00
James Alseth
692171dfdb
Fix string(int) in Kinesis logger for Go 1.15 compatibility (#2309) 2020-09-27 09:44:55 -07:00
Lars Lehtonen
d193ea1717
Remove Support for Deprecated TLSProfileOld (#2142)
Co-authored-by: Zachary Wasserman <zach@dactiv.llc>
2020-09-10 09:31:01 -07:00
James Alseth
3a63dac4a3
Add compression option for filesystem logs when they're rotated (#2292) 2020-09-09 13:33:32 -07:00
billcobbler
20328b0f87
Add stdout and kinesis logger plugins and sts assume role to Firehose (#2282)
Co-authored-by: Brendan Shaklovitz <nyanshak@users.noreply.github.com>
2020-08-19 14:56:44 -07:00
James Alseth
b67cfc479b
Fix string(int) issues for Go 1.15 compatibility (#2286) 2020-08-19 13:36:36 -07:00
Zachary Wasserman
34c4ce4ffb
Fix parsing of integer label_type in yaml (#2276)
Fixes #2273
2020-08-06 16:07:13 -07:00
Stephan Miehe
2ad5205a4b
Add support for conn_max_lifetime (#2270)
This adds support to configure MySQL conn_max_lifetime.
2020-07-30 09:00:42 -07:00
Stephan Miehe
cf4d8ecfee
Add redis database number support (#2269)
Fixes #2268
2020-07-30 08:57:25 -07:00
Zachary Wasserman
1058f57767
Remove noisy User log (#2265)
This log appears to add little value as it is generated by almost any
web UI request.
2020-07-22 09:49:34 -07:00
Zachary Wasserman
7494513400 Clean up and comments before merge. 2020-07-21 14:05:46 -07:00
Zachary Wasserman
96fc090723 Improve server performance for host operations
- Debounce frontend to reduce number of target searches in live query.
- More efficiently calculate label counts in live query and hosts
  dashboard. Instead of using the (slow) CountHostsInTargets function,
  retrieve the host counts while looking up the labels.
- Optimize targets search query. Removing the nested query retrieves the
  same logical result set, but substantially optimizes MySQL CPU usage.
  Testing indicates about a 50% reduction in MySQL CPU usage for the
  frontend targets search API call after applying this change.
2020-07-21 14:05:46 -07:00
Zachary Wasserman
fcb8418b2f Add fleetctl get host capability to get single host with labels
Getting a single host with `fleetctl get host foobar` will look up the
host with the matching hostname, uuid, osquery identifier, or node key,
and provide the full host details along with the labels the host is a
member of.
2020-07-21 14:05:46 -07:00
Zachary Wasserman
7f757d3144 Extract functionName into helper
Cleans up some repetition in tests.
2020-07-21 14:05:46 -07:00
Zachary Wasserman
42bea2a144 Implement manual labels
"Manual" labels can be specified by hostname, allowing users to specify
the membership of a label without having to use a dynamic query. See the
included documentation.
2020-07-21 14:05:46 -07:00
Zachary Wasserman
608772917c Refactor label membership storage
Label membership is now stored in the label_membership table. This is
done in preparation for adding "manual" labels, as previously label
membership was associated directly with label query executions.

Label queries are now all executed at the same time, rather than on
separate intervals. This simplifies the calculation of which distributed
queries need to be run when a host checks in.
2020-07-21 14:05:46 -07:00
Zachary Wasserman
b0595748f1 Implement pagination of hosts in the web UI
This commit takes advantage of the existing pagination APIs in the Fleet
server, and provides additional APIs to support pagination in the web
UI. Doing this dramatically reduces the response sizes for requests from
the UI, and limits the performance impact of UI clients on the Fleet and
MySQL servers.
2020-07-21 14:05:46 -07:00
Zachary Wasserman
0502412e15 Move live query operations from MySQL to Redis
This change optimizes live queries by pushing the computation of query
targets to the creation time of the query, and efficiently caching the
targets in Redis. This results in a huge performance improvement at both
steady-state, and when running live queries.

- Live queries are stored using a bitfield in Redis, and takes
advantage of bitfield operations to be extremely efficient.

- Only run Redis live query test when REDIS_TEST is set in environment

- Ensure that live queries are only sent to hosts when there is a client
listening for results. Addresses an existing issue in Fleet along with
appropriate cleanup for the refactored live query backend.
2020-07-21 14:05:46 -07:00
Zachary Wasserman
ea93843203 Store only primary IP and MAC for hosts
Fleet used significant resources storing the full network interface
information for each host. This data was unused, except to get the
IP and MAC of the primary interface. With these changes, only those
pieces of data are stored.

- Calculate and store primary IP and MAC
- Remove transaction for storing full interfaces
- Update targets search to use new IP and MAC columns
- Update frontend to use new new columns
2020-07-21 14:05:46 -07:00
Zachary Wasserman
fd61dcab67
Clean up unused DB tables, migrations, and code (#2258)
This PR removes unused types, code, DB tables, and associated migrations that are unused since Fleet 2.0.

An existing migration was refactored, and should remain compatible with both existing and new Fleet installations.
2020-07-08 13:02:18 -07:00
Zachary Wasserman
2578466697
Upgrade SockJS JS and Go dependencies (#2256) 2020-07-06 20:04:04 -07:00
Zachary Wasserman
c1aa8355cb
Add support for multiple enroll secrets (#2238)
- Support multiple enroll secrets
- Record name of enroll secret used when host enrolls
- Update fleetctl and UI to support these features
2020-05-29 09:12:39 -07:00