Master keys and the HSM
Two master keys protect what the Platform holds: one seals the HSM simulator’s LMK, the other wraps the vault’s keys. Neither is stored in a database or in a backup, so a backup is useless without them, and a lost key can’t be recovered.
Keep the keys out of the environment
Section titled “Keep the keys out of the environment”By default the keys come from .env, which puts them in the containers’ environment. They can come from files instead, as Docker and Kubernetes hand secrets to containers, and as cloud secret stores are mounted.
-
Docker Compose: put each key in a file readable only by the services’ user:
openssl rand -hex 32 > hsm-master.key && chown 10001 hsm-master.key && chmod 400 hsm-master.keyIn
.env, leaveHSM_MASTER_KEYandVAULT_MASTER_KEYunset, setHSM_MASTER_KEY_PATHandVAULT_MASTER_KEY_PATHto the files, and start withdocker compose -f compose.yaml -f compose.keyfiles.yaml up -d. -
Kubernetes or another orchestrator: mount the secrets and set
ISO8583SIM_PLATFORM_HSM_MASTER_KEY_FILEandISO8583SIM_PLATFORM_VAULT_MASTER_KEY_FILEto the mounted paths.
Give each key one source: a service with both the key and its file set refuses to start. Moving a key from .env to a file changes nothing else; it’s the same key.
Rotate a master key
Section titled “Rotate a master key”With the service stopped, and the current key still where it reads it:
docker compose stop vaultdocker compose run --rm vault iso8583sim-vault rotate /path/to/new.keythen put the new key where the vault reads it, and start it again. Only the data keys are re-wrapped, in one transaction. The HSM simulator’s key rotates the same way, with iso8583sim-hsm rotate.
If a key is lost
Section titled “If a key is lost”- The HSM simulator’s: the sealed LMK can’t be opened. Delete the LMK from the HSM’s database (the
lmkstable), restart it to create a new LMK, and add the keys again. Keys your systems hold under the old LMK stop working. - The vault’s: the stored private keys can’t be opened. Delete the vault’s items, restart it to create a new CA, and issue new certificates. Systems that trust the old CA need the new one.
HSM settings
Section titled “HSM settings”| Setting | What it does |
|---|---|
HSM_HEADER_LENGTH |
The length of the header host commands carry and the answer repeats: 4 unless your host applications send another. |
HSM_KEY_TYPE_TABLE |
classic or pci: which key type codes are in force, as on a payShield. |
HSM_MAX_CONNECTIONS |
Connections it keeps at once (200); more are closed as they arrive, and the HSM page counts them. |
HSM_TLS_CERTIFICATE |
A server certificate from the console’s Certificates page, by its id: the HSM then serves TLS on its command port. |
HSM_TLS_CLIENT_AUTH |
none, optional or required: whether connecting systems present a client certificate issued by the install’s CA. |
A new install starts with the published Thales test LMK, so keys your systems already hold under it work as they are. An admin can replace it on the HSM page.