Skip to content

Commit

Permalink
[CORE] Add binary releases (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
d0g0x01 authored Aug 11, 2023
1 parent f77d26a commit c8e162a
Show file tree
Hide file tree
Showing 13 changed files with 331 additions and 300 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: docker

on:
push:
tags:
- "*"
workflow_dispatch:
# push:
# tags:
# - "*"

env:
REGISTRY: ghcr.io
Expand All @@ -28,7 +29,7 @@ jobs:
packages: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09
with:
egress-policy: block
allowed-endpoints: >
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09
with:
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
goreleaser.com:443
golang.org:443
go.dev:443
objects.githubusercontent.com:443
proxy.golang.org:443
storage.googleapis.com:443
uploads.github.com:443
sum.golang.org:443
- name: Setup Golang
uses: actions/setup-go@v4
with:
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: KubeHound Release

on:
push:
tags:
- "*"

permissions:
contents: read

jobs:
goreleaser:
runs-on:
group: Large Runner Shared Public
labels: ubuntu-8-core-latest
permissions:
contents: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09
with:
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
goreleaser.com:443
golang.org:443
go.dev:443
objects.githubusercontent.com:443
proxy.golang.org:443
storage.googleapis.com:443
uploads.github.com:443
sum.golang.org:443
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: "1.20"

- name: Run GoReleaser
timeout-minutes: 60
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7
with:
distribution: goreleaser
version: latest
args: release --clean --config .goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/system-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,27 @@ jobs:
labels: ubuntu-8-core-latest
environment: devenv
steps:
- name: Harden Runner
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09
with:
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
goreleaser.com:443
golang.org:443
go.dev:443
objects.githubusercontent.com:443
proxy.golang.org:443
storage.googleapis.com:443
uploads.github.com:443
sum.golang.org:443
- uses: datadog/agent-github-action@v1.3
with:
api_key: ${{ secrets.DD_API_KEY }}
extra_env: DD_TRACE_DEBUG=1,DD_LOGS_ENABLED=true,DD_APM_ENABLED=true

- name: Checkout Git Repo
uses: actions/checkout@v3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09
with:
egress-policy: block
allowed-endpoints:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ go.work

# Binaries
bin/
dist/

cmd/kubehound
deployments/kubehound/data
Expand Down
50 changes: 50 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
ldflags:
- -X pkg/config.BuildVersion={{.Version}}

dir: cmd/kubehound
binary: kubehound
archives:
- name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
wrap_in_directory: true
files:
- LICENSE
- LICENSE-3rdparty.csv
- NOTICE
- README.md
- deployments/kubehound/**/*
- deployments/kubehound/docker-compose.yaml
- deployments/kubehound/docker-compose.datadog.yaml
- deployments/kubehound/docker-compose.release.yaml
- src: scripts/kubehound.sh
dst: kubehound.sh
- src: scripts/kubehound.bat
dst: kubehound.bat
- src: configs/etc/kubehound.yaml
dst: config.yaml
- src: configs/etc/kubehound-reference.yaml
dst: config-reference.yaml
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,32 @@ A Kubernetes attack graph tool allowing automated calculation of attack paths be

## Quick Start

### Run KubeHound
### Prebuilt Releases

Release binaries are available for Linux / Windows / Mac OS via the [releases](https://github.com/DataDog/KubeHound/releases) page. These provide access to core KubeHound functionality but lack support for the `make` commands detailed in subsequent sections. Once the release archive is downloaded and extracted start the backend via:

```bash
./kubehound.sh backend-up
```

Next choose a target Kubernetes cluster, either:

* Select the targeted cluster via `kubectx` (need to be installed separately)
* Use a specific kubeconfig file by exporting the env variable: `export KUBECONFIG=/your/path/to/.kube/config`

Finally run the compiled binary with packaged configuration (`config.yaml`):

```bash
./kubehound.sh run
```

### From Source

Clone this repository via git:

```bash
git clone https://github.com/DataDog/KubeHound.git
```

KubeHound ships with a sensible default configuration designed to get new users up and running quickly. First step is to prepare the application:

Expand Down
23 changes: 23 additions & 0 deletions deployments/kubehound/docker-compose.release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "3.8"
name: kubehound-release
services:
mongodb:
ports:
- "127.0.0.1:27017:27017"
volumes:
- mongodb_data:/data/db

janusgraph:
ports:
- "127.0.0.1:8182:8182"
- "127.0.0.1:8099:8099"
volumes:
- janusgraph_data:/var/lib/janusgraph

volumes:
mongodb_data:
janusgraph_data:

networks:
kind:
external: true
16 changes: 0 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand All @@ -49,31 +48,25 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-licenses v1.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/licenseclassifier v0.0.0-20210722185704-3043a050f148 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect
github.com/klauspost/compress v1.15.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nicksnyder/go-i18n/v2 v2.2.1 // indirect
github.com/otiai10/copy v1.6.0 // indirect
github.com/outcaste-io/ristretto v0.2.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/philhofer/fwd v1.1.1 // indirect
Expand All @@ -85,33 +78,27 @@ require (
github.com/prometheus/procfs v0.9.0 // indirect
github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.5.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/tinylib/msgp v1.1.6 // indirect
github.com/xanzy/ssh-agent v0.2.1 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.1 // indirect
github.com/xdg-go/stringprep v1.0.3 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.1 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand All @@ -120,9 +107,6 @@ require (
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
gopkg.in/src-d/go-git.v4 v4.13.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
inet.af/netaddr v0.0.0-20220811202034-502d2d690317 // indirect
k8s.io/apiextensions-apiserver v0.27.2 // indirect
Expand Down
Loading

0 comments on commit c8e162a

Please sign in to comment.