Skip to content

Commit 2bb80e7

Browse files
Merge pull request #32 from ibm-hyper-protect/priyanayar-patch-1
Update README.md
2 parents d7b96e0 + a32426e commit 2bb80e7

File tree

1 file changed

+60
-25
lines changed

1 file changed

+60
-25
lines changed

README.md

Lines changed: 60 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,16 @@ Create the `sbs-config.json` file in any location you choose on your local machi
6464
"DOCKER_RO_PASSWORD": "<docker_password>",
6565
"DOCKER_BASE_USER": "",
6666
"DOCKER_BASE_PASSWORD": "",
67+
"ICR_BASE_REPO": "",
68+
"ICR_BASE_REPO_PUBLIC_KEY": "",
6769
"ENV_WHITELIST": ["<KEY1>", "<KEY2>"],
6870
"ARG": {
6971
"<BUILD_ARG1>": "<VALUE1>",
7072
"<BUILD_ARG2>": "<VALUE2>"
73+
},
74+
"ISV_SECRET": {
75+
"k1": "secret1",
76+
"k2": "secret2"
7177
}
7278
}
7379
```
@@ -76,7 +82,7 @@ Where
7682
```
7783
HOSTNAME - Hostname of the SBS server which will be used while generating certificates and communicating with the secure build server.
7884
CICD_PORT - port on which a build service is running (default: 443).
79-
IMAGE_TAG - image tag of the container image to be deployed as SBS server. Use "1.3.0.7" unless otherwise noted.
85+
IMAGE_TAG - image tag of the container image to be deployed as SBS server. Use "1.3.0.8" unless otherwise noted.
8086
GITHUB_KEY_FILE - Private key path to access your GitHub repo.
8187
GITHUB_URL - GitHub URL.
8288
GITHUB_BRANCH - GitHub branch name.
@@ -94,9 +100,15 @@ DOCKER_RO_USER - you can use the same as DOCKER_USER. It is recommended that you
94100
DOCKER_RO_PASSWORD - you can use same as DOCKER_PASSWORD. It is recommended that you specify a user who has read access only to your Docker repository.
95101
ENV_WHITELIST - All environment variable names need to be listed. The Hyper Protect Virtual Servers don't allow any environment variable unless it is in this list because of a security reason.
96102
ARG - You have to pass all build argument parameters as you pass during Docker build.
103+
ICR_BASE_REPO - Base Image used in dockerfile if it is present in ICR
104+
ICR_BASE_REPO_PUBLIC_KEY - public key with which the base image used in docker file (ICR_BASE_REPO) is signed
105+
ISV_SECRET - Use to provide the ISV secrets as a key and value pair. The secrets are added in the ``/isv_secrets/secrets.json` file within the IBM Hyper Protect Virtual server.
97106
```
107+
Note:
108+
- If the base image used in Docker file is Red Hat signed on IBM Cloud Container Registry, you must provide the 'ICR_BASE_REPO', and 'ICR_BASE_REPO_PUBLIC_KEY' parameters. The following is an example for these two values:
109+
- "ICR_BASE_REPO": `"<region>.icr.io/<repo name>/<image name>:<tag>"`
110+
- "ICR_BASE_REPO_PUBLIC_KEY" : `"<path to the public key>"`
98111

99-
Note:
100112
- If you use IBM Cloud Registry instead of DockerHub registry, then you must use the following parameters:
101113

