Commit Graph

117 Commits

Author SHA1 Message Date
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
Mike Arpaia
af96e52a00
Update the Go import paths to new repo name (#27) 2020-11-11 09:59:12 -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
f06c3cff93
Add pretty-printing option for query results (#4)
Use --pretty to enable this feature.

This will likely break on non-ANSI terminals.
2020-11-04 09:56:57 -08:00
Zachary Wasserman
72b0efca62
Fix handling of --quiet flag in fleetctl query (#2)
Fixes an issue in which the status was erroneously displayed after results were printed.
2020-11-03 15:50:36 -08: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
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
James Alseth
1d5f5d7eac
Add osquery_version to the table in fleetctl get hosts (#2304) 2020-09-25 10:15:42 -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
Brendan Shaklovitz
0cf47bf233
Fix fleetctl get options typo (#2281)
Fixes issue where `fleetctl get options` returns `option` (singular)
as `kind` instead of `options` (plural). This would cause `fleetctl
apply -f options.yml` to fail on options yaml generated by `fleetctl get
options` with this error: `unknown kind "option"`.
2020-08-07 15:28:24 -07:00
Zachary Wasserman
0619581b03
Print single secret value if name specified (#2274)
Closes #2272
2020-08-03 11:51:29 -07:00
Stephan Miehe
cf4d8ecfee
Add redis database number support (#2269)
Fixes #2268
2020-07-30 08:57:25 -07:00
Zachary Wasserman
4023296d86
Log at debug level when configured (#2262)
We added debug/info log levels in #2225 but the configuration was not
actually used to set the level.
2020-07-21 15:35:57 -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
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
b76b23e6ee
Fix yaml separator handling with comments (#2257)
Fixes #2245
2020-07-08 16:01:03 -07:00
grantseltzer
755f63f8c0
Refactor fleetctl get subcommands so that they all have json and yaml output options (#2244) 2020-06-23 08:11:47 -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
Zachary Wasserman
6dbc3bc77a
Implement fleetctl goquery (#2186)
- Update fleet APIs to support necessary operations in goquery
- Implement support for goquery in fleetctl
2020-01-23 21:27:20 -08:00
Serrvosky
19896d25f7 Adding query-name flag to fleetctl query (#2185)
Added a feature to select queries by name. If --query-name flag is defined, fleetctl makes a call to get the query already saved in Fleet, and then, if it exists, fill flQuery variable with the selected query statement.

Closes #2175
2020-01-20 22:16:11 -08:00
Zachary Wasserman
71eef8a315
Require non-nil status for exit of fleetctl query (#2184)
Fixes an issue some users encountered in which the query would exit
before any results were returned (when latency to the Fleet server was
high).
2020-01-16 17:45:26 -08:00
billcobbler
a856fd5c0b Add fleetctl get/apply config (#2143)
Implements #1953
2019-11-19 21:13:15 -08:00
Zachary Wasserman
adf87140a7
Add ability to prefix Fleet URLs (#2112)
- Add the server_url_prefix flag for configuring this functionality
- Add prefix handling to the server routes
- Refactor JS to use appropriate paths from modules
- Use JS template to get URL prefix into JS environment
- Update webpack config to support prefixing

Thanks to securityonion.net for sponsoring the development of this feature.

Closes #1661
2019-10-16 16:40:45 -07:00
Michael Samuel
523967bd74 Add --with-queries flag to get packs (#2095)
Closes #2052 #1975
2019-08-14 10:44:23 -07:00
Michael Samuel
bdeea59c73 fleetctl: add --yaml flag to get command for labels, packs, and queries (#2092)
Closes #1813
2019-08-13 09:41:40 -07:00
Zachary Wasserman
955972e1a1
Cleanup incoming hosts that do not complete enrollment (#2026)
Deletes hosts that have enrolled but never updated their details (these
hosts show up as "incoming host" in the UI).

Closes #1438
2019-04-09 11:11:11 -07:00
Zachary Wasserman
e59714242e
Add Firehose logging capabilities for result and status logs (#2022)
- Refactor configuration for logging to use separate plugins
- Move existing filesystem logging to filesystem plugin
- Create new AWS firehose plugin
- Update documentation around logging
2019-04-08 11:47:15 -07:00
Zachary Wasserman
03c23973ca
Small cleanup in live query code (#2011)
- Additional comments
- Fix some cases where websocket may not be closed appropriately
2019-03-10 13:51:11 -07:00
Zachary Wasserman
16cf164adb
Add --timeout flag to fleetctl query (#1989)
This change makes it easier to run `fleetctl query` within scripts, by providing
an option to halt the query after a timeout has passed.

Closes #1987
2019-01-15 11:06:22 -08:00
blaedj
be85377326
Add 'get hosts' command to fleetctl (#1977)
This commit:
 - adds a new sub-command for fetching hosts to `fleetctl get` command.

Why?
 - this allows for listing of all hosts via the fleetctl interface.
 There may be additional attributes of the host that we'd like to
 display, but this should be a good start.

Closes #1962
2019-01-03 16:19:23 -06:00
Zachary Wasserman
0f99b454a0
Add username support to fleetctl setup (#1971)
Username continues to default to email if not specified in the options.

Closes #1970
2019-01-02 15:27:37 -08:00
Jordan R
1c6ab46e40 Properly convert intervals in fleetctl convert (#1969)
Fixes a bug in which unquoted integers end up as 0 after conversion.
2018-12-20 17:43:00 -08:00
adamenger
a99313533d Added custom CA support to fleetctl client (#1931) 2018-10-01 15:23:46 -07:00
Thordur Bjornsson
832365c1d4 Fleetctl query improvements (#1888)
- Exit when all targeted hosts have responded
- Pause the spinner when outputting logs so that output is cleaner
2018-09-07 15:37:10 -07:00
Jeremy Rossi
473dc3e265 Add --quiet and --exit arguments for fleetctl query (#1887)
--quiet will disable all printing other than errors and results
--exit will quit and exit when 100% online hosts have returned results
2018-08-16 15:31:18 -07:00
Zachary Wasserman
614fc9d3c5
Confirm password on setup (#1866) 2018-07-16 10:03:50 -07:00
Zachary Wasserman
e62d2f57df
Improve error message when client is not logged in (#1867) 2018-07-16 09:35:21 -07:00
Zachary Wasserman
a7dd64fb0b
Fix newline handling in fleetctl convert (#1856)
Previously we stripped all non-word characters which worked for some cases, but
removed necessary characters in others. What we really want (and now do) is to
remove only whitespace characters.

Fixes #1854
2018-06-28 12:02:46 -07:00
Zachary Wasserman
c4f2850e38
Remove erroneously committed API binary (#1835) 2018-06-18 11:26:11 -07:00
Zachary Wasserman
34a8b9ee53
Fix newline handling while converting osquery JSON (#1831)
Fixes #1828
2018-06-18 10:08:23 -07:00
Mike Arpaia
4ddb691524
Remove -f from fleetctl query (#1814)
close #1812
2018-06-04 22:28:49 -06:00
Mike Arpaia
1d70b082a5
Add a setup guide for new CLI users (#1798) 2018-05-22 17:57:56 -06:00
Mike Arpaia
bd91095905
Fleet 2.0.0 Changlelog (#1797)
This PR adds a "New Features" and "Upgrade Plan" section to the pending 2.0.0 release notes.

close #1793 
close #1794
2018-05-22 12:48:18 -06:00
Mike Arpaia
abab0d4691
Add fleetctl convert command for migrating packs to Fleet's format (#1790) 2018-05-21 10:26:22 -06:00
Zachary Wasserman
e626d5d060 Add options clients and commands (#1791) 2018-05-21 10:25:58 -06:00
Zachary Wasserman
b80e0a102d
Add fleetctl query command (#1784)
Allow queries targeted by hostname and label name.
2018-05-17 15:54:34 -07:00
Zachary Wasserman
28be59c9a5 Rename ignore-tls flag to insecure (#1779) 2018-05-17 16:52:38 -06:00
Thordur Bjornsson
6a4d50c7a6 ensure email and passwords are set during setup (#1786) 2018-05-17 08:29:04 -06:00
Zachary Wasserman
d7b0abd782
Clean up flag descriptions (#1778) 2018-05-09 16:54:07 -07:00
Zachary Wasserman
6e6e390346
Add interactive login support (#1771) 2018-05-08 18:34:09 -07:00
Mike Arpaia
ab23e60a98
Add fleetctl get label, pack, query for individual items by name (#1768)
This PR adds support for getting resources by name.

```
$ fleetctl get queries
no queries found

$ fleetctl apply -f ./query.yaml
[+] applied 1 queries

$ fleetctl get queries
+-----------------+--------------------------------+--------------------------------+
|      NAME       |          DESCRIPTION           |             QUERY              |
+-----------------+--------------------------------+--------------------------------+
| osquery_version | The version of the Launcher    | select launcher.version,       |
|                 | and Osquery process            | osquery.version from           |
|                 |                                | kolide_launcher_info launcher, |
|                 |                                | osquery_info osquery;          |
+-----------------+--------------------------------+--------------------------------+

$ fleetctl get query osquery_version
apiVersion: v1
kind: query
spec:
  description: The version of the Launcher and Osquery process
  name: osquery_version
  query: select launcher.version, osquery.version from kolide_launcher_info launcher,
    osquery_info osquery;
```
2018-05-08 18:10:01 -06:00
Zachary Wasserman
e8cd007810
Consistent permissions for ~/.fleet/config file (#1772) 2018-05-08 17:04:38 -07:00
Mike Arpaia
64a75c3b57
fleetctl get labels, queries, and packs (#1764) 2018-05-07 20:09:37 -06:00
Mike Arpaia
20fb50a7a6
Add fleetctl delete command (#1765) 2018-05-07 20:07:00 -06:00
Mike Arpaia
2795a61b3c
Working prototype of fleetctl apply (#1762) 2018-05-07 17:50:20 -06:00
Mike Arpaia
018e10ea66
Add fleetctl config and auth commands (#1751)
```
$ fleetctl config set address https://localhost:8080
[+] Set the "address" config key to "https://localhost:8080" in the "default" context

$ fleetctl config set ignore_tls true
[+] Set the "ignore_tls" config key to "true" in the "default" context

$ fleetctl setup --email mike@arpaia.co --password "abc123"
[+] Fleet setup successful and context configured!

$ cat ~/.fleet/config
contexts:
  default:
    address: https://localhost:8080
    email: mike@arpaia.co
    ignore_tls: true
    token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uX2tleSI6IlUvdm05Vk9wSG0xUlA4SUtjQnBhb2ovWlo1TXppSEVXcFRCNFNPb2tHQnNLUFpDQXFieVpWWnpJb0UvczQzcWkyd1pHZXJOa29SNFVIQ2hNZUc0K09RPT0ifQ.rHawSN8JvD4jjWAPTYX2Ep9ZpMt3u4mSIQcu920C-_s

$ fleetctl logout
[+] Fleet logout successful and local token cleared!

$ cat ~/.fleet/config
contexts:
  default:
    address: https://localhost:8080
    email: mike@arpaia.co
    ignore_tls: true
    token: ""
```
2018-05-04 10:53:21 -06:00
Mike Arpaia
920f4afab6
Scaffold the login command (#1748) 2018-05-01 16:58:53 -06:00
Mike Arpaia
93a346463b
New fleetctl CLI structure (#1719) 2018-05-01 12:14:05 -06:00
Mike Arpaia
76ce270cbd
include forgotten fleetctl config command 2017-11-12 11:59:39 -07:00
Mike Arpaia
796e0af8be
Initial CLI and file format for fleetctl
This PR implements a program called `fleetctl` which scaffolds a high level CLI interface which can be used to manage a Fleet server. Configuration is articulated using an intent-based API that resembles the API that is used to configure Kubernetes clusters. The idea here is to use the Kubernetes file format as a pattern to reduce the need for operators to become too intimately familiar with dramatically different file formats. (#1578)
2017-11-12 11:58:19 -07:00
Victor Vrantchan
5ad562a952 refactor gRPC endpoints with launcher packages in mind (#1582)
The launcher service implementation is an adapter around the TLS service.
All launcher methods that have an equivalent in TLS pass the business logic to the
TLS API.

Closes #1565
2017-10-24 19:55:32 -04:00
Victor Vrantchan
c496eb8df2 add health package to create reusable healthz checks. (#1583)
Moved the healthz handler and exposed the CheckHealth method so the same healthchecks could be
used by TLS, gRPC and any other APIs.
2017-10-23 14:39:15 -04:00
Mike Arpaia
1e16b12638 Move cli directory to cmd/fleet (#1560) 2017-10-12 10:42:13 -06:00