Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
4b28c84
Allow kube-bench to scan Bottlerocket OS (#889)
errm Jun 8, 2021
0d1bd2b
mkdocs support and update docs (#884)
yoavrotems Jun 9, 2021
dd68e8f
Change files names to start with lowercase (#898)
yoavrotems Jun 9, 2021
fdf0bbd
Fixing typos (#899)
yoavrotems Jun 9, 2021
75fe5d0
Fix ocp job issues (#893)
yoavrotems Jun 9, 2021
5375248
Add git config user (#901)
yoavrotems Jun 14, 2021
7bbcaeb
Fix issue tests 1.1.9 and 1.1.10 (#911)
yoavrotems Jun 16, 2021
6ca3ce6
Update go modules 1.16 (#910)
yoavrotems Jun 16, 2021
2d033ed
New cis v1.20 (#912)
yoavrotems Jun 16, 2021
e5e2804
Fix values of version field in cfg/cis-1.20 were wrong (#913)
mozillazg Jun 20, 2021
1173667
Add docs for cis v1.20 (#914)
mozillazg Jun 20, 2021
aedc294
Check string size (#915)
yoavrotems Jun 20, 2021
14aef40
Fix Junit missing testsuites (#920)
yoavrotems Jun 23, 2021
42f4795
doc(install): Adding detail and example for build (#928)
davidhay1969 Jul 7, 2021
016d67b
cis-1.20 section 1.1.10 command revision. (#922)
Hacks4Snacks Jul 7, 2021
cb7ee76
K8s Job Command Clean (#923)
njgibbon Jul 7, 2021
f74149d
Update goreleaser (#929)
yoavrotems Jul 14, 2021
25ba9e2
New integration testing (#947)
yoavrotems Aug 3, 2021
222e696
Upgrading apk-tools (#944)
davidhay1969 Aug 3, 2021
8ac8ebf
Update Dependencies (#941)
mmorel-35 Aug 4, 2021
42da8c6
Bump github.com/aws/aws-sdk-go from 1.40.13 to 1.40.14 (#949)
dependabot[bot] Aug 4, 2021
c91a943
Update Gorm (#950)
mmorel-35 Aug 9, 2021
b1119f5
chore(ci) update k8s.io/client-go and github.com/spf13/cobra to lates…
mmorel-35 Aug 9, 2021
ee1fd82
Bump alpine from 3.14.0 to 3.14.1 (#956)
dependabot[bot] Aug 10, 2021
e2e1566
Bump github.com/aws/aws-sdk-go from 1.40.14 to 1.40.18 (#957)
dependabot[bot] Aug 11, 2021
f205399
Bump gorm.io/gorm from 1.21.12 to 1.21.13 (#966)
dependabot[bot] Aug 30, 2021
89a7e7a
Bump golang from 1.16 to 1.17.0 (#973)
dependabot[bot] Aug 30, 2021
a985e6b
Bump k8s.io/client-go from 0.22.0 to 0.22.1 (#974)
dependabot[bot] Aug 30, 2021
ed484ca
Bump github.com/aws/aws-sdk-go from 1.40.18 to 1.40.28 (#975)
dependabot[bot] Aug 30, 2021
946a48c
Fix 4.1.9, skip irremediable checks, add /home/kubernetes mount (#976)
nkeenan38 Aug 30, 2021
548b021
Add node kubelet config path (#961)
brainfair Aug 30, 2021
2b6d21a
Bump alpine from 3.14.1 to 3.14.2 (#977)
dependabot[bot] Sep 1, 2021
b238a18
Bump github.com/aws/aws-sdk-go from 1.40.28 to 1.40.33 (#978)
dependabot[bot] Sep 2, 2021
6d758d2
Update/upgrade Alpine before installing openssl (#981)
davidhay1969 Sep 5, 2021
9863f21
Bump github.com/aws/aws-sdk-go from 1.40.33 to 1.40.37 (#982)
dependabot[bot] Sep 9, 2021
10ba0ad
Bump gorm.io/gorm from 1.21.13 to 1.21.14 (#979)
dependabot[bot] Sep 9, 2021
2bbdf8c
Remove make integration-testing (#986)
yoavrotems Sep 12, 2021
2662c07
Bump golang from 1.17.0 to 1.17.1 (#988)
dependabot[bot] Sep 19, 2021
01afd27
Bump gorm.io/driver/postgres from 1.1.0 to 1.1.1 (#989)
dependabot[bot] Sep 19, 2021
d0a4ac8
Bump github.com/aws/aws-sdk-go from 1.40.37 to 1.40.45 (#997)
dependabot[bot] Sep 22, 2021
25744cd
Bump github.com/spf13/viper from 1.8.1 to 1.9.0 (#998)
dependabot[bot] Sep 29, 2021
5b2051f
Bump k8s.io/client-go from 0.22.1 to 0.22.2 (#999)
dependabot[bot] Sep 29, 2021
0aea4ca
Bump github.com/fatih/color from 1.12.0 to 1.13.0 (#1004)
dependabot[bot] Sep 29, 2021
37581e4
fix typo in readme (#917)
jrobertson69 Sep 29, 2021
3605679
Bump github.com/aws/aws-sdk-go from 1.40.45 to 1.40.51 (#1005)
dependabot[bot] Sep 29, 2021
bfd6749
fix integration test not testing latest code and can't run test on lo…
mozillazg Oct 3, 2021
e50de81
Fix status of cis-1.20 1.2.25 should be Manual (#1010)
mozillazg Oct 3, 2021
5f7fb35
Add a trailing slash to find directory path (#1006)
lennardk Oct 3, 2021
0429226
Update release.yml (#1013)
yoavrotems Oct 3, 2021
0e61841
Update release.yml (#1014)
yoavrotems Oct 3, 2021
70fa2cc
Add various paths as used by Talos (#1009)
lennardk Oct 4, 2021
9f5ec2b
Bump github.com/aws/aws-sdk-go from 1.40.51 to 1.40.55 (#1016)
dependabot[bot] Oct 5, 2021
23d4b49
Bump gorm.io/driver/postgres from 1.1.1 to 1.1.2 (#1017)
dependabot[bot] Oct 5, 2021
e9b6137
Bump gorm.io/gorm from 1.21.15 to 1.21.16 (#1020)
dependabot[bot] Oct 14, 2021
2212c8a
Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1021)
dependabot[bot] Oct 14, 2021
cdc49f2
Bump github.com/aws/aws-sdk-go from 1.40.55 to 1.41.0 (#1022)
dependabot[bot] Oct 20, 2021
0de52d9
Bump github.com/aws/aws-sdk-go from 1.41.0 to 1.41.6 (#1027)
dependabot[bot] Oct 27, 2021
1113631
Fix experimental-encryption-provider-config test on OCP 3.11 - Issue …
tonyqui Oct 27, 2021
7a47197
Allow for usage of env var `K8S_HOST` in psql (#1026)
ycabrer Oct 27, 2021
a75afff
Bump github.com/aws/aws-sdk-go from 1.41.6 to 1.41.11 (#1031)
dependabot[bot] Oct 27, 2021
765b2d1
Bump gorm.io/driver/postgres from 1.1.2 to 1.2.0 (#1033)
dependabot[bot] Oct 27, 2021
dd68e85
Build workflow split (#1025)
mmorel-35 Oct 28, 2021
cc619e5
Bump golang from 1.17.1 to 1.17.2 (#1019)
dependabot[bot] Oct 28, 2021
13a453a
Bump gorm.io/gorm from 1.21.16 to 1.22.2 (#1037)
dependabot[bot] Nov 8, 2021
06fa1d8
Bump github.com/aws/aws-sdk-go from 1.41.11 to 1.41.15 (#1039)
dependabot[bot] Nov 8, 2021
65b45f6
Fix status of cis-1.20 4.1.6 should be Automated (#1041)
mozillazg Nov 8, 2021
e109edf
Bump k8s.io/client-go from 0.22.2 to 0.22.3 (#1040)
dependabot[bot] Nov 8, 2021
4bcad83
Bump gorm.io/driver/postgres from 1.2.0 to 1.2.1 (#1038)
dependabot[bot] Nov 8, 2021
beaad3b
Support arm64 architecture (#1036)
mozillazg Nov 8, 2021
00be5e3
Bump golang from 1.17.2 to 1.17.3 (#1043)
dependabot[bot] Nov 11, 2021
900d248
Bump github.com/aws/aws-sdk-go from 1.41.15 to 1.41.19 (#1044)
dependabot[bot] Nov 14, 2021
f8e0171
Update aks-1.0 to match official CIS Azure Kubernetes Service (AKS) B…
mozillazg Nov 14, 2021
6589eb1
Support CIS Amazon Elastic Kubernetes Service (EKS) Benchmark v1.0.1 …
mozillazg Nov 18, 2021
29c403e
Bump alpine from 3.14.2 to 3.14.3 (#1046)
dependabot[bot] Nov 18, 2021
e5a48f7
Bump github.com/aws/aws-sdk-go from 1.41.19 to 1.42.9 (#1052)
dependabot[bot] Nov 28, 2021
ddd9c8a
Bump gorm.io/driver/postgres from 1.2.1 to 1.2.2 (#1053)
dependabot[bot] Nov 29, 2021
5ad2817
Add aks-1.0 to docs/architecture.md (#1051)
mozillazg Nov 29, 2021
719ed03
Bump k8s.io/client-go from 0.22.3 to 0.22.4 (#1054)
dependabot[bot] Nov 29, 2021
4649cb6
Bump gorm.io/gorm from 1.22.2 to 1.22.3 (#1047)
dependabot[bot] Nov 29, 2021
0ce8a92
Bump alpine from 3.14.3 to 3.15.0 (#1056)
dependabot[bot] Dec 1, 2021
7e5445d
fix: change the path for images in the asff docs markdown (#1059)
64J0 Dec 1, 2021
bb466bb
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 (#1057)
dependabot[bot] Dec 1, 2021
26b07a8
Bump golang from 1.17.3 to 1.17.4 (#1062)
dependabot[bot] Dec 9, 2021
2d6bf55
Support CIS Google Kubernetes Engine (GKE) Benchmark v1.2.0 (#1050)
mozillazg Dec 9, 2021
1fbf2ca
Bump golang from 1.17.4 to 1.17.5 (#1071)
dependabot[bot] Dec 29, 2021
a2b3de1
Support Yandex Managed Service for Kubernetes (#1069)
mirtov-alexey Jan 6, 2022
7f3ff23
Bump k8s.io/client-go from 0.22.4 to 0.23.1
dependabot[bot] Dec 20, 2021
7dd6fcc
Bump github.com/spf13/cobra from 1.2.1 to 1.3.0 (#1075)
dependabot[bot] Jan 10, 2022
1fad8f5
Update auto-detection codes to support check platform version (#1074)
mozillazg Jan 10, 2022
d3cbc64
Bump golang from 1.17.5 to 1.17.6 (#1079)
dependabot[bot] Jan 12, 2022
6a7eec0
Merge branch 'main' of https://github.com/aquasecurity/kube-bench int…
Jan 12, 2022
392df47
minor change
Jan 13, 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
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
63 changes: 58 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ on:
- "*.md"
- "LICENSE"
- "NOTICE"
env:
GO_VERSION: "1.16"
KIND_VERSION: "v0.11.1"
KIND_IMAGE: "kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6"

jobs:
build:
name: Build
lint:
name: Lint
runs-on: ubuntu-18.04
steps:
- name: Setup Go
Expand All @@ -26,16 +31,64 @@ jobs:
uses: actions/checkout@v2
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
unit:
name: Unit tests
runs-on: ubuntu-18.04
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Checkout code
uses: actions/checkout@v2
- name: Run unit tests
run: make tests
- name: Upload code coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v2
with:
file: ./coverage.txt
e2e:
name: E2e tests
runs-on: ubuntu-18.04
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Kubernetes cluster (KIND)
uses: engineerd/setup-kind@v0.5.0
with:
version: ${{ env.KIND_VERSION }}
image: ${{ env.KIND_IMAGE }}
name: kube-bench
- name: Test connection to Kubernetes cluster
run: |
kubectl cluster-info
kubectl describe node
- name: Run integration tests
run: make integration-tests
run: |
make integration-test
- name: Compare output with expected output
uses: GuillaumeFalourd/diff-action@v1
with:
first_file_path: ./test.data
second_file_path: integration/testdata/Expected_output.data
expected_result: PASSED
release:
name: Release snapshot
runs-on: ubuntu-18.04
needs: [e2e, unit]
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Checkout code
uses: actions/checkout@v2
- name: Dry-run release snapshot
uses: goreleaser/goreleaser-action@v2
with:
version: v0.148.0
version: v0.169.0
args: release --snapshot --skip-publish --rm-dist
37 changes: 37 additions & 0 deletions .github/workflows/mkdocs-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
# This is a manually triggered workflow to build and publish the MkDocs from the
# main branch to GitHub pages at https://aquasecurity.github.io/kube-bench.
name: Deploy documentation

on:
workflow_dispatch:
inputs:
version:
description: Version to be deployed
required: true

jobs:
deploy:
name: Deploy documentation
runs-on: ubuntu-18.04
steps:
- name: Checkout main
uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: true
- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: |
pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
pip install mike
pip install mkdocs-macros-plugin
env:
# Note: It is not the same as ${{ secrets.GITHUB_TOKEN }} !
GH_TOKEN: ${{ secrets.MKDOCS_AQUA_BOT }}
- run: |
git config user.name "aqua-bot"
git config user.email "aqua-bot@users.noreply.github.com"
- run: |
mike deploy --push --update-aliases ${{ github.event.inputs.version }} latest
7 changes: 4 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
password: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
- name: Get version
id: get_version
uses: crazy-max/ghaction-docker-meta@v1
uses: crazy-max/ghaction-docker-meta@v3
with:
images: ${{ env.REP }}
tag-semver: |
Expand All @@ -52,16 +52,17 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
builder: ${{ steps.buildx.outputs.name }}
push: true
build-args: |
KUBEBENCH_VERSION=${{ steps.get_version.outputs.version }}
tags: |
${{ env.DOCKERHUB_ALIAS }}/${{ env.REP }}:${{ steps.get_version.outputs.version }}
public.ecr.aws/${{ env.ALIAS }}/${{ env.REP }}:${{ steps.get_version.outputs.version }}
${{ env.DOCKERHUB_ALIAS }}/${{ env.REP }}:latest
public.ecr.aws/${{ env.ALIAS }}/${{ env.REP }}:latest
cache-from: type=local,src=/tmp/.buildx-cache/release
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache/release

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
26 changes: 24 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
push:
tags:
- "v*"
env:
GO_VERSION: "1.16"
KIND_VERSION: "v0.11.1"
KIND_IMAGE: "kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6"

jobs:
release:
name: Release
Expand All @@ -17,12 +22,29 @@ jobs:
uses: actions/checkout@v2
- name: Run unit tests
run: make tests
- name: Setup Kubernetes cluster (KIND)
uses: engineerd/setup-kind@v0.5.0
with:
version: ${{ env.KIND_VERSION }}
image: ${{ env.KIND_IMAGE }}
name: kube-bench
- name: Test connection to Kubernetes cluster
run: |
kubectl cluster-info
kubectl describe node
- name: Run integration tests
run: make integration-tests
run: |
make integration-test
- name: Compare output with expected output
uses: GuillaumeFalourd/diff-action@v1
with:
first_file_path: ./test.data
second_file_path: integration/testdata/Expected_output.data
expected_result: PASSED
- name: Release
uses: goreleaser/goreleaser-action@v2
with:
version: v0.148.0
version: v0.169.0
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ coverage.txt
# Directory junk file
.DS_Store
thumbs.db
/kubeconfig.kube-bench
/test.data
19 changes: 15 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
project_name: kube-bench
env:
- GO111MODULE=on
- KUBEBENCH_CFG=/etc/kube-bench/cfg
Expand Down Expand Up @@ -28,13 +29,23 @@ archives:
nfpms:
-
vendor: Aqua Security
maintainer: Yoav Rotem <yoav.rotem@aquasec.com>
description: "The Kubernetes Bench for Security is a Go application that checks whether Kubernetes is deployed according to security best practices"
maintainer: Yoav Rotem <yoav.rotem@aquasec.com>
license: Apache-2.0
homepage: https://github.com/aquasecurity/kube-bench
files:
"cfg/**/*": "/etc/kube-bench/cfg"
"cfg/config.yaml": "/etc/kube-bench/cfg"
file_name_template: '{{ .Binary }}_{{.Version}}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{.Arm }}{{ end }}'
contents:
- src: "cfg/**/*"
dst: "/etc/kube-bench/cfg"
- src: "cfg/config.yaml"
dst: "/etc/kube-bench/cfg/config.yaml"
formats:
- deb
- rpm
changelog:
sort: asc
filters:
exclude:
- '^docs'
- '^test'
- '^release'
83 changes: 69 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Thank you for taking an interest in contributing to kube-bench !

## Issues
## Contributing, bug reporting, openning issues and starting discussions

### Issues

- Feel free to open an issue for any reason as long as you make it clear if the issue is about a bug/feature/question/comment.
- Please spend some time giving due diligence to the issue tracker. Your issue might be a duplicate. If it is, please add your comment to the existing issue.
Expand All @@ -9,16 +11,69 @@ Thank you for taking an interest in contributing to kube-bench !
- For questions and bug reports, please include the following information:
- version of kube-bench you are running (from kube-bench version) along with the command line options you are using.
- version of Kubernetes you are running (from kubectl version or oc version for Openshift).
- Verbose log output, by setting the `-v 10` command line option.

## Pull Requests

1. Every Pull Request should have an associated Issue, unless you are fixing a trivial documentation issue.
1. We will not accept changes to LICENSE, NOTICE or CONTRIBUTING from outside the Aqua Security team. Please raise an Issue if you believe there is a problem with any of these files.
1. Your PR is more likely to be accepted if it focuses on just one change.
1. Describe what the PR does. There's no convention enforced, but please try to be concise and descriptive. Treat the PR description as a commit message. Titles that start with "fix"/"add"/"improve"/"remove" are good examples.
1. Please add the associated Issue in the PR description.
1. There's no need to add or tag reviewers.
1. If a reviewer commented on your code or asked for changes, please remember to mark the discussion as resolved after you address it. PRs with unresolved issues should not be merged (even if the comment is unclear or requires no action from your side).
1. Please include a comment with the results before and after your change.
1. Your PR is more likely to be accepted if it includes tests (We have not historically been very strict about tests, but we would like to improve this!).
- Verbose log output, by setting the `-v 3` command line option.

### Bugs

If you think you have found a bug please follow the instructions below.

- Open a [new bug](https://github.com/aquasecurity/kube-bench/issues/new?assignees=&labels=&template=bug_report.md) if a duplicate doesn't already exist.
- Make sure to give as much information as possible in the following questions
- Overview
- How did you run kube-bench?
- What happened?
- What did you expect to happen
- Environment
- Running processes
- Configuration files
- Anything else you would like to add
- Set `-v 3` command line option and save the log output. Please paste this into your issue.


### Features

We also use the GitHub discussions to track feature requests. If you have an idea to make kube-bench even more awesome follow the steps below.

- Open a [new discussion](https://github.com/aquasecurity/kube-bench/discussions/new?category_id=19113743) if a duplicate doesn't already exist.
- Remember users might be searching for your discussion in the future, so please give it a meaningful title to helps others.
- Clearly define the use case, using concrete examples. For example, I type `this` and kube-bench does `that`.
- If you would like to include a technical design for your feature please feel free to do so.

### Questions

We also use the GitHub discussions to Q&A.

- Open a [new discussion](https://github.com/aquasecurity/kube-bench/discussions/new) if a duplicate doesn't already exist.
- Remember users might be searching for your discussion in the future, so please give it a meaningful title to helps others.


### Pull Requests

We welcome pull requests!
- Every Pull Request should have an associated Issue, unless you are fixing a trivial documentation issue.
- We will not accept changes to LICENSE, NOTICE or CONTRIBUTING from outside the Aqua Security team. Please raise an Issue if you believe there is a problem with any of these files.
- Your PR is more likely to be accepted if it focuses on just one change.
- Describe what the PR does. There's no convention enforced, but please try to be concise and descriptive. Treat the PR description as a commit message. Titles that start with "fix"/"add"/"improve"/"remove" are good examples.
- Please add the associated Issue in the PR description.
- Please include a comment with the results before and after your change.
- There's no need to add or tag reviewers.
- If a reviewer commented on your code or asked for changes, please remember to mark the discussion as resolved after you address it. PRs with unresolved issues should not be merged (even if the comment is unclear or requires no action from your side).
- Please include a comment with the results before and after your change.
- Your PR is more likely to be accepted if it includes tests (We have not historically been very strict about tests, but we would like to improve this!).
- You're welcome to submit a draft PR if you would like early feedback on an idea or an approach.
- Happy coding!

## Testing locally with kind

Our makefile contains targets to test your current version of kube-bench inside a [Kind](https://kind.sigs.k8s.io/) cluster. This can be very handy if you don't want to run a real Kubernetes cluster for development purposes.

First, you'll need to create the cluster using `make kind-test-cluster` this will create a new cluster if it cannot be found on your machine. By default, the cluster is named `kube-bench` but you can change the name by using the environment variable `KIND_PROFILE`.

*If kind cannot be found on your system the target will try to install it using `go get`*

Next, you'll have to build the kube-bench docker image using `make build-docker`, then we will be able to push the docker image to the cluster using `make kind-push`.

Finally, we can use the `make kind-run` target to run the current version of kube-bench in the cluster and follow the logs of pods created. (Ctrl+C to exit)

Every time you want to test a change, you'll need to rebuild the docker image and push it to cluster before running it again. ( `make build-docker kind-push kind-run` )

22 changes: 16 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
FROM golang:1.16 AS build
FROM golang:1.17.6 AS build
WORKDIR /go/src/github.com/aquasecurity/kube-bench/
COPY makefile makefile
COPY go.mod go.sum ./
COPY main.go .
COPY check/ check/
COPY cmd/ cmd/
COPY internal/ internal/
ARG KUBEBENCH_VERSION
ARG GOOS=linux
ARG GOARCH=amd64
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build -a -ldflags "-X github.com/aquasecurity/kube-bench/cmd.KubeBenchVersion=${KUBEBENCH_VERSION} -w" -o /go/bin/kube-bench
RUN make build && cp kube-bench /go/bin/kube-bench

FROM alpine:3.13 AS run
FROM alpine:3.15.0 AS run
WORKDIR /opt/kube-bench/
# add GNU ps for -C, -o cmd, and --no-headers support
# https://github.com/aquasecurity/kube-bench/issues/109
RUN apk --no-cache add procps

# Upgrading apk-tools to remediate CVE-2021-36159 - https://snyk.io/vuln/SNYK-ALPINE314-APKTOOLS-1533752
# https://github.com/aquasecurity/kube-bench/issues/943
RUN apk --no-cache upgrade apk-tools

# Openssl is used by OpenShift tests
# https://github.com/aquasecurity/kube-bench/issues/535
RUN apk --no-cache add openssl
# Ensuring that we update/upgrade before installing openssl, to mitigate CVE-2021-3711 and CVE-2021-3712
RUN apk update && apk upgrade && apk --no-cache add openssl

# Add glibc for running oc command
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.33-r0/glibc-2.33-r0.apk
RUN apk add glibc-2.33-r0.apk
RUN apk add jq

ENV PATH=$PATH:/usr/local/mount-from-host/bin

Expand Down
Loading