Commit Graph

1042 Commits

Author SHA1 Message Date
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
14240cbabf update password reset check for user PATCH request (#238) 2016-09-26 12:29:51 -04:00
Victor Vrantchan
1e5a0f8f88 change force_password_reset flag to false after a succesful reset (#237) 2016-09-26 11:49:10 -04:00
Victor Vrantchan
1d5596941a update how permission errors are updated to the client (#187)
Closes #152 
allow batching of permission errors
refactor some of the error handling in encodeError
clean up some of the error messages
2016-09-22 22:41:58 -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
Victor Vrantchan
45d6b1e32f Auth errors (#185)
Return well formatted authentication errors to the client
Log the reason for an error serveside but return a masked/generic reason to the client
Assert go errors by behavior rather than type.
2016-09-20 15:22:54 -04:00
Victor Vrantchan
21944bcc29 add missed fields on user (#213)
* add missed fields

* check for nil on optional values first
2016-09-20 14:54:20 -04: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
Mike Arpaia
428351d3a8 Serializable config types (#141) 2016-09-19 16:11:39 -07:00
Victor Vrantchan
2f8db0d184 render react template from binaryfs (#196)
Closes #194 
* render react template from binaryfs
2016-09-19 19:06:41 -04:00
Victor Vrantchan
2ba72e2786 add authentication/nil check for /me endpoint to prevent panic (#193)
* add authentication/nil check for /me endpoint to prevent panic

* update function call
2016-09-19 13:50:31 -07:00
Victor Vrantchan
1de9f6bd89 nicer validation errors (#180) 2016-09-16 11:23:48 -04:00
Victor Vrantchan
f46a951da3 Add /me route (#177)
* i like how I wrote this to never call svc direcly

* rename func

* apparently not everywhere

* add service method for authenticated user

* oops forgot to check this in
2016-09-15 21:35:52 -07:00
Zachary Wasserman
fab4759926 Fix bug creating session with 0 timestamp (#171)
If AccessedAt is left in the zero value, MySQL will complain with the following
error: Error 1292: Incorrect datetime value: '0000-00-00' for column 'accessed_at' at row 1. Now we initialize AccessedAt when creating a new
session.
2016-09-15 15:53:47 -07:00
Victor Vrantchan
0ac63c9963 Allow with Logins with email address (#174)
The Auth service now accepts emails in the username field
The UserService now rejects user creation if the user has @ in the username.
2016-09-15 15:27:55 -04: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
Zachary Wasserman
713c248f2e Simplify test error check (#167) 2016-09-14 12:15:14 -07:00
Mike Arpaia
e8384a7655 assertifying the tests (#163) 2016-09-14 11:40:51 -07: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
Jason Meller
5e9f93d08a Add assets folder so we can serve images (#155) 2016-09-12 12:11:18 -04:00
Victor Vrantchan
a27752fd2c jwtKey should be []byte but string is returned (#154) 2016-09-12 11:31:58 -04:00
Victor Vrantchan
82cad97c04 rename mock datastore to inmem (#150)
* rename mock datastore to inmem

* fix tests
2016-09-09 21:39:38 -04:00
Victor Vrantchan
300b7ac2db pretty-print JSON response. (#147)
NOTE: SetIndent() was introduce in 1.7
2016-09-09 08:34:53 -04:00
Victor Vrantchan
05b1afd635 Update user properties (#143)
* renamed NeedsPasswordReset field for clarity
This field was not obvious when it should be set or checked. This makes it a bit more obious.
The property should only be set if the password request was requested by an admin.
Having this property checked should
- invalidate current user auth token
- force user to reset password on their next login
- NOT send a password reset email

* add GravatarURL property
we considered uploading and storing an image url in the future as well

* Add a user property to save the user's job role/position
2016-09-08 18:57:05 -04:00
Mike Arpaia
8bf2b7ee7b Forgot to specify that logout is post (#136) 2016-09-07 22:58:25 -04:00
Mike Arpaia
251043970b Header based JWT authentication (#131)
* add a test data subcommand

* updated sessions stuff

* merge and tests
2016-09-07 21:24:11 -04:00
Victor Vrantchan
88e4be20df stdmux api routes should have a slash at the end (#132) 2016-09-07 16:02:55 -04:00
Victor Vrantchan
3ffc1028e4 move serving static assets outside of the API handler (#130) 2016-09-07 15:19:54 -04:00
Mike Arpaia
ff92f6749a Osqueryd Service (#119)
* host service stuff

* working on the osquery service api

* log status and results logs
2016-09-06 17:28:07 -04:00
Victor Vrantchan
0a3f29ade5 small fixes in endpoint error handling (#117)
* space in ,omitempty does not omit the field
https://play.golang.org/p/TF_itLk50g

* return service errors as part of the response struct
2016-09-06 11:02:11 -04:00
Mike Arpaia
a06f5b2afb main and readme updates (#114)
* main and readme updates

* go vet error
2016-09-05 17:40:34 -04:00
Mike Arpaia
121af829d0 removing old server implementation (#109) 2016-09-05 16:03:58 -04:00
Mike Arpaia
53a1fe8d84 queries and packs services via go-kit (#102)
* osquery services via go-kit

* Visual Studio Code configurations

* create query and pack endpoints

* organizing files more scalably

* modify query and pack endpoints

* delete query and pack endpoints

* get query and pack endpoints

* get all queries and packs endpoints

* add and remove queries from packs

* test stubs

* removing some indirection

* query service tests

* service pack tests

* transport tests

* adding config file flag back

* organizing package kolide

* get queries in pack endpoint

* run tests on 1.7?

* no 1.7 image :(

* typo in circle.yml
2016-09-04 01:13:42 -04:00
Victor Vrantchan
9ab09f122a update user service (#101)
- Added all required methods for a UserService
- Added authentication handlers `/api/login` and `/api/logout`
- Added authMiddleware for authentication for `/api/v1/kolide` path
- Added authorization middleware for each endoint
- Added validation middleware for validating API inputs
- Began work on logging middleware
2016-09-01 00:51:38 -04:00
Victor Vrantchan
a07e9c7d77 go-kit server layout 2016-08-27 23:59:17 -04:00
Zachary Wasserman
41fe404ef1 HTTP Controller updates for label queries (#96)
Add controller methods for:

* Retrieving label queries
* Storing results of label queries
2016-08-24 16:50:28 -07:00
Mike Arpaia
3f81dda638 Query management backend (#95)
* initial data model modifications

* stubbing out http api endpoints

* becoming more restful

* GetAllQueries

* GetAllPacks

* GetQuery

* GetPack

* fixing datastore tests

* CreateQuery

* CreatePack

* ModifyQuery

* ModifyPack

* DeleteQuery

* DeletePack

* AddQueryToPack

* DeleteQueryFromPack

* todo change route URI

* fixing go vet

* comments

* universal url id parsing api
2016-08-23 19:30:55 -07:00
Mike Arpaia
b8d4c78f62 Integration tests (#90)
* tests for auth endpoints

* create user test and fatals instead of panics

* more tests

* remove init viper config setting

* stubbing

* more tests

* more tests

* organizing auth and users files

* rest of auth tests

* password reset tests
2016-08-19 23:56:49 -07:00
Mike Arpaia
06402eefe9 Removing bindata.go 2016-08-19 18:39:31 -07:00
Zachary Wasserman
7ec484633a Add GetLabelQueriesForHost (#86)
* Add/update models for label queries
* Write functions to determine which label queries should run for a given host
* Tests
2016-08-19 11:24:59 -07:00
Mike Arpaia
d92992b3dd Session shuffle and rename app to server (#84)
* renaming campaign to email

* moving session management code to the new kolide/datastore pattern

* removing global configuration variables in favor of config

* moving email operations to package kolide

* moving app to server

* using http.ListenAndServeTLS instead of a method on *gin.Engine

* remove the kolide.go dependency on gin
2016-08-18 17:45:39 -07:00