Introduction
In this example, we will create a simple Spring Server application that stores information in a Mysql DB using Tomcat. The MySQL DB and the Spring Server Application will be run in Nitro environments using Fortanix Confidential Computing Manager (CCM) and the Compute Node.
Spring Server Application
Authenticate to Fortanix CCM
Before you can issue any requests, you first need to authenticate to Fortanix CCM using the following commands:
Get all Accounts
After authenticating, get all the accounts present using the following command:
Select the Account
Note the account_id
of the account you want to select.
Create an Application
Create a Spring Server application using the configuration provided in the app.json
file below.
Create Application
Create App.json Config File that Contains the Application Details
Create an Image
Create an image of the application.
The build.json
is as below.
NOTE
See the Fortanix CCM Quickstart guide on how to set up registry credentials to avoid including credentials in this file.
This returns the output that shows the <task_id>
(f0d815b6-9520-4ce4-b4f4-6a82a718bb7e
in this example), among other information:
Finally, you can approve the image using it's <task_id>
and the following command:
The image is created and whitelisted.
Next, run the following command on a machine running the compute node to run the application.
Run the Application
Run the application image using the following command:
<node-agent-ip>
is the IP address of the compute node registered on Fortanix Confidential Computing Manager (CCM).9092
is the port on which Compute Node listens on.converted-image-id
is the converted app that can be found in the Images tab under Image Name column in the Images table.
NOTE
Please use your own inputs for Node IP, Port, and Converted Image in the above format. The information in the example above is just a sample.
add the following flag along with the command to get more details:
-e ENCLAVEOS_LOG_LEVEL=debug
- to get debug log
-p 7622:80 -p 8038:443
- to map the application custom port to80
or443
Spring MySQL Application
Authenticate to Fortanix CCM
Before you can issue any requests, you first need to authenticate to Fortanix CCM using the following commands:
Get all Accounts
After authenticating, get all the accounts present using the following command
Select the Account
Note the account_id
of the account you want to select.
Create an Application
Create a Spring MySQL application using the configuration provided in the app.json
file below.
Create Application
Create App.json Config File that Contains the Application Details
Create an Image
Create an image of the application.
The build.json
is as below.
NOTE
See the Fortanix CCM Quickstart guide on how to set up registry credentials to avoid including credentials in this file.
This returns the output that shows the <task_id>
(f0d815b6-9520-4ce4-b4f4-6a82a718bb7e
in this example), among other information:
Finally, you can approve the image using it's <task_id>
and the following command:
Approve the Image Whitelist Task
The image is created and whitelisted.
Next, run the following command on a machine running the compute node to run the application.
Run the Application
For the node agent attestation type DCAP/EPID, run the application image using the following command:
Where,
<URL-Of-MySQL-DB>
is the URL of the server on which the Spring MySQL converted application is running.<node-agent-ip>
is the IP address of the compute node registered on Fortanix CCM.9092
is the port on which Compute Node listens on.converted-image-id
is the converted app that can be found in the Images tab under Image Name column in the Images table.
NOTE
Please use your own inputs for Node IP, Port, and Converted Image in the above format. The information in the example above is just a sample.
add the following flag along with the command to get more details:
-e ENCLAVEOS_LOG_LEVEL=debug
- to get debug log
-p 7622:80 -p 8038:443
- to map the application custom port to80
or443
Once both the Spring Server application and Spring MySQL application are running, run the following commands to verify the functionality of TomCat.
Enter some data in DB using TomCat:
Fetch all the data entered: