Commit Graph

10794 Commits

Author SHA1 Message Date
Mike Arpaia
46a35d49b4 Updating prepare connection syntax to be the same as serve 2016-08-18 17:55:25 -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
Victor Vrantchan
5d8ca61472 Domain Types (#83)
* create datastore package with New func to create a db connection

* separate creating a user object from saving to db
temporarily pass db around through gin context to compile app
main should create the datastore and pass it in to http handler explicitly instead

* create datastore from config params

* move gorm specific code to gorm.go

* re-export app.NewUser

* test new user

* add User() method for getting a user
temporary, the API will improve once I add filters

refactor test func to use sqlite by default and mysql if available

* add save user

* move some users tests to datastore, temporarily remove user tests from app

* add EnrollHost and test

* move enrollhost to datastore

* all enrollment tests now in datastore

* add datastore_test for re-enroll

* it compiles now...

* move other interfaces to models

* start wrapping errors in database error

* add tests for campaign

* move users to package kolide

* move hosts and passwordrequests

* package kolide

* moving all types to package kolide

* making new osquery endpoints use groob's new pattern
2016-08-18 14:16:44 -07:00
Mike Arpaia
9f8706bb43 Organizing the README a wee bit (#82) 2016-08-18 11:04:56 -07:00
Zachary Wasserman
49fe2ed595 Add osquery log file paths to list of env variables (#81) 2016-08-17 17:31:37 -07:00
Mike Arpaia
8ca6504688 New flag to disable banner: --disable-banner (#80)
* New flag to disable banner: --disable-banner

* Move globals into configuration

* Changing tool category name to logging
2016-08-17 16:53:28 -07:00
Zachary Wasserman
503ae54f46 Ingest status and result logs (#77)
* Implement log endpoint for status/result log ingestion
* Define interface for log handlers: OsqueryResultHandler and OsqueryStatusHandler
* Initial implementation of file logger handlers
* Unit + integration tests

Closes #7
2016-08-17 12:45:29 -07:00
Victor Vrantchan
0c51890b30 replace godep in favor of glide and using vendor directory
update make deps step in Makefile
update workflow for managing third party dependencies in README
closes #24, #47
2016-08-15 09:44:10 -04:00
Mike Arpaia
736bce5033 Email-based password reset (#54)
* No more hard deletes

* scaffolding for password reset endpoint

* Ensure password reset state is accounted for in VC checks

* password reset endpoints and data structures

* ability to change password with reset token

* smtp server connection pool management

* stubbing out the sending of the email

* adding mailhog via docker

* HTML emails with confgurable host name

* fixing typo in the comments

* Fixing merge which undid DatabaseError replacement

* documentation in the readme

* webpack shortcut for components

* removing a sneaky merge line that snuck in

* temporary email content api

* tests for password reset flow

* fixing go vet

* comments and making all db use `&value` rather than `reference`

* more correct usage of the errors library and moving email sending to it's own method

* using the wrong error

* fixing email mock object error

* less incorrect error usage

* rebasing and merging

* http constants for status code

* using ParseAndValidateJSON instead of BindJSON

* validate instead of binding in struct tags

* NewFromError instead of New
2016-08-12 12:20:29 -07:00
Mike Arpaia
ce9b7b9f91 removing the old config library from the test runner 2016-08-12 11:46:15 -07:00
Mike Arpaia
49d43522a3 fixing the build 2016-08-12 11:31:27 -07:00
Mike Arpaia
45dbac4354 Using viper and cobra for config/commands (#67) 2016-08-12 11:05:48 -07:00
Zachary Wasserman
809a010a1d Initial implementation of osqueryd enrollment + tests (#36)
*EnrollHost now generates a node key and stores host information into the DB
* Unit and integration tests

Closes #6
2016-08-11 13:50:03 -07:00
Zachary Wasserman
4db4e95b38 Add *.test to .gitignore (#64) 2016-08-11 09:44:00 -07:00
Mike Arpaia
64d16b8a16 README and workflow updates (#62) 2016-08-10 08:31:27 -07:00
Mike Arpaia
b13f99ac37 README and Makefile typo fixes 2016-08-09 22:23:04 -07:00
Mike Arpaia
3a9381c5b3 React Base (#61)
* Add sensible React base to the app for frontend

This PR attempts to "reactify" Kolide and provide a sane development environment
that a front-end engineer would probably expect.

This PR accomplishes by doing the following:

1. Reorganizes the app into a `server/` and `client/` folders to keep golang
logic separated from react logic.

2. Adds an "asset pipeline" via webpack which knows how to build a js
and css bundle.

3. Packages up all static assets in a go-bindata file so that the binary
remains portable without external file dependencies.

1. Add a Makefile with several targets that will be common in everyday
development. For example, we have `serve` target which spins up a nodejs
reverse proxy on port 8081 which then watches for changed files, automatically
rebuilds the app, and hot loads the new JS/CSS in.

 **Note:** Please use `make` to build the app, not `go build` as there are
now several things that need to be orchestrated beyond the go code to build the app.

* Create build if it doesn't exist, and use `go get`

* Improve README to reflect new dev workflow

* Document css vars and funcs and use alias paths

* makefile and structure modifications
2016-08-09 22:15:44 -07:00
Mike Arpaia
b6ac5b1bdb Updating README and documentation to reflect local building and testing (#58) 2016-08-09 19:17:07 -07:00
Zachary Wasserman
604e3e4fb0 Improve error handling throughout backend (#50)
* New function `errors.ReturnError` for writing errors into the HTTP response
* New type `KolideError` that includes additional error context
* Validation and application errors are reported in a consistent JSON format
* Add 404 handler
* Refactored error handling throughout codebase to use new error patterns
2016-08-09 19:04:28 -07:00
Zachary Wasserman
2c15647b6e Fix certificate path in development config (#55)
Also adds error checking to `RunTLS`
2016-08-09 16:18:03 -07:00
Mike Arpaia
2ee93d4724 Documenting HTTP handlers using Swagger format (#43)
More tooling for using Swagger will come soon. For now, use whatever you'd
like.
2016-08-09 10:48:53 -07:00
Mike Arpaia
2d2d667f4a Attempt to clean the codebase (#53) 2016-08-09 10:24:29 -07:00
Mike Arpaia
9181ae9c3d Adding a circle config file (#52) 2016-08-08 20:42:24 -07:00
Mike Arpaia
be6ac06be6 Updating README with CircleCI badge (#51) 2016-08-08 19:50:38 -07:00
Mike Arpaia
bc8ea99924 fixing typo in travis config 2016-08-08 17:37:35 -07:00
Mike Arpaia
37eea61821 removing tip from go builds because it takes too long 2016-08-08 09:55:37 -07:00
Mike Arpaia
0a0bf41b16 slack configurations for travis ci 2016-08-08 09:54:15 -07:00
Mike Arpaia
404406b821 TravisCI configurations (#46) 2016-08-08 09:50:54 -07:00
Mike Arpaia
fe2bf7eb2b Moving sessions code into sub-package (#42)
Since the sessions code mostly stands on it's own, I wanted to break the
dependencies apart from it and move it into it's own package.
2016-08-05 10:47:41 -07:00
Zachary Wasserman
cd8057e860 Turn down logging in tests except after failure (#41)
When tests succeed, there is now no logging of DB queries or HTTP
requests. If a test fails, the logs will be output.
2016-08-04 21:10:23 -07:00
Mike Arpaia
670aab219b Use crypto/rand instead of math/rand 2016-08-04 15:44:54 -07:00
Mike Arpaia
f2628b1715 Ascii art fyeah (#38) 2016-08-04 15:42:29 -07:00
Mike Arpaia
4687812f39 Sessions in MySQL (#37)
* Sessions in MySQL

* Reclaiming some names

* session renewal without new cookies on every request

* comments and docstrings

* light organization in vc generation

* go vet

* endpoints for session management

* Merging @zwass' commit with mine

* Updating salt generation to use crypt/rand

* use getRandomText for session keys

* VC no longer needs a DB or to return an error

* getRandomText docstring

* Only use session via the SessionBackend API

* Set session backend with the request, similar to db
2016-08-04 15:38:13 -07:00
Jason Meller
d9f776c756 Use Godep to vendor in all dependencies (#40)
This commit vendors in all of our dependencies using
[GoDep](https://github.com/tools/godep). We are forgoing using a vendor/ folder to avoid checking in deps into the repo.

Note: Never manually modify `Godeps/Godeps.json` this file is dynamically
by the godep CLI

Common Actions:

To add a new package foo/bar, do this:

1. Run `go get foo/bar`
1. Edit your code to import foo/bar.
1. Run `godep save` (or `godep save ./...`).

To update a package from your `$GOPATH`, do this:

1. Run `go get -u foo/bar`
1. Run `godep update foo/bar`. (You can use the `...` wildcard, for example
`godep update foo/...`).
2016-08-04 16:57:22 -04:00
Zachary Wasserman
5c349a458d Eliminate DB globals + refactor tests (#39)
* Eliminate global DB connections. Instead, one connection is established (with the underlying object supporting pooling) and passed through the gin.Context. This allows test/prod to inject the appropriate DB object into the context.
* Refactor tests appropriately for this new style of DB connection
* Fix a bug in the routing caught by refactoring of tests
2016-08-04 11:41:47 -07:00
Jason Meller
5ad7c07e0c Dockerize app (#32)
This commit adds both a Dockerfile and updates the docker-compose.yml with local mounting so that you can standup a consistent dev environment. Please view the project README for more information.
2016-08-04 11:41:18 -04:00
Zachary Wasserman
6fa2413363 Add logging and convenience methods (#34)
* Add request logging.
* Catch/log panic in request handlers.
* Add `mustGetDB` method that gets a DB connection or panics. This can simplify
  boilerplate in handlers.
* Consolidate `file` and `line` in logged fields to `location`.
* Set default log level to `WarnLevel`.
* Log a warning when Kolide is started with the example config.
* Turn on DB logging in debug mode.
2016-08-03 08:01:59 -07:00
Mike Arpaia
24638413c4 Endpoint integration tests (#28)
* Quick fix where JWTRenewalMiddleware wasn't saving the update session to the client

* integration tests for all user/account management HTTP endpoints

close #15

* Combine checks in CheckUser

* Moving t.Fatals into utility functions

* Simplifying get user by id or username flow

* Fixing incorrect error log message

* Simplifying checkUser compare
2016-08-02 15:39:20 -07:00
Mike Arpaia
fc1b8eaa05 Add bootup output to reflect that kolide binary is serving (#29)
Example output:

```bash
$ kolide-ose serve
=> kolide 0.1.0 application starting on https://:8080
=> Run `kolide help serve` for more startup options
Use Ctrl-C to stop

time="2016-08-02T14:25:02-07:00" level=info msg="some info logs!"
file=proc.go func=runtime.main line=188
time="2016-08-02T14:25:02-07:00" level=error msg="some error logs :("
file=proc.go func=runtime.main line=188
```

close #26
2016-08-02 14:42:37 -07:00
Mike Arpaia
c802a2dbc0 Cleaning up the salt generation function (#30)
close #19
2016-08-02 14:41:50 -07:00
Zachary Wasserman
82968a9430 Add configs + documentation for testing with dockerized osqueryd (#22) 2016-08-02 12:09:30 -07:00
Mike Arpaia
b74c2c52e8 Add drone.io badge to the README (#21)
close #18
2016-08-01 16:44:08 -07:00
Mike Arpaia
eee370e127 Authentication, authorization and user management (#10) 2016-08-01 16:32:20 -07:00
Mike Arpaia
91e78d276f Initial commit 2016-07-28 18:34:26 -04:00