Skip to content

Commit 3e5b866

Browse files
committed
Merge branch 'master' of github.com:devsecops-workshop/workshop-guide
2 parents 808f1b5 + b782c8d commit 3e5b866

File tree

4 files changed

+64
-11
lines changed

4 files changed

+64
-11
lines changed

content/10-rhacs-setup/_index.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,24 @@ Now create a new Integration:
8888

8989
First you have to generate an init bundle which contains certificates and is used to authenticate a **SecuredCluster** to the **Central** instance, again regardless if it's the same cluster as the Central instance or a remote/other cluster.
9090

91-
In the **ACS Portal**:
91+
We are using the API to create the init bundle in this workshop. For the steps to create the init bundle in the ACS Portal see the appendix.
9292

93-
- Navigate to **Platform Configuration → Integrations**.
94-
- Under the **Authentication Tokens** section, click on **Cluster Init Bundle**.
95-
- Click **Generate bundle**
96-
- Enter a name for the cluster init bundle and click **Generate**.
97-
- Click **Download Kubernetes Secret File** to download the generated bundle.
93+
Creating the init bundle using the **API** on the commandline:
94+
95+
TODO: explain
96+
97+
``` bash
98+
#Export ACS central instance endpoint
99+
export ROX_ENDPOINT=<central_url:443>
100+
# Export bundle-name
101+
export DATA={\"name\":\"<bundle name>\"}
102+
# Export ACS admin password
103+
export PASSWORD=<password>
104+
105+
curl -k -o bundle.json -X POST -u "admin:$PASSWORD" -H "Content-Type: application/json" --data $DATA https://${ROX_ENDPOINT}/v1/cluster-init/init-bundles
106+
107+
cat bundle.json | jq -r '.kubectlBundle'  | base64 -d > kube-secrets.bundle
108+
```
98109

99110
The init bundle needs to be applied on all OpenShift clusters you want to secure & monitor.
100111

@@ -104,11 +115,10 @@ For this workshop we run **Central** and **SecuredCluster** on one OpenShift clu
104115

105116
**Apply the init bundle**
106117

107-
- Use the `oc` command to log in to the OpenShift cluster as `cluster-admin`.
108-
- The easiest way might be to use the **Copy login command** link from the UI
109-
- Switch to the **Project** you installed **ACS Central** in, it should be `stackrox`.
110-
- Run `oc create -f <init_bundle>.yaml -n stackrox` pointing to the init bundle you downloaded from the Central instance and the Project you created.
111-
- This will create a number of secrets:
118+
- Open a web terminal
119+
- Use the `oc` command to switch to the **Project** you installed **ACS Central** in, it should be `stackrox`.
120+
- Run `oc create -f > kube-secrets.bundle -n stackrox` pointing to the init bundle you downloaded from the Central instance or created via the API as above.
121+
- This will create a number of secrets, the output should be:
112122

113123
```
114124
secret/collector-tls created

content/2-prepare-cluster/_index.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,35 @@ You'll see a review of your settings, hit `Create StorageSystem`. Don't worry if
3333

3434
As mentioned already this takes some time so go ahead and install the other prerequisites. We'll come back later.
3535

36+
## Prepare to run oc commands
37+
38+
You will be asked to run `oc` (the OpenShift commandline tool) commands a couple of times. We will do this by using the **OpenShift Web Terminal**. This is the easiest way because you don't have to install `oc` or an SSH client.
39+
40+
### Install OpenShift Web Terminal
41+
42+
To extend OpenShift with the Web Terminal option, install the **Web Terminal** operator:
43+
44+
- Login to the OpenShift Webconsole with you cluster admin credentials
45+
- In the Web Console, go to **Operators > OperatorHub** and search for the **Web Terminal** operator
46+
- Install the operator with default settings
47+
48+
This will take some time and installs another operator as dependency.
49+
50+
After the operator has installed, reload the OCP Web Console browser window. You will now have a new button (**>\_**) in the upper right. Click it to start a new web terminal. From here you can run the `oc` commands when the lab guide requests it (copy/paste might depend on your laptop OS and browser settings, e.g. try `Ctrl-Shift-V` for pasting).
51+
52+
{{< figure src="../images/web-terminal.png?width=50pc&classes=border,shadow" title="Click image to enlarge" >}}
53+
54+
{{% notice warning %}}
55+
The terminal is not persistent, so if it was closed for any reason anything you did in the terminal is gone after re-opening.
56+
{{% /notice %}}
57+
58+
If for any reason you can't use the webterminal, your options are:
59+
60+
- Install and run `oc` on your laptop
61+
- SSH into the bastion host, if running on a Red Hat RHDP lab environment. From here you can just run `oc` without login.
62+
63+
TODO: Change yaml applies to direct git download
64+
3665
## Install and Prepare Gitea
3766

3867
We'll need Git repository services to keep our app and infrastructure source code, so let's just install trusted `Gitea` using an operator:

content/20-appendix/_index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@ title = "Appendix"
33
weight = 45
44
+++
55

6+
## Create ACS init bundle in ACS Portal
7+
8+
Creating the init bundle using the **ACS Portal**:
9+
10+
- Navigate to **Platform Configuration → Integrations**.
11+
- Under the **Authentication Tokens** section, click on **Cluster Init Bundle**.
12+
- Click **Generate bundle**
13+
- Enter a name for the cluster init bundle and click **Generate**.
14+
- Click **Download Kubernetes Secret File** to download the generated bundle.
15+
16+
{{% notice warning %}}
17+
If you are running `oc` on your laptop, you are set. If you are SSH-ing to another host (like the bastion host) to run `oc`, you have to scp the init bundle file over there. If you are using the **OpenShift Web Terminal** you have to use the API method.
18+
{{% /notice %}}
19+
620
## Create a serviceaccount to scan the internal OpenShift registry
721

822
The integrations to the internal registry were created automatically. But to enable scanning of images in the internal registry, you'll have to configure valid credentials, so this is what you'll do:

static/images/web-terminal.png

112 KB
Loading

0 commit comments

Comments
 (0)