Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I poc #12

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
87a5a0f
Adding I-PoC example to veraqcruz-examples (squashed)
alexandref75 Nov 1, 2021
53d7ab3
Add headers and License information to source code files
alexandref75 Nov 1, 2021
785c2ba
Spell check on README, adding Python Docs for functions.
alexandref75 Nov 1, 2021
54e66df
Add support for instance_id and instance_hash to VaaS
alexandref75 Nov 2, 2021
11c520b
Change docker repository to veracruz
alexandref75 Nov 2, 2021
3fb8d4f
Fix stray code block
alexandref75 Nov 3, 2021
2a9adc3
Add better error handling and recovery
alexandref75 Nov 3, 2021
4dedfab
Fix erroneous code block
alexandref75 Nov 3, 2021
3e54b1f
Document Iotex-S3-app
alexandref75 Nov 3, 2021
5828dda
Add script to start iotex-user-app.sh with correct parameters
alexandref75 Nov 3, 2021
f9733ea
Fix support for single identity per certificate
alexandref75 Nov 5, 2021
89f8a29
Fix figure
alexandref75 Nov 5, 2021
c38a9e8
Add warning about multiple identities with same certificate
alexandref75 Nov 6, 2021
69c0d12
Add support for changing Veracruz Nitro size (hugepages size)
alexandref75 Nov 8, 2021
5d1341b
Add support for changing Veracruz pod memori size and CPU size
alexandref75 Nov 8, 2021
7205870
Add troubleshooting for S3 errors
alexandref75 Nov 8, 2021
54f92be
Add entry to future support of remote repositories
alexandref75 Nov 9, 2021
14d46d0
Fix make images before veracruz-client
alexandref75 Jan 4, 2022
f37861d
Fixes for running i-PoC on 22.04
Apr 8, 2022
59cdecc
First entry just show what are the veracruz instances running
Apr 8, 2022
bda0a1f
Fixes for veracruz runtime (nitro) WIP
alexandref75 Aug 1, 2022
9abcdb9
Add support for Veracruz runtime with mbed-TLS
alexandref75 Aug 12, 2022
70916cd
Dupplicated entry on vaas-server.py
alexandref75 Aug 12, 2022
554c2b4
Update CCFaaS to new policy format
gbryant-arm Aug 18, 2022
ebcb848
Adjust to new policy format
gbryant-arm Aug 23, 2022
b893a64
Update YAML deployment script
gbryant-arm Aug 23, 2022
43bdc9b
FIx CCFaaS for using v1.1.1 nitro image
alexandref75 Aug 25, 2022
bbfae2b
Add debugging messages
gbryant-arm Sep 9, 2022
4a9d619
Update image versions
gbryant-arm Sep 23, 2022
dfafac0
Fix config var
gbryant-arm Sep 23, 2022
08306e2
Don't restart veracruz-server pod after it dies
gbryant-arm Sep 23, 2022
0958e36
Demo updates and fixes
alexandref75 Oct 10, 2022
620961a
Fix ececution. explict compution step was added
alexandref75 Oct 10, 2022
580e13f
Small fixes on README
alexandref75 Oct 11, 2022
36afc68
Changes to user portion of the demo (adding crypto)
alexandref75 Oct 12, 2022
d1c3c28
Add function name to user app's arguments
gbryant-arm Oct 13, 2022
221a678
Documentation update
alexandref75 Oct 13, 2022
0431873
Fix command line of iotex-user-app
alexandref75 Oct 13, 2022
d6f5d78
Add cert.conf
gbryant-arm Oct 14, 2022
38fadeb
Add function registration scripts and partial policies
gbryant-arm Oct 14, 2022
f6e792f
Add hugepages reference
alexandref75 Oct 17, 2022
fb6bce9
Add reference to a tag on veracruz
alexandref75 Oct 20, 2022
b3c2991
small text corrections
alexandref75 Oct 20, 2022
63e83c2
Add reference to VoD on README
alexandref75 Oct 24, 2022
9ff8b86
Fixes fro veracruz-nitro (1.3.3) and miscelaneous changes
alexandref75 Jan 24, 2023
f4b7a43
Missing file.
alexandref75 Jan 24, 2023
751aafd
Updates for VOD tar and README fixes
alexandref75 Jan 25, 2023
02ad951
Add info about S3
alexandref75 Jan 25, 2023
7763e27
Fix info about S3
alexandref75 Jan 25, 2023
2920248
Fix tar incorrect file and register do not need veracruz-client
alexandref75 Jan 25, 2023
ef38efe
Spell check of README.md
alexandref75 Jan 25, 2023
88f2401
Fixes in markdown for README.md
alexandref75 Jan 25, 2023
d5e223a
Updated to VOD 1.3.3 and fixes on README
alexandref75 Jan 26, 2023
feb9d0b
Update outputs for the example run
alexandref75 Jan 26, 2023
6b47896
Fixes on README, presentation mostly.
alexandref75 Jan 27, 2023
179260c
Updated to veracruz/veracruz-example main
alexandref75 Jan 27, 2023
7aba0ef
Updated to veracruz/veracruz-examples main
alexandref75 Jan 27, 2023
a4ba2f7
Merge branch 'veracruz-main' into i-poc
alexandref75 Jan 27, 2023
f1827d8
Merge branch 'i-poc'
alexandref75 Jan 27, 2023
031c757
Polishing README
alexandref75 Jan 27, 2023
176faa2
Fix error Max instead of Min.
alexandref75 Jan 30, 2023
5e7b115
Revert commit that removed decryption key on execute_program
alexandref75 Feb 14, 2023
059f032
Revert "Updated to veracruz/veracruz-examples main"
alexandref75 Feb 14, 2023
379a8ce
Adding checks for decrytion key files
alexandref75 Feb 14, 2023
a2d3eb6
Some language changes on README
alexandref75 Feb 16, 2023
f5198b5
Describe options to install veracruz
alexandref75 Feb 23, 2023
9791b37
Clarify installing K3s on EC2
alexandref75 Feb 23, 2023
9e35597
Fix README for reference to main-k3s directory
alexandref75 Feb 28, 2023
4b365f5
Add documentation about variables in config.vars.template
alexandref75 Mar 6, 2023
8604de0
Add requirement of 2GB for YOLOv3 model
alexandref75 Mar 7, 2023
43255ca
Fix for newer versions of docker (require --output)
alexandref75 Mar 13, 2023
763e297
Change order on README for the example (Running)
alexandref75 Mar 27, 2023
b340242
Add some documentation on how to run the model
alexandref75 Mar 27, 2023
96128c7
Change configuration of README
alexandref75 Apr 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 28 additions & 34 deletions i-poc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ The tag iotex-demo-v1.3.0 from [veracruz repository](https://github.com/veracruz

### Hugepages on nitro nodes

* Nitro nodes require higepages enabled in the kernel.
* Nitro nodes require hugepages enabled in the kernel.
* Create a file /etc/sysctl.d/99-hugepages.conf with the contents below. The example uses up to 2.2GB (2@MB pages * 1100 pages)
```
vm.nr_hugepages=1100
Expand Down Expand Up @@ -925,38 +925,44 @@ The tag iotex-demo-v1.3.0 from [veracruz repository](https://github.com/veracruz

### Installing Veracruz services on k8s/k3s

1. Clone the repository https://gitlab.com/arm-research/security/i-poc.git
1. Clone the repository https://github.com/veracruz-project/veracruz-examples.git
1. Move to directory i-poc

```bash
cd i-poc
```

1. Copy file i-poc/main-k3s/config.vars.template to i-poc/i-poc/main-k3s/config.vars and update the values according to your installation
1. If desired to create the container images locally, execute
1. Copy file main-k3s/config.vars.template to main-k3s/config.vars and update the values according to your installation and run make

```bash
make images
make
```

1. The following step create all the keys, certificates and update all the YAML files from the templates and loads them into k8s/k3s

```bash
make k8s-all
```
1. Some optional steps:

1. If more control is desired change to directory i-poc/main-k3s
1. If desired to create the container images locally, execute (this step is optional since the images are available on the ghcr.io

```bash
make k8s-smarter-device-manager
make k8s-attestation-service
make k8s-vaas
make k8s-ccfaas
make k8s-iotex-s3-app
```

there is also <entry>-check to verify if the services are running correctly

```bash
make images
```

1. The following step create all the keys, certificates and update all the YAML files from the templates and loads them into k8s/k3s

```bash
make k8s-all
```

1. If more control is desired change to directory i-poc/main-k3s

```bash
make k8s-smarter-device-manager
make k8s-attestation-service
make k8s-vaas
make k8s-ccfaas
make k8s-iotex-s3-app
```

there is also <entry>-check to verify if the services are running correctly

#### Smarter-device-manager

Expand Down Expand Up @@ -1148,7 +1154,7 @@ Even at EKS a new updated configuration of smarter-device-manager need to be be
replicaset.apps/ccfaas-server-app-XXXXXXXXXX 1 1 1 XX
```

## Running applications on Veracruz
## Running VOD (i-PoC wasm video decoder) on Veracruz

The iotex-user-app directory on the repository will execute the I-PoC example end-to-end according the timeline described above

Expand All @@ -1168,18 +1174,6 @@ The iotex-user-app directory on the repository will execute the I-PoC example en
* decryption IV path: path of where to put the decryption key on the enclave
* S3 authentication>: set of "key=value" that contains the authentication to access the video in S3

1. Edit the file iotex-user-app.sh to set the correct information of the S3 file and S3 authentication to use:

```bash
export AWS_ACCESS_KEY_ID="<REPLACE WITH AWS_ACCESS_KEY_ID>"
export AWS_SECRET_ACCESS_KEY="<REPLACE WITH AWS_SECRET_ACCESS_KEY>"

S3_REGION="<REPLACE WITH S3 REGION>"
S3_BUCKET="<REPLACE WITH S3 BUCKET"
S3_FILE="<REPLACE WITH S3 FILE?"
```
The script assumes that the file requires authentication to be accessed. All the AWS credentials and S3_REGION are optional and can be removed from the script including the entry on ./iotex-user-app.py line

1. Registering the function in CCFaaS

Two examples are available on [VOD](https://github.com/veracruz-project/video-object-detection.git). The difference between big and small is the size of the model, small being in 30MBs and big being around 300MBs.
Expand Down
1 change: 1 addition & 0 deletions i-poc/ccfaas-app/ccfaas-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#
# See the `LICENSE_MIT.markdown` file in the Veracruz I-PoC
# example repository root directory for copyright and licensing information.
#!/bin/bash

export PROGRAM_LOAD_CERTIFICATE="$(cat $1)"
export PROGRAM_LOAD_CERTIFICATE_FILE=$1
Expand Down
18 changes: 5 additions & 13 deletions i-poc/ccfaas-app/load_program.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#
# See the `LICENSE_MIT.markdown` file in the Veracruz I-PoC
# example repository root directory for copyright and licensing information.
#!/bin/bash

VERACRUZ_CLIENT=$(pwd)/veracruz-client

Expand Down Expand Up @@ -51,24 +52,15 @@ then
exit 1
fi

# Check server availability
alexandref75 marked this conversation as resolved.
Show resolved Hide resolved
echo "Waiting for server..."
VERACRUZ_SERVER_URL=$(cat ${POLICY} | grep veracruz_server_url | sed -e 's/^.*": //' -e 's/:/ /' -e 's/"//g')
for i in $(seq 1 30); do
echo "\n" | nc $(echo "${VERACRUZ_SERVER_URL}" | cut -d " " -f 1) $(echo "${VERACRUZ_SERVER_URL}" | cut -d " " -f 2) -w 1 | grep "Bad Request" &>/dev/null && break
sleep 1
done
echo "Server is available"

while [ $# -gt 0 ]
do
PROGRAM_FILE_BASE64=$1
PROGRAM_FILE=$1

pushd ${PROGRAM_DIR} > /dev/null
# echo "Executing: ${VERACRUZ_CLIENT} ${POLICY} -p ${PROGRAM_FILE} --identity ${CERTIFICATE} --key ${KEY}" >> /tmp/log.txt

PROGRAM_FILE=$(echo -n "${PROGRAM_FILE_BASE64}" | base64 -d)
OUTPUT=$(${VERACRUZ_CLIENT} ${POLICY} --program "${PROGRAM_FILE}=${PROGRAM_DIR}/${PROGRAM_FILE_BASE64}" --identity "${CERTIFICATE}" --key "${KEY}" 2>&1)
OUTPUT=$(${VERACRUZ_CLIENT} ${POLICY} -p "${PROGRAM_FILE}" --identity "${CERTIFICATE}" --key "${KEY}" 2>&1)
RESULT_CODE=$?
popd > /dev/null
echo "${OUTPUT}"

NOK=$(echo "${OUTPUT}" | grep "Error")
Expand Down
1 change: 1 addition & 0 deletions i-poc/iotex-s3-app/iotex-s3-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#
# See the `LICENSE_MIT.markdown` file in the Veracruz I-PoC
# example repository root directory for copyright and licensing information.
#!/bin/bash

export FLASK_APP=iotex-s3-app
flask run --host=0.0.0.0
25 changes: 7 additions & 18 deletions i-poc/iotex-user-app/execute_program.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#
# See the `LICENSE_MIT.markdown` file in the Veracruz I-PoC
# example repository root directory for copyright and licensing information.
#!/bin/bash

# echo "$0 $*" > /tmp/log.txt

Expand All @@ -24,9 +25,9 @@ function check_if_file_exists() {

VERACRUZ_CLIENT=$(pwd)/veracruz-client

if [ $# -lt 6 ]
if [ $# -lt 5 ]
then
echo "$0: <policy> <certificate file out> <key file out> <output file veracruz> <output file name> <program> <decryption key path> <decryption IV path>"
alexandref75 marked this conversation as resolved.
Show resolved Hide resolved
echo "$0: <policy> <certificate file out> <key file out> <output file veracruz> <output file name>"
exit 1
fi

Expand All @@ -35,14 +36,13 @@ CERTIFICATE_OUT=$2
KEY_OUT=$3
OUTPUT_VERACRUZ=$4
OUTPUT_FILE_NAME=$5
PROGRAM=$6
DECRYPTION_KEY_PATH=$7
DECRYPTION_IV_PATH=$8

check_if_file_exists "${POLICY}" "Policy"
check_if_file_exists "${CERTIFICATE_OUT}" "Certificate_out"
check_if_file_exists "${KEY_OUT}" "Key_out"

openssl rsa -in "${KEY_OUT}" -out "${KEY_OUT}.RSA.pem"

VERACRUZ_URL=$(grep veracruz_server_url "${POLICY}" | sed -e 's/^[^:]*: *\"//' -e 's/".*//')
VERACRUZ_HOST=$(echo "${VERACRUZ_URL}" | cut -d ":" -f 1)
VERACRUZ_PORT=$(echo "${VERACRUZ_URL}" | cut -d ":" -f 2)
Expand Down Expand Up @@ -70,20 +70,9 @@ then
exit 1
fi

# Provision decryption keying material
echo ${VERACRUZ_CLIENT} ${POLICY} --data /user_input/key=${DECRYPTION_KEY_PATH} --data /user_input/iv=${DECRYPTION_IV_PATH} --identity ${CERTIFICATE_OUT} --key ${KEY_OUT}
OUTPUT=$(${VERACRUZ_CLIENT} "${POLICY}" --data /user_input/key=${DECRYPTION_KEY_PATH} --data /user_input/iv=${DECRYPTION_IV_PATH} --identity "${CERTIFICATE_OUT}" --key "${KEY_OUT}" 2>&1)

# Request computation
echo ${VERACRUZ_CLIENT} ${POLICY} --compute ${PROGRAM} --identity ${CERTIFICATE_OUT} --key ${KEY_OUT}
OUTPUT=$(${VERACRUZ_CLIENT} "${POLICY}" --compute ${PROGRAM} --identity "${CERTIFICATE_OUT}" --key "${KEY_OUT}" 2>&1)

# Request results
echo ${VERACRUZ_CLIENT} ${POLICY} --result stdout=- --result stderr=- --result "${OUTPUT_VERACRUZ}=${OUTPUT_FILE_NAME}" --identity ${CERTIFICATE_OUT} --key ${KEY_OUT}
OUTPUT=$(${VERACRUZ_CLIENT} "${POLICY}" --result stdout=- --result stderr=- --result "${OUTPUT_VERACRUZ}=${OUTPUT_FILE_NAME}" --identity "${CERTIFICATE_OUT}" --key "${KEY_OUT}" 2>&1)

echo ${VERACRUZ_CLIENT} ${POLICY} --results "${OUTPUT_VERACRUZ}=${OUTPUT_FILE_NAME}" --identity ${CERTIFICATE_OUT} --key ${KEY_OUT}
OUTPUT=$(${VERACRUZ_CLIENT} "${POLICY}" --results "${OUTPUT_VERACRUZ}=${OUTPUT_FILE_NAME}" --identity "${CERTIFICATE_OUT}" --key "${KEY_OUT}.RSA.pem" 2>&1)
echo "${OUTPUT}"

NOK=$(echo "${OUTPUT}" | grep "Error")
if [ ! -z "${NOK}" ]
then
Expand Down
Loading