Commit Graph

224 Commits

Author SHA1 Message Date
Tomas Touceda
ece05eeaed
Issue 1321 usage statistics (#1415)
* WIP

* Send usage analytics

* Improve loggin of cron tasks and fix test

* Implement appconfig method now that we are checking that as well

* Address review comments
2021-07-20 18:39:50 -03:00
Tomas Touceda
9863b0f4bb
Issue 1361 fleetctl teams (#1405)
* WIP

* Add get user_roles and apply for a user_roles spec to fleetctl

* Uncomment other tests

* Update test to check output

* Update test with the new struct

* Mock token so that it doesn't pick up the one in the local machine

* Address review comments

* Fix printJSON and printYaml

* Fix merge conflict error

* WIP

* wip

* wip

* Finish implementation

* Address review comments

* Fix flaky test
2021-07-19 16:48:49 -03:00
Tomas Touceda
29570bd860
Issue 1278 select leader (#1367)
* Add leader selection

* remove comment

* Address review comments

* Add changes file

* Simplify implementation

* Simplify further

* Whoops, removed a little too much
2021-07-19 15:08:41 -03:00
Tomas Touceda
545b3f396e
Issue 1362 fleetctl user roles (#1397)
* WIP

* Add get user_roles and apply for a user_roles spec to fleetctl

* Uncomment other tests

* Update test to check output

* Update test with the new struct

* Mock token so that it doesn't pick up the one in the local machine

* Address review comments

* Fix printJSON and printYaml

* Fix merge conflict error

* If both roles are specified, fail

* Fix test

* Switch arguments around

* Update test with the new rule

* Fix other tests that fell through the cracks
2021-07-16 15:28:13 -03:00
Zach Wasserman
c5280c0517
Add v4 suffix in go.mod (#1224) 2021-06-25 21:46:51 -07:00
RachelElysia
aeb852e168
Remove username from UI (#1168)
* Remove username from UI code
* Remove username from tests
* Remove username from database
* Modify server endpoints for removing username
* Implement backend aspects of removing username
* Update API docs
* Add name to fleetctl
2021-06-24 13:42:29 -07:00
Zach Wasserman
1417d01407
Make naming of host columns consistent (#1183)
Adding consistency between API and DB helps to make it easier for users
and developers working with the API to correctly order things.

Closes #317
2021-06-23 17:32:19 -07:00
Zach Wasserman
0a77f79d22
Backend and fleetctl for usage analytics (#1167)
- Add enable_analytics column to database.
- Allow enable_analytics to be set via API.
- Add messaging in fleetctl setup.

Note that this defaults to off for existing installations, and defaults
on for newly set up installs.

No collection or sending of analytics yet exists, we are strictly
storing the preference at this time.

Part of #454
2021-06-22 18:02:20 -07:00
Zach Wasserman
11daebac39
Properly append to env in preview command execs (#1139)
The previous strategy unintentionally cleared existing environment
values, preventing us from setting a specific version of the Fleet
container to run.
2021-06-18 11:58:15 -07:00
Zach Wasserman
2ad557e3b3 Merge branch 'main' into teams 2021-06-18 09:42:20 -07:00
dsbaha
47b423ee29
Add Redis cluster support (#1045)
This should support Redis in both cluster and non-cluster modes.

Updates were made separately to github.com/throttled/throttled to support the slight changes in types.

Co-authored-by: Joseph Macaulay <joseph.macaulay@uber.com>
Co-authored-by: Zach Wasserman <zach@fleetdm.com>
2021-06-18 08:51:47 -07:00
Zach Wasserman
6b59a40dbc
Add backend and fleetctl support for API-only user (#1119)
- Add api_only to users table.
- Pass api_only values through service.
- Allow setting api_only in `fleetctl user create`.

Backend part of #402
2021-06-16 18:11:28 -07:00
Zach Wasserman
662406d705
Add support for license key in fleetctl preview (#1050)
- Use optional --license-key flag to add a license key.
- Corresponding change in osquery-in-a-box: https://github.com/fleetdm/osquery-in-a-box
2021-06-10 09:17:49 -07:00
Zach Wasserman
54fdff245d
Update fleetctl user create for Teams (#995)
Can now assign global role and team roles via `fleetctl user create`.
2021-06-07 13:23:15 -07:00
Zach Wasserman
0356115b03
Remove JWT in Fleet session management (#979)
See #978 for motivations for this change.

Closes #978.
2021-06-06 18:10:58 -07:00
Zach Wasserman
db459d3363
Continue to update names in backend code and docs (#976) 2021-06-06 16:58:23 -07:00
Zach Wasserman
fb32f0cf40
Remove kolide types and packages from backend (#974)
Generally renamed `kolide` -> `fleet`
2021-06-06 15:07:29 -07:00
Zach Wasserman
ec2814d77f
Remove deprecated config options (#954)
Closes #145
2021-06-04 08:40:25 -07:00
Zach Wasserman
18faa5a06b
Add authorization checks in service (#938)
- Add policy.rego file defining authorization policies.
- Add Go integrations to evaluate Rego policies (via OPA).
- Add middleware to ensure requests without authorization check are rejected (guard against programmer error).
- Add authorization checks to most service endpoints.
2021-06-03 16:24:15 -07:00
Zach Wasserman
417ef2c9b6
Refactor teams service methods (#910)
- Move team-related service methods to `ee/server/service`.
- Instantiate different service on startup based on license key.
- Refactor service errors into separate package.
- Add support for running E2E tests in both Core and Basic tiers.
2021-05-31 17:07:51 -07:00
Zach Wasserman
9876dbe6b6
Implement license loading and validation (#908)
- Load license from ES256 signed JWT key.
- Parse license claims into LicenseInfo struct.
- Update contribution documentation with sample license key.

Closes #816.
2021-05-31 11:35:15 -07:00
Zach Wasserman
a5bd03e5d7 Merge branch 'master' into teams 2021-05-31 10:56:50 -07:00
Zach Wasserman
64f2cfc9cd
Refactor enroll secrets to support Teams (#903)
- Add `team_id` field to secrets.
- Remove secret `name` and `active` fields (migration deletes inactive secrets).
- Assign hosts to Team based on secret provided.
- Add API for retrieving secrets by Team.
2021-05-31 09:02:05 -07:00
Zach Wasserman
201fde01c0
Clean up simulated hosts in fleetctl preview (#893)
The `reset` and `stop` subcommands will now clean up the simulated
hosts. Previously these were unintentionally left running.
2021-05-28 17:19:31 -07:00
Zach Wasserman
0e9eb920d4
Refactor struct slices for consistent pointer use (#864)
Some datastore and service methods would return slices of structs,
rather than slices to pointers of structs (which most methods used).
Make this more consistent.
2021-05-25 18:53:22 -07:00
Zach Wasserman
83b7f79699
Stub out licensing API (#810)
- Add config option for license key.
- Define license details data structure.
- Include license details in app config API responses.

Currently any non-empty value for `--license_key` behaves as though the
installation is licensed for `basic`. If the license key is empty,
`core` is returned.

Still to come is the appropriate parsing for the license key.
2021-05-19 17:29:38 -07:00
Noah Talerman
72882e8f9f Merge branch 'master' into teams 2021-05-19 13:16:54 -04:00
Josh Brower
86745ba2dc
Add ability to duplicate live query results in Redis (#762)
This feature enables a new config option (redis.duplicate_results). When set to true, all Live Query results will be copied to an additional Redis pubsub channel named LQDuplicate

This is useful in a scenario that would involve shipping the Live Query results outside of Fleet, near-realtime.
2021-05-13 16:01:31 -07:00
Zach Wasserman
b1a98a6e91
Update agent options storage for teams (#754)
- Allow agent options to be set on per-team basis.
- Move global agent options into app configs.
- Update logic for calculating agent options for hosts.
- Updates to relevant testing.
2021-05-11 18:15:16 -07:00
dsbaha
1cb514c460
Add flag to disable HTTP keepalives (#741)
In some environments, disabling keepalives helps prevent buildup of TCP sockets.
2021-05-07 17:29:54 -07:00
Zach Wasserman
e961cfe0c3
Batch updates to host seen time (#633)
Instead of synchronously updating the seen_time column for a host on an update, batch these updates to be written together every 1 second.

This results in a ~33% reduction in MySQL CPU usage in a local test with 4,000 simulated hosts and MySQL running in Docker.
2021-04-12 16:22:22 -07:00
Zach Wasserman
12d292164f
Add rate-limiting to login and password reset (#543)
Prevent abuse of these endpoints with rate limiting backed by Redis. The
limits assigned should be appropriate for almost any Fleet deployment.

Closes #530
2021-03-26 11:23:29 -07:00
Zach Wasserman
d621650b78
Initial implementation of agent update management (#516)
This PR contains the initial implementation of the fleetctl updates commands, along with documentation on using this to self-host an agent update server.

Co-authored-by: Noah Talerman <noahtal@umich.edu>
Co-authored-by: Mike McNeil <mikermcneil@users.noreply.github.com>
2021-03-26 10:46:51 -07:00
Zach Wasserman
fb9706912d
Prevent user enumeration (#533)
- Return same error in all cases for login endpoint.
- Log error details in server logs.
- Make most login errors take ~1s to prevent timing attacks.
- Don't return forgot password errors.
- Log password errors in server logs.
- Make most forgot password requests take ~1s to prevent timing attacks.

Fixes #531
2021-03-24 19:36:30 -07:00
Zach Wasserman
b4f0f461c2
Make fleetctl preview available over HTTP (#508)
Make fleetctl preview available over HTTP

Run a second copy of the Fleet server listening over HTTP on
localhost:1337 so that the UI can be used without the errors displayed
with a self-signed TLS certificate. Osquery clients and fleetctl
continue to communicate with the existing Fleet server on
https://localhost:8412.

Closes #504

Co-authored-by: Mike McNeil <mikermcneil@users.noreply.github.com>
2021-03-22 15:04:19 -07:00
Zach Wasserman
a62277b9b6
Improvements to fleetctl preview (#495)
- Download configuration on every run. This ensures that users always
  get the latest version.
- Pull latest Docker containers on every run.
- Add stop and reset commands (for cleanup).

Fixes #378
2021-03-19 16:45:21 -07:00
Zach Wasserman
4cfcb1b084
Upgrade fleetctl github.com/urfave/cli to v2 (#471)
This is intended to upgrade to the new API without changing fleetctl
functionality.
2021-03-12 16:42:38 -08:00
Zach Wasserman
cfba095cda
Make host identifier configurable within Fleet (#417)
Osquery now exposes more information during host enrollment than Fleet
previously handled. We can use this to provide more options to users in
problematic enrollment scenarios.

Users can configure --osquery_host_identifier in Fleet to set which
identifier is used to determine uniqueness of hosts. The
default (provided) replicates existing behavior in Fleet. For many
users, setting this to instance will provide better enrollment
stability.

Closes #373
2021-03-08 18:35:17 -08:00
Zach Wasserman
f95aa37646
Fixes for fleetctl preview (#295)
- Better documentation and error for missing docker-compose.
- Handle case of no existing config file.
- Make logs directory world-writable (to allow writes from inside container).

Fixes #286
2021-02-13 08:41:46 -08:00
Zach Wasserman
d624e099fb
Deprecate environment variable prefix (#301)
- Support both `FLEET_` and `KOLIDE_` prefixes.
- Add logging about deprecated `KOLIDE_` prefix.
- Update documentation and sample configs.
2021-02-11 15:36:58 -08:00
Zach Wasserman
22d9205d35
Add debug flag to fleetctl (#266)
This flag enables logging of HTTP requests and responses to stderr.

Closes #187
2021-02-02 18:55:16 -08:00
Zach Wasserman
a9c0c472fc
Update Kolide to Fleet as appropriate in documentation (#263) 2021-02-02 12:16:59 -08:00
Zach Wasserman
8fcd14b394
Add --dev flag and change docker defaults (#251)
- Add --dev flag that will set default flag values. This simplifies the
  invocation of Fleet in a development environment.
- Change defaults in docker-compose to use `fleet` in place of `kolide`.
-  Skip prompt in `prepare db` when `--dev` specified.
- Update developer documentation.

Updates to MySQL configuration in docker-compose.yml may require
existing development containers and volumes to be deleted (this will
delete data in MySQL):

```shell
docker-compose rm -sf
docker volume rm fleet_mysql-persistent-volume
```

Closes #170
2021-02-01 18:14:16 -08:00
Zach Wasserman
15baa54d81
Start hosts in fleetctl preview (#247)
- Set config context and log in fleetctl
- Start containerized Linux hosts

Closes #173
2021-01-28 18:18:21 -08:00
Zach Wasserman
368632b3fa
Minor refactor in fleetctl config handling (#246)
Move CLI context out of get/set config functions.
2021-01-28 17:15:38 -08:00
Zach Wasserman
d4dbd9f12e
Expose live query error messages in fleetctl (#245)
Closes #206
2021-01-28 17:06:41 -08:00
Zach Wasserman
bb124dc2b9
Improvements to fleetctl preview experience (#234)
- Make the preview directory in the default .fleet directory.
- Check for Docker daemon installed but not running.
- Add message for Chrome users on self-signed certs.
- Display login information on later invocations of command.
- Remove "Kolide" from error messages.

Closes #190

Part of #197
2021-01-28 07:57:32 -08:00
Zach Wasserman
015c79627b
Add ciphersuites for compability with Go HTTP/2 (#226)
Fixes a misconfiguration due to #212 that prevented the server from
starting up in `modern` tls compatibility mode.
2021-01-25 13:08:41 -08:00
Zach Wasserman
c7dfeeb90c
Update tls_compatibility settings to match Mozilla (#212)
Mozilla's recommended settings have changed since this was last updated.
We now link directly to the relevant revision in the Mozilla wiki to
avoid confusion if this is updated.
2021-01-20 08:34:14 -08:00
Zach Wasserman
d52f850702
Complete setup with fleetctl preview (#167)
- Run the `fleetctl setup` command to set up the Fleet server with
  default username ('admin') and password ('admin123#').
- Configures fleetctl if it has not yet been configured.

Closes #152
2021-01-04 17:11:10 -08:00
CptOfEvilMinions
626429c38e
Added support to read jwt and mysql password from a file (#141)
The current implementation of FleetDM doesn't support Docker secrets for supplying the MySQL password and JWT key. This PR provides the ability for a file path to read in secrets. The goal of this PR is to avoid storing secrets in a static config or in an environment variable. 

Example config for Docker:
```yaml
mysql:
  address: mysql:3306
  database: fleet
  username: fleet
  password_path: /run/secrets/mysql-fleetdm-password
redis:
  address: redis:6379
server:
  address: 0.0.0.0:8080
  cert: /run/secrets/fleetdm-tls-cert
  key: /run/secrets/fleetdm-tls-key
auth:
  jwt_key_path: /run/secrets/fleetdm-jwt-key
filesystem:
  status_log_file: /var/log/osquery/status.log
  result_log_file: /var/log/osquery/result.log
  enable_log_rotation: true
logging:
  json: true
```
2021-01-04 07:58:43 -08:00
Matteo Piano
c89cd370d5
Add AWS S3 as file carving backend (#126)
This adds the option to set up an S3 bucket as the storage backend for file carving (partially solving #111).

It works by using the multipart upload capabilities of S3 to maintain compatibility with the "upload in blocks" protocol that osquery uses. It does this basically replacing the carve_blocks table while still maintaining the metadata in the original place (it would probably be possible to rely completely on S3 by using object tagging at the cost of listing performance). To make this pluggable, I created a new field in the service struct dedicated to the CarveStore which, if no configuration for S3 is set up will be just a reference to the standard datastore, otherwise it will point to the S3 one (effectively this separation will allow in the future to add more backends).
2020-12-16 09:16:55 -08:00
Zach Wasserman
416235f4b8
Clean up unused test/demo SQL data (#117) 2020-12-10 11:44:02 -08:00
Zach Wasserman
6f6464f206
Migrate remaining URLs to fleetdm.com (#116) 2020-12-10 11:26:00 -08:00
Zach Wasserman
f62dc055ee
Improve fleetctl preview startup experience (#60)
- Rearrange messaging to appear during waiting time.
- Reduce wait time by limiting backoff timer
2020-11-20 15:37:14 -08:00
Zach Wasserman
ff26a614ef
MVP of fleetctl preview command (#51)
This adds a `fleetctl preview` command to fleetctl that will download
and start https://github.com/fleetdm/osquery-in-a-box. This is
potentially the easiest way for a user to try out Fleet.
2020-11-18 13:16:18 -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
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