Configuring SSH Key Rotation for an Account¶
This guide describes how to configure automatic SSH key rotation for an account in Fudo Enterprise.
Important
The complete workflow is:
Create a secret change policy that generates the SSH key.
Create an SSH key secret changer.
Store the SSH key as an SSH Key secret in the Password Vault.
Assign the changer (and, optionally, a verifier) to that secret.
Point the account at the Password Vault secret.
Creating a Secret Change Policy¶
A secret change policy defines how often the key is rotated and which key algorithm is generated. Create it before the changer so that it can be selected in the changer’s Settings section.
Select > and go to the tab.
Click .
In the Name field, enter a unique name (e.g.,
SSH key policy).Enable and, in the Change frequency field, define how often the key is rotated.
In the SSH Key settings section, from the SSH Key algorithm drop-down list, select the algorithm to generate (e.g.,
Ed25519).Click .
Note
The SSH Key settings apply only when the policy is assigned to a changer whose Object target is SSH key.
Creating an SSH Key Secret Changer¶
Select > and click .
In the Name field, enter a unique name (e.g.,
SSH key rotation).From the Script type drop-down list, select
changer.In the Timeout field, define the script’s execution time limit.
From the Object target drop-down list, select SSH key.
Note
After you select SSH key, a Settings section appears where you can select a Secret change policy and, optionally, enable Change secret after checkin and Change secret after session.
In the Settings section, from the Secret change policy drop-down list, select the policy created above (
SSH key policy). UseStatic, without restrictionsinstead when the key should not be regenerated on a schedule.In the Connection Mode section, select the transport layer (typically SSH).
In the SCRIPT tab, add the commands that deploy the new key on the target host.
Note
Instead of entering the commands manually, you can load the built-in SSH key changer script from the Import script drop-down list and adjust it as needed.
The example below (for a Linux host) writes the newly generated public key to the user’s authorized_keys file:
Action |
Command |
|
|---|---|---|
1 |
EXPECTED |
|
2 |
INPUT |
|
3 |
INPUT |
|
4 |
INPUT |
|
5 |
INPUT |
|
6 |
INPUT |
|
7 |
INPUT |
|
8 |
EXPECTED |
|
Note
For an SSH key target, the %%secret_login%% variable is the login stored in the rotated secret, and %%new_ssh_public_key%% is the public part of the key that Fudo Enterprise generates according to the assigned policy.
In the VARIABLES tab, fill in every required field (marked with a red dot). Initialize the transport variables (
transport_bind_ip,transport_host,transport_port,transport_host_public_key) from the target server object — in this example, thelinuxserver. Then set the following:transport_method– change the Predefined value frompasswordtosshkey.transport_login– set Type tosecretand Property tologin, then select the privileged secret used to connect (e.g.,Admin_314) as the Predefined value.transport_secret– set Type tosecretand Property tosecret value, then select the same privileged secret (e.g.,Admin_314) as the Predefined value.secret_login– the login of the regular user, stored in the secret whose key will be changed. Leave it set to------so that the changer can operate on any secret it is run against (self).
Important
The transport_method variable defaults to password. For SSH key rotation you must change its Predefined value to sshkey manually; otherwise the changer will not authenticate to the target host with the key.
Click .
Note
Create a matching SSH key verifier the same way (set Script type to verifier) if you also want Fudo Enterprise to verify the key stored on the target host.
Storing the SSH Key in the Password Vault¶
The SSH key that will be rotated must be stored as an SSH Key secret in the Password Vault.
Select > .
Click , select the SSH Key type, and define the secret.
Note
If the secret already exists (for example, it was created together with the account), you can skip this step.
Assigning the Changer to the Secret¶
Select > and open the SSH Key secret.
Go to the CHANGERS tab.
In the Secret changers field, select your SSH key changer from the Add changer drop-down list.
Optionally, in the verifier field, select an SSH key verifier from the Add verifier drop-down list.
Click .
Note
The Add changer and Add verifier drop-down lists show only secret changers whose Object target matches the secret type — for an SSH Key secret, only SSH key changers appear.
Pointing the Account at the Secret¶
Finally, make the account use the Password Vault secret so that it always presents the current key.
Select > and open (or create) the account.
In the SETTINGS tab, in the Credentials section, set Replace secret with to .
From the Secret name drop-down list, select the SSH Key secret configured above.
Click .
Note
Because the key is managed through the Password Vault, the account’s SECRET CHANGERS tab stays inactive — this is expected. Rotation is driven by the changer assigned to the secret, not by the account.
Related Topics: