- StackRox Kubernetes Security Platform
The StackRox Kubernetes Security Platform performs a risk analysis of the container environment, delivers visibility and runtime alerts, and provides recommendations to proactively improve security by hardening the environment. StackRox integrates with every stage of container lifecycle: build, deploy and runtime.
The StackRox Kubernetes Security platform is built on the foundation of the product formerly known as Prevent, which itself was called Mitigate and Apollo. You may find references to these previous names in code or documentation.
You can reach out to us through Slack (#stackrox). For alternative ways, stop by our Community Hub stackrox.io.
For event updates, blogs and other resources follow the StackRox community site at stackrox.io.
For the StackRox Code of Conduct.
To report a vulnerability or bug.
For a quick start, run the installation script:
/bin/bash <(curl -fsSL https://raw.githubusercontent.com/stackrox/stackrox/master/scripts/quick-install.sh)For clusters with limited resources, use the --small option (not recommended for production):
/bin/bash <(curl -fsSL https://raw.githubusercontent.com/stackrox/stackrox/master/scripts/quick-install.sh) --smallFor manual installation and customization options, follow the operator installation guide.
Click to expand
If you used the quick-install script, it sets up a port-forward to Central and prints the admin password at the end. Go to https://localhost:8000/main/dashboard in your browser.
For a manual operator installation, set up port-forwarding and retrieve the admin password:
kubectl -n stackrox port-forward deploy/central 8000:8443kubectl -n stackrox get secrets central-htpasswd --template='{{.data.password | base64decode}}'Then go to https://localhost:8000 in your web browser.
- Username:
admin - Password: as printed by the script, or retrieved from the secret above.
- Start with pull request guidelines if you plan to make a contribution
- Look at shepherding for non-trivial code submissions
- Check out our AI policy
- Go coding style guide: go-coding-style.md
- UI Dev Docs: Refer to ui/README.md
- E2E Dev Docs: Refer to qa-tests-backend/README.md
The following tools are necessary to test code and build image(s):
Click to expand
- Make
- Go
- Various Go linters that can be installed using
make reinstall-dev-tools. - UI build tooling as specified in ui/README.md.
- Docker
- Note: Docker Desktop now requires a paid subscription for larger, enterprise companies.
- Some StackRox devs recommend Colima
- Xcode command line tools (macOS only)
- Bats is used to run certain shell tests.
You can obtain it with
brew install batsornpm install -g bats. - oc OpenShift cli tool
- shellcheck for shell scripts linting.
Xcode - macOS Only
Usually you would have these already installed by brew. However, if you get an error when building the golang x/tools, try first making sure the EULA is agreed by:
- starting Xcode
- building a new blank app project
- starting the blank project app in the emulator
- close both the emulator and the Xcode, then
- run the following commands:
xcode-select --install
sudo xcode-select --switch /Library/Developer/CommandLineTools # Enable command line tools
sudo xcode-select -s /Applications/Xcode.app/Contents/DeveloperFor more info, see nodejs/node-gyp#569
Click to expand
# Create a GOPATH: this is the location of your Go "workspace".
# (Note that it is not – and must not – be the same as the path Go is installed to.)
# The default is to have it in ~/go/, or ~/development, but anything you prefer goes.
# Whatever you decide, create the directory, set GOPATH, and update PATH:
export GOPATH=$HOME/go # Change this if you choose to use a different workspace.
export PATH=$PATH:$GOPATH/bin
# You probably want to permanently set these by adding the following commands to your shell
# configuration (e.g. ~/.bash_profile)
cd $GOPATH
mkdir -p bin pkg
mkdir -p src/github.com/stackrox
cd src/github.com/stackrox
git clone git@github.com:stackrox/stackrox.gitClick to expand
To sweeten your experience, install the workflow scripts beforehand.
$ cd $GOPATH/src/github.com/stackrox/stackrox
$ make install-dev-tools
$ make imageNow, you need to bring up a Kubernetes cluster yourself before proceeding. Development can either happen in GCP or locally with Docker Desktop, Colima, minikube.
Note: Docker Desktop and Colima are more suited for macOS development, because the cluster will have access to images built with
make imagelocally without additional configuration. Also, Collector has better support for these than minikube where drivers may not be available.
# To save time on rebuilds by skipping UI builds, set:
$ export SKIP_UI_BUILD=1
# To save time on rebuilds by skipping CLI builds, set:
$ export SKIP_CLI_BUILD=1
# When you deploy locally make sure your kube context points to the desired kubernetes cluster,
# for example Docker Desktop.
# To check the current context you can call a workflow script:
$ roxkubectx
# To deploy locally using roxie (recommended):
$ ./scripts/roxie.sh deploy --config deploy/roxie-config-local-dev.yaml
# Now you can access StackRox dashboard at https://localhost:8000
# or simply call another workflow script:
$ logmeinTo read more about roxie and available deployment options, consult deploy/README.md.
Click to expand
# Build image, this will create `stackrox/main` with a tag defined by `make tag`.
$ make image
# Compile all binaries
$ make main-build-dockerized
# Displays the docker image tag which would be generated
$ make tag
# Note: there are integration tests in some components, and we currently
# run those manually. They will be re-enabled at some point.
$ make test
# Apply and check style standards in Go and JavaScript
$ make style
# enable pre-commit hooks for style checks
$ make init-githooks
# Compile and restart only central
$ make fast-central
# Compile only sensor
$ make fast-sensor
# Only compile protobuf
$ make proto-generated-srcs
# Build all images (operator + operand) from this repo, sharing the tag from `make tag`,
# which is often called a "main tag". Use `SKIP_EXISTING_IMAGES=1` to skip rebuilding images.
#
$ make all-images SKIP_EXISTING_IMAGES=1Click to expand
The workflow repository contains some helper scripts
which support our development workflow. Explore more commands with roxhelp --list-all.
# Change directory to rox root
$ cdrox
# Handy curl shortcut for your StackRox central instance
# Uses https://localhost:8000 by default or ROX_BASE_URL env variable
# Also uses the admin credentials from your last deployment
$ roxcurl /v1/metadata
# Run quickstyle checks, faster than stackrox's "make style"
$ quickstyle
# The workflow repository includes some tools for supporting
# working with multiple inter-dependent branches.
# Examples:
$ smart-branch <branch-name> # create new branch
... work on branch...
$ smart-rebase # rebase from parent branch
... continue working on branch...
$ smart-diff # check diff relative to parent branch
... git push, etc.Click to expand
If you're using GoLand for development, the following can help improve the experience.
Make sure the Protocol Buffers plugin is installed. The plugin comes installed by default in GoLand.
If it isn't, use Help | Find Action..., type Plugins and hit enter, then switch to Marketplace, type its name and install the plugin.
This plugin does not know where to look for .proto imports by default in GoLand therefore you need to explicitly
configure paths for this plugin. See https://github.com/jvolkman/intellij-protobuf-editor#path-settings.
- Go to
GoLand | Preferences | Languages & Frameworks | Protocol Buffers. - Uncheck
Configure automatically. - Click on
+button, navigate and select./protodirectory in the root of the repo. - Optionally, also add
$HOME/go/pkg/mod/github.com/gogo/googleapis@1.1.0and$HOME/go/pkg/mod/github.com/gogo/protobuf@v1.3.1/. - To verify: use menu
Navigate | File...type any.protofile name, e.g.alert_service.proto, and check that all import strings are shown green, not red.
Click to expand
Go tests annotated with //go:build sql_integration require a PostgreSQL server listening on port 5432.
Due to how authentication is set up in code, it is the easiest to start Postgres in a container like this:
$ docker run --rm --env POSTGRES_USER="$USER" --env POSTGRES_HOST_AUTH_METHOD=trust --publish 5432:5432 docker.io/library/postgres:15With that running in the background, sql_integration tests can be triggered from IDE or command-line.
Click to expand
Kubernetes debugger setup
With GoLand, you can naturally use breakpoints and the debugger when running unit tests in IDE.
If you would like to debug local or even remote deployment, follow the procedure below.
- Create debug build locally by exporting
DEBUG_BUILD=yes:Alternatively, debug build will also be created when the branch name contains$ DEBUG_BUILD=yes make image
-debugsubstring. This works locally withmake imageand in CI. - Deploy the image using instructions from this README file.
- Start the debugger (and port forwarding) in the target pod using
roxdebugcommand fromworkflowrepo.# For Central $ roxdebug # For Sensor $ roxdebug deploy/sensor # See usage help $ roxdebug --help
- Configure GoLand for remote debugging (should be done only once):
- Open
Run | Edit Configurations …, click on the+icon to add new configuration, chooseGo Remotetemplate. - Choose
Host:localhostandPort:40000. Give this configuration some name. - Select
On disconnect:Leave it running(this prevents GoLand forgetting breakpoints on reconnect).
- Open
- Attach GoLand to debugging port: select
Run | Debug…and choose configuration you've created. If all done right, you should seeConnectedmessage in theDebug | Debugger | Variableswindow at the lower part of the screen. - Set some code breakpoints, trigger corresponding actions and happy debugging!
See Debugging go code running in Kubernetes for more info.
Click to Expand
The following information has been gathered to help with the installation and operation of the open source StackRox project. These recommendations were developed for the Red Hat Advanced Cluster Security for Kubernetes product and have not been tested with the upstream StackRox project.
Recommended Kubernetes Distributions
The Kubernetes Platforms that StackRox has been deployed onto with minimal issues are listed below.
- Red Hat OpenShift Dedicated (OSD)
- Azure Red Hat OpenShift (ARO)
- Red Hat OpenShift Service on AWS (ROSA)
- Amazon Elastic Kubernetes Service (EKS)
- Google Kubernetes Engine (GKE)
- Microsoft Azure Kubernetes Service (AKS)
If you deploy into a Kubernetes distribution other than the ones listed above you may encounter issues.
Recommended Operating Systems
StackRox is known to work on the recent versions of the following operating systems.
- Ubuntu
- Debian
- Red Hat Enterprise Linux (RHEL)
- CentOS
- Fedora CoreOS
- Flatcar Container Linux
- Google COS
- Amazon Linux
- Garden Linux
Recommended Web Browsers
The following table lists the browsers that can view the StackRox web user interface.
- Google Chrome 88.0 (64-bit)
- Microsoft Internet Explorer Edge
- Version 44 and later (Windows)
- Version 81 (Official build) (64-bit)
- Safari on MacOS (Mojave) - Version 14.0
- Mozilla Firefox Version 82.0.2 (64-bit)