2.3. Configuring access
RHACS provides the roxctl command-line interface (CLI) to make it easy to integrate RHACS policies into your build pipeline. The roxctl CLI prints detailed information about problems and how to fix them so that developers can maintain high standards in the early phases of the container lifecycle.
To securely authenticate to the Red Hat Advanced Cluster Security for Kubernetes API server, you must create an API token.
2.3.1. Exporting and saving the API token 링크 복사링크가 클립보드에 복사되었습니다!
Procedure
After you have generated the authentication token, export it as the
ROX_API_TOKENvariable by entering the following command:$ export ROX_API_TOKEN=<api_token>(Optional): You can also save the token in a file and use it with the
--token-fileoption by entering the following command:$ roxctl central debug dump --token-file <token_file>Note the following guidelines:
-
You cannot use both the
-password(-p) and the--token-fileoptions simultaneously. -
If you have already set the
ROX_API_TOKENvariable, and specify the--token-fileoption, theroxctlCLI uses the specified token file for authentication. -
If you have already set the
ROX_API_TOKENvariable, and specify the--passwordoption, theroxctlCLI uses the specified password for authentication.
-
You cannot use both the
2.3.2. Installing the roxctl CLI by downloading the binary 링크 복사링크가 클립보드에 복사되었습니다!
You can install the roxctl CLI to interact with Red Hat Advanced Cluster Security for Kubernetes from a command-line interface. You can install roxctl on Linux, Windows, or macOS.
2.3.2.1. Installing the roxctl CLI on Linux 링크 복사링크가 클립보드에 복사되었습니다!
You can install the roxctl CLI binary on Linux by using the following procedure.
roxctl CLI for Linux is available for amd64, arm64, ppc64le, and s390x architectures.
Procedure
Determine the
roxctlarchitecture for the target operating system:$ arch="$(uname -m | sed "s/x86_64//")"; arch="${arch:+-$arch}"Download the
roxctlCLI:$ curl -L -f -o roxctl "https://mirror.openshift.com/pub/rhacs/assets/4.7.8/bin/Linux/roxctl${arch}"Make the
roxctlbinary executable:$ chmod +x roxctlPlace the
roxctlbinary in a directory that is on yourPATH:To check your
PATH, execute the following command:$ echo $PATH
Verification
Verify the
roxctlversion you have installed:$ roxctl version
2.3.2.2. Installing the roxctl CLI on macOS 링크 복사링크가 클립보드에 복사되었습니다!
You can install the roxctl CLI binary on macOS by using the following procedure.
roxctl CLI for macOS is available for amd64 and arm64 architectures.
Procedure
Determine the
roxctlarchitecture for the target operating system:$ arch="$(uname -m | sed "s/x86_64//")"; arch="${arch:+-$arch}"Download the
roxctlCLI:$ curl -L -f -o roxctl "https://mirror.openshift.com/pub/rhacs/assets/4.7.8/bin/Darwin/roxctl${arch}"Remove all extended attributes from the binary:
$ xattr -c roxctlMake the
roxctlbinary executable:$ chmod +x roxctlPlace the
roxctlbinary in a directory that is on yourPATH:To check your
PATH, execute the following command:$ echo $PATH
Verification
Verify the
roxctlversion you have installed:$ roxctl version
2.3.2.3. Installing the roxctl CLI on Windows 링크 복사링크가 클립보드에 복사되었습니다!
You can install the roxctl CLI binary on Windows by using the following procedure.
roxctl CLI for Windows is available for the amd64 architecture.
Procedure
Download the
roxctlCLI:$ curl -f -O https://mirror.openshift.com/pub/rhacs/assets/4.7.8/bin/Windows/roxctl.exe
Verification
Verify the
roxctlversion you have installed:$ roxctl version
2.3.3. Running the roxctl CLI from a container 링크 복사링크가 클립보드에 복사되었습니다!
The roxctl client is the default entry point in the RHACS roxctl image. To run the roxctl client in a container image:
Prerequisites
- You must first generate an authentication token from the RHACS portal.
Procedure
Log in to the
registry.redhat.ioregistry.$ docker login registry.redhat.ioPull the latest container image for the
roxctlCLI.$ docker pull registry.redhat.io/advanced-cluster-security/rhacs-roxctl-rhel8:4.7.8After you install the CLI, you can run it by using the following command:
$ docker run -e ROX_API_TOKEN=$ROX_API_TOKEN \
-it registry.redhat.io/advanced-cluster-security/rhacs-roxctl-rhel8:{rhacs-version} \
-e $ROX_CENTRAL_ADDRESS <command>
In Red Hat Advanced Cluster Security Cloud Service (RHACS Cloud Service), when using roxctl commands that require the Central address, use the Central instance address as displayed in the Instance Details section of the Red Hat Hybrid Cloud Console. For example, use acs-ABCD12345.acs.rhcloud.com instead of acs-data-ABCD12345.acs.rhcloud.com.
Verification
Verify the
roxctlversion you have installed.$ docker run -it registry.redhat.io/advanced-cluster-security/rhacs-roxctl-rhel8:4.7.8 version