You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 5, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: automation/Getting_Started.md
+93-19Lines changed: 93 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,29 @@
2
2
3
3
The following steps walk you through how to get a pre-built fhe-toolkit docker image into a Hyper Protect Server container.
4
4
5
-
### Preparing my system to handle a HPVS connection
5
+
### Prerequisites
6
6
7
7
* You can use any Linux or Unix based (Mac will work) computer that the ibm cloud supports
8
8
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
9
23
* 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.
10
24
11
25
If you don't have an account, select the "Create an account" link. [https://cloud.ibm.com/registration](https://cloud.ibm.com/registration)
12
26
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
14
28
15
29
* 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. .
16
30
@@ -22,7 +36,12 @@ The following steps walk you through how to get a pre-built fhe-toolkit docker i
22
36
23
37
* 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.
24
38
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.
NOTE: If you have a mac, you can just open a terminal and issue the following command:
@@ -86,36 +105,71 @@ Space:
86
105
```
87
106
88
107
89
-
* Update to the latest container plugin (not sure this is available on S390)
108
+
* Update to the latest container plugin
90
109
91
110
`ibmcloud plugin update container-registry`
92
111
93
-
*Also install the hpvs plugin as well (this is definitely NOT on S390)
112
+
*Install the hpvs plugin as well
94
113
95
114
`ibmcloud plugin install hpvs`
96
115
97
116
* Create a Resource Group in your account
98
117
99
-
my resource group is : `super_secret`
118
+
my resource group is called : `super_secret`
100
119
101
120
Login to cloud.ibm.com -> `Manage -> Account -> Account Resources -> Resource Groups -> Create`
102
121
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)
109
135
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.
113
138
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.
115
140
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
+
```
117
169
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`
119
173
120
174
* 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
121
175
@@ -132,6 +186,26 @@ Space:
132
186
133
187
Everything should run from here. Please note where the script gets stuck and errors out (if it does)
134
188
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
+
135
209
136
210
137
211
### Debug Mode
@@ -160,7 +234,7 @@ Find the reclamation id of the running resource and use that in the next command
160
234
161
235
docker image rmi -f [docker image id in this example it was 86c15e968f8b]
162
236
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.
0 commit comments