Skip to content

Commit

Permalink
Add initial design doc and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmith5 committed Jan 3, 2022
0 parents commit ccf10b6
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Vim
*.swp

# Binary
rekorsidekick
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# πŸ” Rekor Sidekick

Rekor Sidekick monitors a Rekor signature transparency log and forwards
events of interest where ever you like.

> NB: πŸ› οΈ This software is prerelease!
84 changes: 84 additions & 0 deletions docs/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Rekor Sidekick design

The basic design of Rekor sidekick is to continually pull entries from
a Rekor server, check if the entries are of interest using a configured set
of policies and to forward entries of interest a configured set of outputs

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Event Policies β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
Decision β”‚ β”‚ Should forward entry?
β”‚ β”‚
β”‚ β”‚
β”‚ β”‚ Outputs
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Rekor Log β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ί Rekor Sidekick β”‚ ───────────────► Pager Duty β”‚
β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ Pull entries β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”¬β”€β”¬β”˜
β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚ └─────────────────► Stdout β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ └───────────────────► Loki β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
└─────────────────────► ... β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

Each configured policy should have metadata that helps make the resulting alert
be as actionable as possible. Perhaps a name that is programmatically readable
along with description?

## Event Policy Evaluation

Instead of creating a policy engine, we can an established policy evaluation
engine: Rego policies and Open Policy Agent! This keeps the complexity of
implementation low and we can lean on existing documentation for Rego policies
along with Rekor sidekick specific examples to help folks learn about writing
policies. This approaches keeps policies flexible as well and keeps our
coupling to the Rekor log formats fairly low and shifts that burden on to
policies writers.

## Data structures

We need to define a policy and policy violation:

```go
type Policy struct {
// short machine readable name
Name string

// Background on this policy. Meant for humans. Should help make a
// Policy Violation actionable
Description string

// Where is this policy defined? Could file:// for on disk or maybe
// https:// for remote?
PolicyURI string
}

type PolicyViolation struct {
// What policy was violated?
Policy Policy

// URI of the rekor entry that violates the policy
EntryURI string
}
```

## Interfaces

We should make a very simply interface for each of the output implementations so that
contributors can very easily add their own. The following makes sense right now?

```go
type Output interface {
Send(PolicyViolation) error
}
```
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/nsmith5/rekorsidekick

go 1.17

0 comments on commit ccf10b6

Please sign in to comment.