Commit Graph

684 Commits

Author SHA1 Message Date
Mike Stone
f532c2fd70 Fixes bug for undefined ID when revoking invites (#771) 2017-01-05 19:13:28 -05:00
Mike Stone
92d91fdebc Handle server errors (#730)
* consistent error handling

* Display server errors in InviteUserForm

* Handle errors in Form component

* Refactors query form

* creates KolideAce component

* Renders QueryForm from query page and manage hosts page

* Moves ace editor and select targets dropdown to query form

* Render base errors in Form HOC

* LoginPage and ForgotPasswordPage server errors

* Ensure unique key for user blocks

* Adds base error to login form and forgot password form

* Adds base error to query form

* Adds base error to Pack Form

* Adds errors to confirm invite form

* Adds clearErrors action

* clear errors when confirm invite page unmounts

* Handle errors in the App Setting page

* Handle server errors in the User Settings Page

* Handle server errors in the User Management Page
2017-01-05 19:01:17 -05:00
Kyle Knight
1d560c004e Host Details cards cleanup (#700) 2017-01-05 12:08:50 -06:00
Kyle Knight
cff7d19ad5 Updating FlashMessage styles (#684) 2017-01-05 12:08:19 -06:00
Zachary Wasserman
35806f1442 Separate tables from data migrations (#745)
This PR separates the table migrations from the data population migrations. Table migrations run before data migrations.

Now, we have the ability to create the database tables without populating them with data. This can be useful for running "unit" tests against a MySQL store that doesn't have any pre-populated data. When performing real migrations, or for more "integration" style testing, the data migrations can also be executed.

Note there are some special cases that must be observed with these migrations, and the README is updated to reflect those.
2017-01-05 09:27:56 -08:00
Kyle Knight
413789386a Updating styles for Accept Invite page (#747) 2017-01-05 09:53:41 -06:00
Kyle Knight
87edc9c238 Updated User Menu Design (#749) 2017-01-05 09:41:53 -06:00
Kyle Knight
ab540cdfb5 Dropdown Button (#744) 2017-01-05 09:26:10 -06:00
John Murphy
f4ae2c1446 Added make task with coverage and race analysis (#754)
* Added make task with coverage and race analysis

* removed coverage and race conditons from test task

* changed test-analyze-go to analyze-go
2017-01-04 15:59:17 -06:00
Jason Meller
4a7e74fdfa Add Contrived Documentation (#736)
* Add some contrived documentation for testing

* Fix broken images
2017-01-04 14:22:38 -07:00
Mike Arpaia
704ddd424b Host summary endpoint (#742)
* Initial scaffolding of the host summary endpoint

* inmem datastore implementation of GenerateHostStatusStatistics

* HostSummary docstring

* changing the url of the host summary endpoint

* datastore tests for GenerateHostStatusStatistics

* MySQL datastore implementation of GenerateHostStatusStatistics

* <= and >= to catch exact time edge case

* removing clock interface method

* lowercase error wraps

* removin superfluous whitespace

* use updated_at

* adding a seen_at column to the hosts table

* moving the update of seen_time to the caller

* using db.Get instead of db.Select
2017-01-04 14:16:17 -07:00
Victor Vrantchan
046f75295e consolidate delete operations in mysql store (#746)
Adds a helper method which soft deletes entities from the database.
2017-01-04 13:18:21 -05:00
Mike Stone
4ba3ad51f0 All packs page (#709)
* Display packs page at /packs/manage

* Adds NumberPill component

* Filter packs list

* Render the pack info side panel when no packs are selected

* Adds packs list

* Moves state management to page component

* Display selected pack count

* Render bulk action buttons

* API client - update pack

* API client - destroy pack

* Adds update/destroy functions to packs redux config

* Bulk actions (enable, disable, delete)

* Selecting a pack updates state

* PackDetailsSidePanel updates pack status

* Link to edit pack on side panel

* sets selected pack in URL

* Sets color for unsettled buttons

* Loads scheduled queries for selected pack in All Packs Page

* PackDetailsSidePanel component

* PackDetailsSidePanel styles

* styles PacksList component

* Stop rendering flash when pack status is updated

* Makes full row clickable

* highlight selected pack
2017-01-03 15:56:50 -05:00
Mike Arpaia
0122f6cb0a Add host_ids and label_ids fields to the packs API (#737)
This PR adds the `host_ids` and `label_ids` field to the packs HTTP API so that one can operate on the hosts/labels which a pack is scheduled to be executed on. This replaces (and deletes) the `/api/v1/kolide/packs/123/labels/456` API in favor of `PATCH /api/v1/packs/123` and specifying the `label_ids` field. This also allows for bulk operations.

Consider the following API examples:

## Creating a pack with a known set of hosts and labels

The key addition is the `host_ids` and `label_ids` field in both the request and the response.

### Request

```
POST /api/v1/kolide/packs
```

```json
{
	"name": "My new pack",
	"description": "The newest of the packs",
	"host_ids": [1, 2, 3],
	"label_ids": [1, 3, 5]
}
```

### Response

```json
{
	"pack": {
		"id": 123,
		"name": "My new pack",
		"description": "The newest of the packs",
		"platform": "",
		"created_by": 1,
		"disabled": false,
		"query_count": 0,
		"total_hosts_count": 5,
		"host_ids": [1, 2, 3],
		"label_ids": [1, 3, 5]
	}
}
```

## Modifying the hosts and/or labels that a pack is scheduled to execute on

### Request

```
PATCH /api/v1/kolide/packs/123
```

```json
{
	"host_ids": [1, 2, 3, 4, 5],
	"label_ids": [1, 3, 5, 7]
}
```

### Response

```json
{
	"pack": {
		"id": 123,
		"name": "My new pack",
		"description": "The newest of the packs",
		"platform": "",
		"created_by": 1,
		"disabled": false,
		"query_count": 0,
		"total_hosts_count": 5,
		"host_ids": [1, 2, 3, 4, 5],
		"label_ids": [1, 3, 5, 7]
	}
}
```

close #633
2017-01-03 10:32:06 -07:00
Mike Arpaia
b03e504a80 MySQL's datastore.Drop should drop all tables (#738)
* MySQL's datastore.Drop should drop all tables

* Use the database name as a parameter

* tx.Exec instead of tx.MustExec
2017-01-03 09:54:24 -07:00
John Murphy
d1ef37b92c Osquery Options - /config/osquery-options #365 (#729) 2016-12-31 11:56:54 -06:00
Mike Arpaia
e4fa278f59 Removing unused webpack aliases (#734) 2016-12-31 01:41:01 -07:00
Mike Arpaia
9a146c5f92 Renaming targets_count to be more clear (#733) 2016-12-30 12:30:34 -07:00
Mike Arpaia
e9aa5bcc8c Return query_count and targets_count in all pack responses (#731) 2016-12-30 12:06:54 -07:00
Victor Vrantchan
154200db8a Add endpoint to retrieve an invite with the invite token. (#719)
Closes #579
2016-12-29 20:58:12 -05:00
Victor Vrantchan
6cb1026d86 always return errors to the client as a map slice (#724)
keep the format for error returns consistent by always returning a
[]map[string]string for json errors. This simplifies the error handling
on the frontend.

Use "name":"base" as the name field for errors which do not have
a specific or known form field.
2016-12-29 19:40:12 -05:00
Victor Vrantchan
a13042e11b Redirect frontend routes to setup if setup is not configured. (#721)
Closes #617
2016-12-29 18:36:36 -05:00
Mike Stone
448e806c36 374 confirm invite (#583)
* ConfirmInviteForm

* Render ConfirmInvitePage at /invites/:invite_token

* Add email, pre-fill name, and handle successful submit

* Fix button text
2016-12-29 15:27:43 -05:00
Zachary Wasserman
ca72a5c67a Add check for all platforms in label query retrieval (#705)
Fixes #703
2016-12-29 12:11:26 -08:00
Mike Stone
cba01cd052 Handle invalid delete requests (#699)
* Handle delete responses like other responses

* Render error flash if an invite can't be deleted
2016-12-29 12:04:03 -07:00
John Murphy
eec835a07a Osquery options 365 (#657) 2016-12-29 12:32:28 -06:00
Mike Stone
fc6a7a7921 Redirect to manage hosts page after login (#715) 2016-12-29 13:14:26 -05:00
Mike Stone
a6d6b20484 Use org logo url (#686)
* Sets config's org logo url in site nav header

* Site nav header cleanup

* Use default image for org logo
2016-12-29 09:40:08 -05:00
Victor Vrantchan
52580ff872 Add invite email template and use the new invite mailer pattern (#711)
Closes #693
Closes #581
2016-12-28 11:55:03 -05:00
Mike Stone
7fa60d0724 Change Button component to take children instead of text prop (#710) 2016-12-28 10:24:52 -05:00
Zachary Wasserman
39ebd81dc5 Close orphaned distributed query campaign after failed publish attempt (#707)
A distributed query campaign can be "orphaned" (left in the QueryRunning state)
if the Kolide server restarts while it is running, or other weirdness occurs.
When this happens, no subscribers are waiting to read results written by
osqueryd agents, but the agents continue to receive the query. Previously, this
would cause us to error on ingestion.

The new behavior will instead set the campaign to completed when it detects
that it is orphaned. This should prevent sending queries for which there is no
subscriber.

- New NoSubscriber error interface in pubsub
- Detect NoSubscriber errors and close campaigns
- Tests on pubsub and service methods

Fixes #695
2016-12-27 10:35:19 -05:00
Kyle Knight
6f90e51bc7 Style App settings form (#701) 2016-12-27 10:32:30 -05:00
Victor Vrantchan
6b41d2b3f0 always print email messages in dev mode (#698) 2016-12-24 10:41:59 -05:00
Mike Stone
ee6832c743 App settings page (#615)
* AppSettingsPage at /admin/settings

* Adds App Settings to site nav items

* SMTP not configured warning

* Creates AppConfigForm

* Avatar preview

* API client to update app config

* Creates OrgLogoIcon component

* Hide username/password when no auth type
2016-12-23 13:40:16 -05:00
Victor Vrantchan
f092c614cf add error logging to distributed query campaign handler (#694) 2016-12-22 20:31:45 -05:00
Zachary Wasserman
2c7fc2a6f2 Minor refactoring in HostStatus function (#692)
- Refactor function
- Add test
2016-12-22 13:32:40 -08:00
Kyle Knight
5ec95a5a3b Integrating PlatformIcon component (#687) 2016-12-22 13:35:24 -06:00
Mike Arpaia
ef22d81b50 Return query and name after creating a scheduled query (#690) 2016-12-22 14:29:29 -05:00
Kyle Knight
8f07fe2ed2 Fixing bug in Query Table sidebar dropdown (#691) 2016-12-22 13:26:18 -06:00
Mike Arpaia
f4a830175a Making the dev mode text a little prettier (#689) 2016-12-22 13:17:40 -05:00
Victor Vrantchan
3658e4833e add prometheus metrics to every http endpoint in the app (#680)
tracking the following metrics:

http_request_duration_microseconds
http_request_size_bytes
http_response_size_bytes
http_requests_total
2016-12-22 12:39:44 -05:00
Victor Vrantchan
e7e57ddbc0 prevent password reuse when changing passwords (#678)
For #375
Closes #448
2016-12-22 12:08:29 -05:00
Victor Vrantchan
a47179f142 add a /healthz endpoint which checks that the app is in a healthy state (#674)
by pinging the mysql and redis backends.

For #93
2016-12-22 12:07:47 -05:00
Mike Stone
a84c40061a Prepends https protocol to the inmem org logo url (#685) 2016-12-22 10:03:20 -05:00
John Murphy
d653cdf281 Minor App Config API tweaks requested by @mikestone14 (#681)
* Minor App Config API tweaks requested by @mikestone14

* Refactored mail test into separate method, implemented code review changes
2016-12-22 08:12:34 -06:00
Victor Vrantchan
19fc70ed64 change logo_url for devMode (#683)
Closes #682
2016-12-21 16:22:10 -05:00
Kyle Knight
8baffbc97e Refactor A Few Rendering Issues (#656) 2016-12-21 12:39:40 -06:00
Kyle Knight
0bc73b421f User Settings Styles (#655) 2016-12-21 12:22:18 -06:00
Victor Vrantchan
8ef11f51bf create user from invite: set admin property from invite. (#675)
Closes #589
2016-12-21 12:34:10 -05:00
Mike Stone
f099b2ae22 Create packs (#516)
* Creates new PackComposerPage at /packs/new

* Creates PackForm component

* Adds PackForm to PackComposerPage

* Creates QueriesListItem

* Creates QueriesList

* Creates QueriesListWrapper

* Get all queries when the Packs Composer Page loads

* Form HOC handles updates to formData prop

* Creates form to configure scheduled queries

* QueriesListWrapper renders ConfigurePackQueryForm

* search queries input filters queries list

* Empty state text

* create pack when user submits the new pack form

* Adds Edit pack page to /packs/:pack_id/edit

* API client - get scheduled queries for a pack

* API client - create scheduled query

* Redux config for scheduled queries

* Remove scheduled queries from packs

* Add labels to pack on create

* Add disabled state to the select targets dropdown

* Adds edit route and pushes to new route on edit click

* Adds cancel button to edit pack form

* Adds Checkbox that selects all scheduled queries in table
2016-12-21 12:25:54 -05:00