Skip to content

Commit

Permalink
Changes after code review
Browse files Browse the repository at this point in the history
- Removed references to private repository
- Added missing blank lines
- Replaced /opt/powHSM with /opt/powhsm
- Removed pin emoji
- Fixed typo in dist/sgx/scripts/install_service
- Message about pin restrictions is only present when options.any_pin is not set
  • Loading branch information
italo-sampaio committed Jan 24, 2025
1 parent 5fe4886 commit cc21503
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
7 changes: 4 additions & 3 deletions dist/ledger/README-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ This can be used to setup a new device as well as to upgrade a device with powHS
### Setup a new device

To setup a brand new device, first make sure the Ledger Nano S is connected to the machine via USB and in
**Recovery Mode**. More information on how to do this can be found [here](https://github.com/rootstock/powpeg-node-setup#hsm-ledger-preparation).
**Recovery Mode**. For more information on how to do this please refer to
[Ledger Nano S User Manual](https://support.ledger.com/article/360007061974-zd).

Then, to execute the setup process, within the `/path/to/dist` directory, issue:

Expand Down Expand Up @@ -231,6 +232,7 @@ Then, to execute the upgrade process, within the `/path/to/dist` directory, issu
and follow the instructions:

#### Connect the device

First connect the Ledger Nano S device to the machine via USB normally (**NOT** in Recovery Mode). Once the device is connected, press `Enter` to proceed:

```
Expand Down Expand Up @@ -279,6 +281,7 @@ Press [Enter] to continue
```

#### Gathering Attestation

After disconnecting and reconnecting the device, just press `Enter` to proceed with the attestation gathering:

```
Expand Down Expand Up @@ -358,5 +361,3 @@ This concludes the upgrade process. The device is now ready to be used with the
## What's next

Once the powHSM device is properly setup and onboarded, it is ready to be used with the powHSM middleware.
Please refer to the [powpeg-node-setup documentation](https://github.com/rootstock/powpeg-node-setup/blob/main/README.md)
for further information on how to properly run the middleware along with the other services that compose the powPeg node.
21 changes: 10 additions & 11 deletions dist/sgx/README-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ Enter the absolute path to the installation directory (empty directory name to a
Make sure to provide the absolute path to an **unexisting** directory. The script will create the specified directory
and will refuse to proceed in case it already exists.

For this example, we will use `/opt/powHSM` as the installation directory, but any valid path can be used. The script
For this example, we will use `/opt/powhsm` as the installation directory, but any valid path can be used. The script
will then require that the path to the installation directory is confirmed:
```
Welcome to the SGX powHSM Setup for RSK
Enter the absolute path to the installation directory (empty directory name to abort)
> /opt/powHSM
powHSM will be installed to /opt/powHSM
> /opt/powhsm
powHSM will be installed to /opt/powhsm
Proceed? [Y/N]
> Y
Expand Down Expand Up @@ -93,7 +93,7 @@ Onboarding done
Onboarding complete.
```

📌 Remember to keep the pin safe, as it will be required in the following steps and by design it will not be recorded at
Remember to keep the pin safe, as it will be required in the following steps and by design it will not be recorded at
any of the steps of the setup process.

### Attestation gathering
Expand Down Expand Up @@ -178,12 +178,12 @@ Timestamp: 0
Stopping the powHSM...
powHSM Setup complete. Find the installation in /opt/powHSM.
powHSM Setup complete. Find the installation in /opt/powhsm.
```

Once that step is finished, all the files required by the powHSM will be located in the installation directory:
```
/opt/powHSM/
/opt/powhsm/
├── bin
│ ├── Dockerfile
│ ├── hsmsgx
Expand All @@ -198,6 +198,7 @@ Once that step is finished, all the files required by the powHSM will be located
```

### powHSM service setup

Once installation is complete, the script will proceed with the setup of the powHSM service. The powHSM application
is installed as a `systemd` service. The last piece of information required by the script is the name of the docker
network to which the container running the powHSM will be connected. The default value `net_sgx` is suitable for most
Expand All @@ -221,7 +222,7 @@ Creating net_sgx network...
Setting permisions...
Creating service...
Enabling service...
EStarting service...
Starting service...
Service started.
To check the status of the service, run 'systemctl status hsmsgx.service'.
HSM SGX setup done.
Expand All @@ -243,8 +244,8 @@ The output should be similar to:
Tasks: 7 (limit: 9455)
Memory: 12.7M
CGroup: /system.slice/hsmsgx.service
├─2011886 /bin/bash /opt/powHSM/bin/start
└─2011983 docker run --rm --name powhsmsgx-runner --user 996:996 -v /opt/powHSM:/hsm --hostname SGX --net>
├─2011886 /bin/bash /opt/powhsm/bin/start
└─2011983 docker run --rm --name powhsmsgx-runner --user 996:996 -v /opt/powhsm:/hsm --hostname SGX --net>
Jan 22 18:58:31 sgxhsm01 start[2011983]: [Enclave] Seed loaded
Jan 22 18:58:31 sgxhsm01 start[2011983]: [Enclave] Attestation module initialized
Expand All @@ -268,5 +269,3 @@ journalctl -u hsmsgx.service
## What's next

Once the powHSM service is installed and onboarded, it is ready to be used with the powHSM middleware.
Please refer to the [powpeg-node-setup documentation](https://github.com/rootstock/powpeg-node-setup/blob/main/README.md)
for further information on how to properly run the middleware along with the other services that compose the powPeg node.
2 changes: 1 addition & 1 deletion dist/sgx/scripts/install_service
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ cp $SERVICE_UNIT /etc/systemd/system/hsmsgx.service
systemctl daemon-reload || exit $?
echo -e "\e[1;32mEnabling service...\e[0m"
systemctl enable hsmsgx.service || exit $?
echo -e "\e[1;32mEStarting service...\e[0m"
echo -e "\e[1;32mStarting service...\e[0m"
systemctl start hsmsgx.service || exit $?
echo -e "\e[1;32mService started.\e[0m"
echo -e "\e[1;32mTo check the status of the service, run 'systemctl status hsmsgx.service'.\e[0m"
Expand Down
6 changes: 4 additions & 2 deletions middleware/admin/onboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ def do_onboard(options):

# Ask the user for a pin if one not given
if pin is None:
info("Please select a pin for the device. The pin must be 8 characters long "
"and contain at least one alphabetic character.")
info("Please select a pin for the device.")
if not options.any_pin:
info("The pin must be 8 characters long and contain "
"at least one alphabetic character.")
pin = ask_for_pin(any_pin=options.any_pin)

# Generate a random seed
Expand Down

0 comments on commit cc21503

Please sign in to comment.