Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e96f891
Draft : Crowdstrike source with just crowdscores
Nov 28, 2022
85163f4
Draft: adding alerts
Nov 28, 2022
1951b4c
Adds alerts and some testing
Nov 28, 2022
b932a90
Adds alert tests
Nov 28, 2022
187a1b9
Adds alert to pluging
Nov 28, 2022
7a49bd4
review comments
Nov 29, 2022
e472903
fix spelling action check
Nov 29, 2022
3cdc570
Update plugins/source/crowdstrike/README.md
cqgaurav Nov 29, 2022
d5e5a18
Update plugins/source/crowdstrike/client/client.go
cqgaurav Nov 29, 2022
000c9d1
Update plugins/source/crowdstrike/resources/services/incidents/crowds…
cqgaurav Nov 29, 2022
7da1812
Update plugins/source/crowdstrike/resources/services/alerts/query_fet…
cqgaurav Nov 29, 2022
f0e6fc4
commit
Nov 29, 2022
eaedb0e
udpate readme
Nov 29, 2022
b41b849
Merge branch 'main' into crowdstrike
cqgaurav Nov 29, 2022
daa9990
Merge branch 'main' into crowdstrike
cqgaurav Nov 30, 2022
af0aca4
Change primary key for crowdscore
Nov 30, 2022
33b9d90
Commit release configuration files
Nov 30, 2022
6d2254e
remove arns
Dec 1, 2022
8e35e3f
Merge branch 'main' into crowdstrike
cqgaurav Dec 1, 2022
e744f28
allow crowdstrike
Dec 1, 2022
4a5c3fa
Merge branch 'main' into crowdstrike
cqgaurav Dec 1, 2022
58573cf
Merge branch 'main' into crowdstrike
cqgaurav Dec 1, 2022
5aeb1e2
add more docs
Dec 1, 2022
42160ee
fix docs
Dec 1, 2022
d580406
Merge branch 'main' into crowdstrike
cqgaurav Dec 1, 2022
f9b64d6
Merge branch 'main' into crowdstrike
cqgaurav Dec 1, 2022
067bfb8
Merge branch 'main' into crowdstrike
cqgaurav Dec 2, 2022
d5dde4d
adds a changelog
Dec 2, 2022
8f3cee0
adds a dummy crowdstrike version
Dec 2, 2022
330bd42
generate tables
Dec 2, 2022
725c7ad
Merge branch 'main' into crowdstrike
cqgaurav Dec 2, 2022
1dc77b9
remove changelog
Dec 2, 2022
9d0b2ee
Add gitignore
hermanschaaf Dec 2, 2022
95ae202
Merge branch 'main' into crowdstrike
cqgaurav Dec 2, 2022
7b045dc
Merge branch 'main' into crowdstrike
erezrokah Dec 4, 2022
02489a8
Merge branch 'main' into crowdstrike
cqgaurav Dec 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/styles/Vocab/Base/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ bugfix
nvm
npm
Gandi
CrowdStrike
parallelization
hyperscale
goroutines
38 changes: 38 additions & 0 deletions plugins/source/crowdstrike/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generate mocks for mock/unit testing
.PHONY: gen-mocks
gen-mocks:
go generate ./client/...

# Test unit
.PHONY: test
test:
go test -timeout 3m ./...

# Install tools
.PHONY: install-tools
install-tools:
@echo Installing tools from tools/tool.go
@cat tools/tool.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %

# Install pre-commit hooks. This requires pre-commit to be installed (https://pre-commit.com/)
.PHONY: install-hooks
install-hooks:
pre-commit install

.PHONY: gen-docs
gen-docs:
rm -rf ./docs/tables/*
go run main.go doc ./docs/tables

.PHONY: lint
lint:
golangci-lint run --config ../../.golangci.yml

.PHONY: gen-code
gen-code:
grep -rl '// Code generated by codegen; DO NOT EDIT.' resources/services/* | xargs rm
go run codegen/main.go

# All gen targets
.PHONY: gen
gen: gen-code gen-docs
38 changes: 38 additions & 0 deletions plugins/source/crowdstrike/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# CrowdStrike Plugin

This plugin pulls information from CrowdStrike and loads it into any supported CloudQuery destination (e.g. PostgreSQL).

## Links

- [Tables](./docs/tables/README.md)

## Authentication

In order to fetch information from CrowdStrike, `cloudquery` needs to be authenticated. A client id and secret is required for authentication. Follow [these steps](https://www.crowdstrike.com/blog/tech-center/get-access-falcon-apis/) to set these up. Note that you will also need to enlist the client to have the appropriate scope for what you want to query.

## Configuration

To configure CloudQuery to extract from CrowdStrike, create a `.yml` file in your CloudQuery configuration directory.
For example, the following configuration will extract information from CrowdStrike, and connect it to a `postgresql` destination plugin

```yml
kind: source
spec:
# Source spec section
name: crowdstrike
path: cloudquery/crowdstrike
version: "0.0.1" # latest version of crowdstrike plugin
tables: ["*"]
destinations: ["postgresql"]
spec:
client_id: <CLIENT_ID>
client_secret: <CLIENT_SECRET>
```

## Example

You can reduce alert fatigue by narrowing alerts down from CrowdStrike using fuzzy matching.

```sql
select * from crowdstrike_alerts_query where resources like ('%filter_here%');
```
72 changes: 72 additions & 0 deletions plugins/source/crowdstrike/client/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package client

import (
"context"
"errors"
"fmt"
"os"

"github.com/cloudquery/plugin-sdk/schema"
"github.com/cloudquery/plugin-sdk/specs"
"github.com/crowdstrike/gofalcon/falcon"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)

type Client struct {
logger zerolog.Logger
spec specs.Source
Services Services
}

type Services struct {
Incidents Incidents
Alerts Alerts
}

func (*Client) Logger() *zerolog.Logger {
return &log.Logger
}

func (*Client) ID() string {
return c.spec.Name
}

func New(ctx context.Context, logger zerolog.Logger, s specs.Source) (schema.ClientMeta, error) {
crowdStrikeSpec := &Spec{}
if err := s.UnmarshalSpec(&crowdStrikeSpec); err != nil {
return nil, fmt.Errorf("failed to unmarshal CrowdStrike spec: %w", err)
}
clientId, ok := os.LookupEnv("FALCON_CLIENT_ID")
Comment thread
cqgaurav marked this conversation as resolved.
if !ok {
if crowdStrikeSpec.ClientID == "" {
return nil, errors.New("missing FALCON_CLIENT_ID, either set it as an environment variable or pass it in the configuration")
}
clientId = crowdStrikeSpec.ClientID
}

secret, ok := os.LookupEnv("FALCON_CLIENT_SECRET")
if !ok {
if crowdStrikeSpec.ClientID == "" {
return nil, errors.New("missing FALCON_CLIENT_SECRET, either set it as an environment variable or pass it in the configuration")
}
secret = crowdStrikeSpec.ClientSecret
}

c, err := falcon.NewClient(&falcon.ApiConfig{
ClientId: clientId,
ClientSecret: secret,
Context: ctx,
})
if err != nil {
return nil, err
}
return &Client{
logger: logger,
Services: Services{
Incidents: c.Incidents,
Alerts: c.Alerts,
},
spec: s,
}, nil
}
148 changes: 148 additions & 0 deletions plugins/source/crowdstrike/client/mocks/mock_alerts_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading