Skip to content

Commit 0f5f2d3

Browse files
CASMHMS-5569: Remove private key from SLS docs (#2341)
* CASMHMS-5569: Remove private key from SLS docs The private key allows one to include the vault passwords in the SLS dump. This change simplifies the procedure to save SLS's state. The backup of the data in Vault can be left to the Vault specific backup procedures. * Apply suggestions from code review Linting Signed-off-by: Mitch Harding <[email protected]> * Update Dump_SLS_Information.md Linting Signed-off-by: Mitch Harding <[email protected]> * Update Load_SLS_Database_with_Dump_File.md Linting. Add prerequisite to match other page. Signed-off-by: Mitch Harding <[email protected]> * Switched doc to cray cli instead of curl * Fixed lint errors * Update operations/system_layout_service/Dump_SLS_Information.md Signed-off-by: Mitch Harding <[email protected]> * Apply suggestions from code review Signed-off-by: Mitch Harding <[email protected]> Signed-off-by: Mitch Harding <[email protected]> Co-authored-by: Mitch Harding <[email protected]>
1 parent 5e439b8 commit 0f5f2d3

File tree

2 files changed

+22
-67
lines changed

2 files changed

+22
-67
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,21 @@
11
# Dump SLS Information
22

3-
Perform a dump of the System Layout Service \(SLS\) database and an encrypted dump of the credentials stored in Vault.
3+
Perform a dump of the System Layout Service \(SLS\) database.
44

5-
This procedure will create three files in the current directory \(private\_key.pem, public\_key.pem, sls\_dump.json\). These files should be kept in a safe and secure place as the private key can decrypt the encrypted passwords stored in the SLS dump file.
5+
This procedure will create the file `sls_dump.json` in the current directory.
66

77
This procedure preserves the information stored in SLS when backing up or reinstalling the system.
88

9-
### Prerequisites
9+
## Prerequisites
1010

11-
This procedure requires administrative privileges.
11+
- The Cray Command Line Interface is configured. See [Configure the Cray CLI](../configure_cray_cli.md).
12+
- This procedure requires administrative privileges.
1213

13-
### Procedure
14+
## Procedure
1415

15-
1. Use the get\_token function to retrieve a token to validate requests to the API gateway.
16-
17-
```bash
18-
function get_token () {
19-
curl -s -S -d grant_type=client_credentials \
20-
-d client_id=admin-client \
21-
-d client_secret=`kubectl get secrets admin-client-auth -o jsonpath='{.data.client-secret}' | base64 -d` \
22-
https://api-gw-service-nmn.local/keycloak/realms/shasta/protocol/openid-connect/token | jq -r '.access_token'
23-
}
24-
```
25-
26-
2. Generate a private and public key pair.
27-
28-
Execute the following commands to generate a private and public key to use for the dump.
29-
30-
```bash
31-
openssl genpkey -out private_key.pem -algorithm RSA -pkeyopt rsa_keygen_bits:2048
32-
openssl rsa -in private_key.pem -outform PEM -pubout -out public_key.pem
33-
```
34-
35-
The above commands will create two files the private key private\_key.pem file and the public key public\_key.pem file.
36-
37-
Make sure to use a new private and public key pair for each dump operation, and do not reuse an existing private and public key pair. The private key should be treated securely because it will be required to decrypt the SLS dump file when the dump is loaded back into SLS. Once the private key is used to load state back into SLS, it should be considered insecure.
38-
39-
3. Perform the SLS dump.
40-
41-
The SLS dump will be stored in the sls\_dump.json file. The sls\_dump.json and private\_key.pem files are required to perform the SLS load state operation.
42-
43-
```bash
44-
curl -X POST \
45-
https://api-gw-service-nmn.local/apis/sls/v1/dumpstate \
46-
-H "Authorization: Bearer $(get_token)" \
47-
-F public_key=@public_key.pem > sls_dump.json
48-
```
16+
(`ncn-mw#`) Perform the SLS dump.
17+
The SLS dump will be stored in the `sls_dump.json` file. The `sls_dump.json` file is required to perform the SLS load state operation.
4918

19+
```bash
20+
cray sls dumpstate list --format json > sls_dump.json
21+
```
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
11
# Load SLS Database with Dump File
22

3-
Load the contents of the SLS dump file to restore SLS to the state of the system at the time of the dump. This will upload and overwrite the current SLS database with the contents of the SLS dump file, and update Vault with the encrypted credentials.
3+
Load the contents of the SLS dump file to restore SLS to the state of the system at the time of the dump. This will upload and overwrite the current SLS database with the contents of the SLS dump file.
44

55
Use this procedure to restore SLS data after a system re-install.
66

7-
### Prerequisites
7+
## Prerequisites
88

9-
The System Layout Service \(SLS\) database has been dumped. See [Dump SLS Information](Dump_SLS_Information.md) for more information.
9+
- The System Layout Service \(SLS\) database has been dumped. See [Dump SLS Information](Dump_SLS_Information.md) for more information.
10+
- The Cray Command Line Interface is configured. See [Configure the Cray CLI](../configure_cray_cli.md).
11+
- This procedure requires administrative privileges.
1012

11-
### Procedure
13+
## Procedure
1214

13-
1. Use the get\_token function to retrieve a token to validate requests to the API gateway.
14-
15-
```bash
16-
function get_token () {
17-
curl -s -S -d grant_type=client_credentials \
18-
-d client_id=admin-client \
19-
-d client_secret=`kubectl get secrets admin-client-auth -o jsonpath='{.data.client-secret}' | base64 -d` \
20-
https://api-gw-service-nmn.local/keycloak/realms/shasta/protocol/openid-connect/token | jq -r '.access_token'
21-
}
22-
```
23-
24-
2. Load the dump file into SLS.
25-
26-
This will upload and overwrite the current SLS database with the contents of the posted file, as well as update the Vault with the encrypted credentials. The private key that was used to generate the SLS dump file is required.
27-
28-
```bash
29-
curl -X POST \
30-
https://api-gw-service-nmn.local/apis/sls/v1/loadstate \
31-
-H "Authorization: Bearer $(get_token)" \
32-
-F sls_dump=@sls_dump.json \
33-
-F private_key=@private_key.pem
34-
```
35-
36-
After performing the load state operation, the private key should be considered insecure and should no longer be used.
15+
(`ncn-mw#`) Load the dump file into SLS.
16+
This will upload and overwrite the current SLS database with the contents of the posted file.
3717

18+
```bash
19+
cray sls loadstate create sls_dump.json
20+
```

0 commit comments

Comments
 (0)