Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Commit c6c9354

Browse files
authored
Merge pull request #166 from IBM/hpvs_getting_started_update
Pulled in additions from lab guide
2 parents 86a5ee2 + e7ce79d commit c6c9354

File tree

1 file changed

+93
-19
lines changed

1 file changed

+93
-19
lines changed

automation/Getting_Started.md

Lines changed: 93 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,29 @@
22

33
The following steps walk you through how to get a pre-built fhe-toolkit docker image into a Hyper Protect Server container.
44

5-
### Preparing my system to handle a HPVS connection
5+
### Prerequisites
66

77
* You can use any Linux or Unix based (Mac will work) computer that the ibm cloud supports
88

9+
* If the deploy script will be run on MacOS:
10+
* Requires a `python` installation, python 3.6+
11+
* Install `gpg`
12+
* MacOS with homebrew: `brew install gpg`
13+
* To install homebrew: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
14+
* MasOS without homebrew: download from https://gpgtools.org/
15+
16+
* Install `pyenv`
17+
* MacOS with homebrew: `brew install pyenv`
18+
* MacOS without homebrew: `curl https://pyenv.run | bash`
19+
20+
* Otherwise, install these dependencies with your Linux distro's package manager
21+
22+
### Creating an IBM Cloud account
923
* Create an IBM Cloud account if you have never done so. To do this, go to [https://cloud.ibm.com/login](https://cloud.ibm.com/login) in your web browser.
1024

1125
If you don't have an account, select the "Create an account" link. [https://cloud.ibm.com/registration](https://cloud.ibm.com/registration)
1226

13-
* Once you have made an account or logged into your existing account, you must then make an API Key in your ibm cloud account
27+
* Once you have made an account or logged into your existing account, you must then make an API Key in your IBM Cloud account
1428

1529
* At the top of the screen navigate the menus from Manage > Access (IAM). From the screen shown select the *My IBM Cloud API keys* tile. .
1630

@@ -22,7 +36,12 @@ The following steps walk you through how to get a pre-built fhe-toolkit docker i
2236
2337
* Click Show. Once you have that key, copy and save it somewhere that you won't forget or delete it. Alternatively you can download it as a JSON file from the prompt on screen.
2438

25-
* Update or install `ibmcloud` CLI on local machine & on the S390 machine you will be using. Its good to have it working on another non-S390x machine because there are some things that you can't do
39+
* An example API key looks like this `k-y2lsNxfeKbaidcCG6kQVypLDR_WjmDPe-2Uuq_PTYx`
40+
41+
42+
43+
* Update or install `ibmcloud` CLI on the machine you will be using.
44+
2645
[https://cloud.ibm.com/docs/cli?topic=cli-getting-started](https://cloud.ibm.com/docs/cli?topic=cli-getting-started)
2746

2847
NOTE: If you have a mac, you can just open a terminal and issue the following command:
@@ -86,36 +105,71 @@ Space:
86105
```
87106

88107

89-
* Update to the latest container plugin (not sure this is available on S390)
108+
* Update to the latest container plugin
90109

91110
`ibmcloud plugin update container-registry`
92111

93-
* Also install the hpvs plugin as well (this is definitely NOT on S390)
112+
* Install the hpvs plugin as well
94113

95114
`ibmcloud plugin install hpvs`
96115

97116
* Create a Resource Group in your account
98117

99-
my resource group is : `super_secret`
118+
my resource group is called : `super_secret`
100119

101120
Login to cloud.ibm.com -> `Manage -> Account -> Account Resources -> Resource Groups -> Create`
102121

103-
* If the deploy script will be run on MacOS:
104-
* Requires a `python` installation
105-
* Install `gpg`
106-
* MacOS with homebrew: `brew install gpg`
107-
* To install homebrew: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
108-
* MasOS without homebrew: download from https://gpgtools.org/
122+
#### The Keys
123+
To sign and deploy an image to HPVS, we need three to four sets of keys:
124+
1. Root key; root of content trust for an image tag
125+
2. Repository key (aka "target key"); allows you to sign image tags and manage delegations (including delegated keys or permitted delegation paths)
126+
3. Encryption key for the HPVS registration definition file
127+
4. Vendor key, required for signing the HPVS registration definition file
128+
5. Delegation key (optional); allows you to delegate signing image tags to other publishers without having to share your repository key
129+
130+
Before you can run `DeployToHPVS.sh`, you must tell it:
131+
1. The passphrase to use for the root key
132+
2. The passphrase to use for the repository key
133+
3. The name and location of the GPG vendor key (both public and private)
134+
4. The name and location of the delegation key (optional)
109135

110-
* Install `pyenv`
111-
* MacOS with homebrew: `brew install pyenv`
112-
* MacOS without homebrew: `curl https://pyenv.run | bash`
136+
##### Automatic key generation
137+
If `DeployToHPVS.sh` called with the `-c` option, the interactive wizard will walk you through the process of key generation.
113138

114-
* Login onto the S390x machine (see greg for credentials if you dont have them)
139+
The root and repository keys are generated automatically by `docker trust`, which is invoked by `DeployToHPVS.sh`. The HPVS registration encryption key is hardcoded into `DeployToHPVS.sh`. The other keys (the vendor and delegation keys) the interactive wizard will prompt if you want to generate them. If you want to do it manually, follow the next two steps. If you want the interactive wizard to do it for you, skip ahead to "Running the HPVS Deploy script" section.
115140

116-
* Clone the fhe-toolkit repo `https://github.com/IBM/fhe-toolkit-linux.git`
141+
##### Vendor key
142+
143+
To generate a vendor keypair, create a GPG batch file with the following contents:
144+
```
145+
%echo Generating registration definition key
146+
Key-Type: RSA
147+
Key-Length: 4096
148+
Subkey-Type: RSA
149+
Subkey-Length: 4096
150+
Name-Real: fhe_user
151+
Expire-Date: 0
152+
Passphrase: <passphrase>
153+
%echo done
154+
```
155+
Then run the following to generate a new keypair as the `fhe_user` identity:
156+
```
157+
gpg -a --batch --generate-key <batchfile>
158+
```
159+
160+
##### Delegation keys
161+
Delegations in Docker Content Trust (DCT) allow you to control who can and cannot sign an image tag. A delegation will have a pair of private and public delegation keys. A delegation could contain multiple pairs of keys and contributors in order to allow multiple users to be part of a delegation, and to support key rotation.
162+
163+
If `delegationkey` is `false` or commented-out in your configuration file, then the repository key will be used to sign your image. Thereafter, any changes to your image can only be made using the repository key.
164+
165+
Delegation keys can be generated using `docker trust`:
166+
```
167+
docker trust key generate <yourkeyname>
168+
```
117169

118-
* Checkout the hpvs_work_integration branch `git checkout hpvs_work_integration`
170+
171+
### Running the HPVS Deploy script
172+
* Clone the fhe-toolkit repo `https://github.com/IBM/fhe-toolkit-linux.git`
119173

120174
* cd into the main folder `cd fhe-toolkit-linux` and build a local image `./BuildDockerImage ubuntu` If you want to test with fedora change `ubuntu` to `fedora` in the command
121175

@@ -132,6 +186,26 @@ Space:
132186
133187
Everything should run from here. Please note where the script gets stuck and errors out (if it does)
134188

189+
### Accessing the toolkit
190+
When the deploy script has run successfully...
191+
192+
* Log on to the Dashboard section of https://cloud.ibm.com.
193+
194+
* Expand services in the resource list, click on the image and then click on "View Full Details" to access the public IP address, and copy it to your browser adding the port 8443. It will look like: https://xxx.xx.xx.xx:8443/
195+
196+
* Acknowledge that the server is using a self-signed certificate, accept risk and continue
197+
198+
### Running the toolkit
199+
* Once the toolkit is loaded, you should automatically be prompted to select a kit for the FHE-Workspace to use. Select one of the kits from the dropdown. Configuration of the workspace will begin which you will be able to see in the Output Window. You'll also notice the kit you selected is now shown in the CMake Tools status bar at the bottom of the window.
200+
201+
* If you are not automatically prompted to select a kit after a few seconds of loading the toolkit, try refreshing your browser. If you're still not prompted, check the CMake Tools status bar at the bottom of the window to see if a kit has already been selected. You'll need to select a kit each time you start a new instance of the Toolkit.
202+
203+
* Click “Build” in the CMake Tools status bar to build the selected target.
204+
205+
* When the build has finished, click “Launch” in CMake Tools status bar to launch the selected target in the terminal window.
206+
207+
Each demonstration application is in a self-contained directory in the examples folder in the IDE. Each demo application directory contains a README.md that explains how to run the demo and what you should expect for results. For instance, the BGV World Country Database Lookup Example Documentation contains the information to run a complete example of a privacy preserving search against an encrypted database. The database is a key value store prepopulated with the english names of countries and their capital cities from the world. Selecting the country will perform a search of the matching capital.
208+
135209

136210

137211
### Debug Mode
@@ -160,7 +234,7 @@ Find the reclamation id of the running resource and use that in the next command
160234

161235
docker image rmi -f [docker image id in this example it was 86c15e968f8b]
162236

163-
When a new image is signed there are a few keys that are created and become associated with that image. If you wish to push that image to the virtual server again, you will need those keys to sign and verify. This is the key pair in the config file called the delegation key. It is signed using a repo key that is stored in `~/.docker/trust/private`. The name of the key is a random string that is generated. You will need to hang onto this key to re-sign this image and any others associated with it. You can remove the delegation key if you no longer need it, but leave the repo key unless you are going to create a new one.
237+
When a new image is signed, there are a few keys that are created and become associated with that image. If you wish to push that image to the virtual server again, you will need those keys to sign and verify. This is the key pair in the config file called the delegation key. It is signed using a repo key that is stored in `~/.docker/trust/private`. The name of the key is a random string that is generated. You will need to hang onto this key to re-sign this image and any others associated with it. You can remove the delegation key if you no longer need it, but leave the repo key unless you are going to create a new one.
164238

165239
- delete the docker trust info
166240

0 commit comments

Comments
 (0)