102114
```buildoutcfg
@@ -111,9 +123,13 @@ Note:
111123

112124
- The `<domain_name>` specifies the location of IBM Cloud Container Registry (e.g. `us.icr.io`). Select the domain name for one of [avilable regions](https://cloud.ibm.com/docs/Registry?topic=Registry-registry_overview#registry_regions).
113125
If you are using the IBM Cloud Registry notary server, and you specified the `<domain_name>` as `us.icr.io`, then specify `https://notary.us.icr.io` as the value for `DOCKER_CONTENT_TRUST_PUSH_SERVER`.
114-
As another example, if value of `DOCKER_REPO=de.icr.io`, then the value of `DOCKER_CONTENT_TRUST_PUSH_SERVER` would be `https://notary.de.icr.io`. To know more about IBM Cloud registry, see [Getting started with IBM Cloud Container Registry](https://cloud.ibm.com/docs/Registry?topic=Registry-getting-started).
126+
As another example, if value of `DOCKER_REPO=de.icr.io`, then the value of `DOCKER_CONTENT_TRUST_PUSH_SERVER` should be `https://notary.de.icr.io`. To know more about IBM Cloud registry, see [Getting started with IBM Cloud Container Registry](https://cloud.ibm.com/docs/Registry?topic=Registry-getting-started).
127+
128+
- If the base image is in Docker Hub, then you must configure "DOCKER_CONTENT_TRUST_BASE" with a value "True", "DOCKER_CONTENT_TRUST_BASE_SERVER" is set with the notary server URL, and configure "DOCKER_BASE_USER" and "DOCKER_BASE_PASSWORD" with the credentials."
115129

116-
- If the base image is in a private repository, then you must configure "DOCKER_CONTENT_TRUST_BASE" with a value "True", "DOCKER_CONTENT_TRUST_BASE_SERVER" is set with the notary server URL, and configure "DOCKER_BASE_USER" and "DOCKER_BASE_PASSWORD" with the credentials."
130+
- If the base image used in Docker file is Red Hat signed on IBM Cloud Container Registry, provide the path to the public key with which it is signed in the 'ICR_BASE_REPO_PUBLIC_KEY' parameter, and the base image used in the 'ICR_BASE_REPO' parameter. The following two parameters should also be set with the values as shown:
131+
- "DOCKER_CONTENT_TRUST_BASE": "True"
132+
- "DOCKER_CONTENT_TRUST_BASE_SERVER": `"<region>.icr.io"`
117133

118134
- To update the hostname, or to update the instance with a new certificate when the old certificate expires, complete the following steps:
119135
1. Backup the `sbs-config.json` file, and edit the file to remove the "UUID" parameter.
@@ -133,14 +149,20 @@ As another example, if value of `DOCKER_REPO=de.icr.io`, then the value of `DOCK
133149
```
134150
6. Run the following command to update the SBS instance (in the case of certificate expiration, you need not update the hostname):
135151
```buildoutcfg
136-
ibmcloud hpvs instance-update SBContainer --rd-path secure_build.asc -i 1.3.0.7 --hostname sbs.example.com -e CLIENT_CRT=... -e CLIENT_CA=... -e SERVER_CRT=... -e SERVER_KEY=...
137-
```
152+
ibmcloud hpvs instance-update SBContainer --rd-path secure_build.asc -i 1.3.0.8 --hostname sbs.example.com -e CLIENT_CRT=... -e CLIENT_CA=... -e SERVER_CRT=... -e SERVER_KEY=...
153+
```
154+
155+
- When the base image is unsigned, set "DOCKER_CONTENT_TRUST_BASE" to "false". Also, you don't have to set the following parameters:
156+
- "DOCKER_CONTENT_TRUST_BASE_SERVER": "",
157+
- "DOCKER_BASE_USER": "",
158+
- "DOCKER_BASE_PASSWORD": "",
159+
138160

139161
Also see [Additional Build Parameters](additional-build-parameters.md).
140162

141163
## Deploying the Secure Build Server
142164

143-
Complete the following steps:
165+
Complete the following steps:
144166

145167
1. Install the IBM Cloud CLI, and the HPVS plugin.
146168
```buildoutcfg
@@ -182,9 +204,9 @@ Note: Update the IBM Cloud CLI if it is installed already.
182204
"CERTPATH": "./sbs-keys/server-cert.pem",
183205
```
184206
Note:-
185-
- Follow the best practices of certificate management.
186-
- The CA certificate should not be compromised or revoked.
187-
- Third-party certificates are not supported.
207+
- Follow the best practices of certificate management.
208+
- The CA certificate should not be compromised or revoked.
209+
- Third-party certificates are not supported.
188210
189211
4. Use build.py to create the server certificate signed by the CA certificate generated that was generated in the previous step. It will be setup on the server for secure communication.
190212
```buildoutcfg
@@ -198,13 +220,13 @@ Note: Update the IBM Cloud CLI if it is installed already.
198220

199221
6. Create the SBS instance on cloud. You can copy and paste the output from `instance-env` command as command-line parameters for the `instance-create` command.
200222
```buildoutcfg
201-
ibmcloud hpvs instance-create SBContainer lite-s dal13 --rd-path secure_build.asc -i 1.3.0.7 --hostname sbs.example.com -e CLIENT_CRT=... -e CLIENT_CA=... -e SERVER_CRT=... -e SERVER_KEY=...
223+
ibmcloud hpvs instance-create SBContainer lite-s dal13 --rd-path secure_build.asc -i 1.3.0.8 --hostname sbs.example.com -e CLIENT_CRT=... -e CLIENT_CA=... -e SERVER_CRT=... -e SERVER_KEY=...
202224
```
203-
Where:
204-
- SBContainer is the name of the SBS instance to be created.
205-
- lite-s is the plan name.
206-
- dal13 is the region name.
207-
- 1.3.0.7 is the image tag of Secure Docker Build docker image.
225+
Where:
226+
- SBContainer is the name of the SBS instance to be created.
227+
- lite-s is the plan name.
228+
- dal13 is the region name.
229+
- 1.3.0.8 is the image tag of Secure Docker Build docker image.
208230
- hostname is the server hostname that was given in sbs-config.json.
209231

210232
To know more details about which plan to use and which region to use, see [hpvs instance-create](https://cloud.ibm.com/docs/hpvs-cli-plugin?topic=hpvs-cli-plugin-hpvs_cli_plugin#create_instance).
@@ -280,16 +302,20 @@ When an error occurs, the `status` response shows the command that caused the er
280302
To stop a long-running build process, refer to [How to stop and clean up a build process](README.md#how-to-stop-and-clean-up-a-build-process).
281303

282304
## How to deploy the image that is built by using SBS
283-
Complete the following steps:
305+
Complete the following steps:
284306

285307
1. Get an encrypted registration definition file.
286308
```buildoutcfg
287309
./build.py get-config-json --env <path>/sbs-config.json --key-id <key_id> --email <your_email_as_id>
288310
```
289311
e.g. `--key-id isv_user --email isv@example.com`
290312

291-
The `<key_id>` is for a GPG key to sign the file. If omitted, the default id is `secure-build`. The email address
292-
is used to identify the key. If omitted, the GPG library will pick up a default one, typically `<your_login_id>@<domain_name_of_client>`.
313+
If you want to pass ISV SECRETS to the container, then pass the `--isv-secrets` flag and add the `ISV_SECRET` section in the `sbs-config.json` configuration file. The following is an example:
314+
```buildoutcfg
315+
./build.py get-config-json --env sbs-config.json --key-id secure-build-ad52e76-1 --isv-secrets
316+
```
317+
318+
The `<key_id>` is for a GPG key to sign the file. If omitted, the default id is `secure-build`. The email address is used to identify the key. If omitted, the GPG library will pick up a default one, typically `<your_login_id>@<domain_name_of_client>`.
293319

294320
During the above command you will be asked to create a passphrase. Enter the passphrase twice (the second time is for confirmation). Then again passphrase will be asked to sign the file.
295321

@@ -379,9 +405,9 @@ You will see a data and git folder.
379405

380406
## How to extract Public Key Used for Signing Container Image inside SBS
381407
```buildoutcfg
382-
./build.py get-dct-publickey --env <path>/sbs-config.json
408+
./build.py get-signed-image-publickey --env <path>/sbs-config.json
383409
```
384-
After you run this command, the <repo_name>'dct-public.key' template file is created, which contains the public key that is used to sign the container image.
410+
After you run this command, the <repo_name>'public.key' template file is created, which contains the public key that is used to sign the container image.
385411

386412
## State image
387413
The state image contains the private signing key, which is generated when a built image is pushed to a container registry for the first time. It is encrypted by using two SECRETS. One is generated by `build.py` and stored in your `sbs-config.json`. The other one is included in the SBS image.
@@ -432,7 +458,7 @@ docker.io.<user_name>.sbs22.s390x-v0.1-60fd72e.2020-10-21_07-20-08.516797
432458
When you save the state image to COS, you still get meta data of the state image in a local file of the same name as the state image file.
433459
434460
## How to recover the state image
435-
Complete the following steps:
461+
Complete the following steps:
436462
437463
1. Create a new SBS instance as mentioned in the section [Deploying the Secure Build Server](README.md#deploying-the-secure-build-server), with the same secret that was used to get the state image, otherwise the post state image operation fails.
438464
@@ -565,7 +591,7 @@ Note: After the secret is updated, you cannot use a state image obtained using t
565591

566592
## Updating the Secure Build Server instance to the latest image
567593

568-
You can skip steps 1 to 4, when updating from SBS version 1.3.0.6 to 1.3.0.7.
594+
You can skip steps 1 to 4, when updating from SBS version 1.3.0.7 to 1.3.0.8.
569595

570596
1. Export the state image as mentioned in the section [How to get the state image](README.md#how-to-get-the-state-image). This is to ensure that you have a backup.
571597

@@ -592,7 +618,7 @@ You can skip steps 1 to 4, when updating from SBS version 1.3.0.6 to 1.3.0.7.
592618

593619
6. Update the instance
594620
```buildoutcfg
595-
ibmcloud hpvs instance-update SBContainer -i 1.3.0.7 --rd-path "secure_build.asc" --hostname="sbs.example.com" -e CLIENT_CRT=... -e CLIENT_CA=... -e SERVER_CRT=... -e SERVER_KEY=...
621+
ibmcloud hpvs instance-update SBContainer -i 1.3.0.8 --rd-path "secure_build.asc" --hostname="sbs.example.com" -e CLIENT_CRT=... -e CLIENT_CA=... -e SERVER_CRT=... -e SERVER_KEY=...
596622
```
597623

598624
Note:
@@ -620,7 +646,7 @@ Memory 2048 MiB
620646
Processors 1 vCPUs
621647
Image type self-provided
622648
Image OS self-defined
623-
Image name de.icr.io/zaas-hpvsop-prod/secure-docker-build:1.3.0.7
649+
Image name de.icr.io/zaas-hpvsop-prod/secure-docker-build:1.3.0.8
624650
Environment CLIENT_CA=...
625651
CLIENT_CRT=...
626652
SERVER_CRT=...
@@ -630,7 +656,16 @@ Last image update 2021-12-06 05:13
630656
Created 2021-12-06
631657
```
632658

659+
8. Update the following parameters of the `sbs-config.json` configuration file:
660+
- "build_image_tag": "1.3.0.8"
661+
- If the base image used in Docker file is Red Hat signed on IBM Cloud Container Registry, you must provide the 'ICR_BASE_REPO', and 'ICR_BASE_REPO_PUBLIC_KEY' parameters.
662+
- If the built image is pushed to IBM Cloud Container Registry, set "DOCKER_CONTENT_TRUST_PUSH_SERVER": "https://<domain_name>".
633663

664+
9. Update the SBS instance by running the following command:
665+
```buildoutcfg
666+
./build.py update --env <path>/sbs-config.json
667+
```
668+
634669
## License
635670

636671
[Apache 2.0](https://github.com/ibm-hyper-protect/secure-build-cli/blob/main/LICENSE)

0 commit comments

Comments
 (0)