Commit Graph

58 Commits

Author SHA1 Message Date
John Murphy
7988076799 Licensed endpoints (#1188) 2017-02-10 02:43:45 +08:00
Victor Vrantchan
838c73ff0a add graceful server shutdown (#1185)
* add graceful server shutdown

Also refactors server to use `http.Server` instead of the global
http.ListenAndServe method. In the future it allows us to set
ratelimits and timeouts for http connections.
2017-02-07 16:02:08 -05:00
Mike Arpaia
a000751bfe renaming kolide-ose to kolide (#1143) 2017-02-01 10:20:50 -07:00
Victor Vrantchan
650bae2ffb remove dev mode from cli options (#1027) 2017-01-19 09:42:45 -05:00
Victor Vrantchan
c13b8cc0cf support JSON output for kolide logs (#1026) 2017-01-19 09:41:28 -05:00
Victor Vrantchan
1551e46fed add middleware to redirect setup to login if the app has an admin (#900)
user.
2017-01-11 14:05:07 -05:00
Victor Vrantchan
1896961cba cli/serve: use server address from config (#853)
Until now, despite having the appropriate config flag, we were using a
hardcoded port for server address. Switch the ListenAndServe methods to use
the config params instead.
2017-01-10 11:07:14 -05: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
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
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 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
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
John Murphy
62748bfbb1 App Settings - /admin/settings #363 (#590) 2016-12-20 15:54:30 -06:00
Victor Vrantchan
6bd4173475 don't drop tables in prepare db step (#666) 2016-12-20 14:04:44 -05:00
Zachary Wasserman
c8e6405220 Use redis for distributed query results when not in dev mode (#653)
- Add appropriate configs for Redis
- Use the Redis pubsub store by default, inmem in dev mode
2016-12-15 16:13:23 -08:00
Zachary Wasserman
e1db2d4c27 Add cleanup method for distributed queries and metadata (#547)
- New datastore method for expiring queries and deleting metadata
- Start goroutine in serve to run this method on an hourly interval

Closes #392
2016-12-01 10:31:16 -08:00
John Murphy
44ef92550f Added built in labels (#526) 2016-11-26 02:08:22 +08:00
Mike Arpaia
a8a7be7f20 Packs pages (#426)
* initial scaffolding

* pack info sidebar

* fixing the merge of the routes

* Remove radium from pack info sidepanel

* lint

* cards!

* redux entity config

* pack interface

* wiring up redux with fake dev data

* Add description attribute to packs

* move redux to top level page component to isolate data fetching

* initial scaffolding of all packs table

* adding redux entities back

* minimal

* alpha order in packs.js

* no newlines in HTML

* onclick handler to function on component class

* alpha order in router

* alpha order in paths.js

* no newline in side panel

* removing input field

* lint fixes
2016-11-21 11:49:36 -08:00
Zachary Wasserman
dd16f6d918 Fix missing JSON tag for labels (#510) 2016-11-17 16:51:30 -08:00
John Murphy
6a825c11e3 Datastore refactor (#439)
Removed Gorm, replaced it with Sqlx

* Added SQL bundling command to Makfile

* Using go-kit logger

* Added soft delete capability

* Changed SearchLabel to accept a variadic param for optional omit list
instead of array

* Gorm removed

* Refactor table structures to use CURRENT_TIMESTAMP mysql function

* Moved Inmem datastore into it's own package

* Updated README

* Implemented code review suggestions from @zwass

* Removed reference to Gorm from glide.yaml
2016-11-16 21:47:49 +08:00
Zachary Wasserman
9c38d6d19e Update osquery service methods for distributed queries (#476) 2016-11-14 10:22:54 -08:00
Victor Vrantchan
ac14215e21 create first time setup endpoint (#436)
The endpoint is only active if there are no users in the datastore.
While the endpoint is active, it also disables all the other API endpoints, and /config returns `{"require_setup":true}`
for #378
2016-11-09 12:19:07 -05:00
Victor Vrantchan
def24499b5 store WebAddress config in datastore (#421)
moves web address config to datastore so that it can be configured by a user
in the Web UI.
rename OrgInfo struct to AppConfig.

For #363
For #378
2016-11-04 16:44:38 -04:00
Mike Arpaia
97de2bc5aa Label API Updates (#413)
close #403
close #404
close #412
2016-11-02 21:17:23 -04:00
Zachary Wasserman
0faa3a55fb Make context imports consistent (#359) 2016-10-31 15:18:05 -07:00
Zachary Wasserman
41d2d9ca57 Add queries and labels in dev mode (#349) 2016-10-31 11:11:27 -07:00
Victor Vrantchan
950586c100 update datastore logger (#344)
remove dependency on logrus
adapt go-kit/log interface to gorm logger
allow debug logging flag
2016-10-25 11:30:14 -04:00
Zachary Wasserman
4100eea2a8 Add detail_update_time in createDevHosts (#315) 2016-10-14 15:32:55 -07:00
Zachary Wasserman
106eae4515 Update os_version test data to reflect real data (#314) 2016-10-13 14:56:02 -07:00
Mike Arpaia
01f20372f2 Populate the in-memory database with fake hosts (#304)
* Populate the in-memory database with fake hosts

Similarly to how we create two fake users, this PR adds two fake hosts to
the in-memory database that is used in dev mode.

* using more realistic physical memory values
2016-10-12 15:19:27 -04:00
Victor Vrantchan
f6a3fafd2c option to use real SMTP config in dev mode (#301)
* move devMode fixture creation to separate functions

* use real SMTP server if SMTP config is provided in dev mode
2016-10-12 12:35:14 -04:00
Victor Vrantchan
337822fde3 remove unused cors headers (#296)
no need for CORS middleware since we're using the same origin for the frontend.
2016-10-11 17:10:20 -04:00
Mike Arpaia
12f8c0b671 Datastore cleaning (#262)
This PR reorganizes a bunch of the files in datastore such that all datastore implementations are consistently broken up into multiple files. Additionally, the datastore tests follow a similar pattern and can easily be applied to any complete datastore implementation.
2016-10-04 16:34:36 -04:00
Zachary Wasserman
59c194a7f4 Perform migration at startup when using inmem datastore (#270) 2016-10-03 20:35:56 -07:00
Zachary Wasserman
0a1ca0c4fb Enable serve over HTTPS (#263) 2016-10-03 14:47:31 -07:00
Victor Vrantchan
6fb96d98f7 Adds endpoints to invite new users to the application. (#235)
User service checks that tokens are valid on new user signups.
Closes #230
2016-09-28 22:44:05 -04:00
Victor Vrantchan
24b9baec1f add prometheus endpoint (#236)
generate metrics for Users, Appconfig and Session services
2016-09-28 07:35:15 -04:00
Mike Arpaia
0482f12926 Organizing go code (#241) 2016-09-26 11:48:55 -07:00
Victor Vrantchan
372dac8304 Create context packages (#228)
add token context package
add viewer context package
add host context package
update authenticated middleware to set viewer context or return error
re-organize API handler
2016-09-26 13:14:39 -04:00
Victor Vrantchan
26b1e70ac3 App config api (#223)
Add GET and PATCH endpoints for /kolide/config to get/update current app configuration
2016-09-21 20:45:57 -04:00
Zachary Wasserman
8f16bd8bcc Send configuration + label queries in distributed reads (#215)
This PR is the beginning of distributed query work. For now we are focusing on using the distributed query subsystem to retrieve the basic configuration information (currently just platform), and run the label queries.

A mockable clock interface is also added to the service struct, allowing us to inject a clock as a dependency, and write unit tests that can control the time.
2016-09-20 20:08:11 -07:00
Mike Arpaia
b1a4036145 Table test style creation of dev users (#218) 2016-09-20 20:07:18 -07:00
Victor Vrantchan
973ef9dbd1 User response - job position (#208)
* add job role to user reponses

* add test user job role
2016-09-20 13:03:51 -04:00
Victor Vrantchan
a069ec9acf add devMode MailService to speed up testing (#178)
running with the dev flag will print the content of an email to stdout
2016-09-16 08:55:09 -04:00
Zachary Wasserman
f968ae3f8f Default to MySQL store and add --dev flag (#170)
Switches the default datastore back to MySQL, and adds a --dev flag to the
serve command that will cause the in-memory datastore to be used.

Closes #166
2016-09-15 10:20:36 -07:00
Zachary Wasserman
0702dccb7f Only attempt to parse config file if it is specified by flag (#169)
Previously, the behavior was to search for the config file in a variety of
locations. Now we only attempt to load a config file if it has been explicitly
specified with `-c` or `--config`.

Fixes #165.
2016-09-15 08:44:05 -07:00
Victor Vrantchan
df19fd4b7c Update users service (#156)
Closes #144 #145 #160 
Implements PATCH method on user and endpoint middleware for authnz
Implements `reset_password` (with token) and `forgot_password` endpoints
Added godoc comments for UserService interface
Shift to using testify/assert in test code
Multiple fixes/changes to the UserService API
2016-09-15 10:52:17 -04:00
Victor Vrantchan
da05e360ac print version info (#164)
add version package and print version commands
make build now sets build info like git branch and revision when creating a binary.
2016-09-14 13:19:11 -04:00
Zachary Wasserman
885db1a597 Refactoring for config patterns (#159)
This PR refactors most of the codebase to use the new config patterns implemented in #149. Now the core service keeps a copy of the KolideConfig struct, and service methods can reference the configuration in that struct when they need it. The most significant refactoring is in the sessions code, separating the business logic from the storage layer.
2016-09-14 09:11:06 -07:00