Managing SSH access to the PPC CLI
After deployment of the PPC cluster, each user can be granted SSH access to the CLI pod by enrolling their public key. The bootstrap.sh script manages adding, listing, and revoking CLI users.
Adding or revoking a key updates the cluster configuration and applies the CLI key resource in Stage 05 (05_helm_releases). SSH key enrollment grants access to the CLI pod. It does not create a Protegrity CLI application account. After connecting, users still need valid application credentials to sign in to the interactive CLI.
Prerequisites
The PPC cluster is deployed.
Run all commands from the deployment directory. To view the available commands and options, run the following command:
cd deployment ./bootstrap.sh --helpThe
bootstrap.shscript manages adding, listing, and revoking CLI users.kubectlis configured with access to the target cluster. The access commands can detect AWS or Azure from the active context; the cloud can also be specified explicitly.For clusters using an authenticated private registry, export the registry credentials before running CLI-user commands.
export TF_VAR_username="<registry-username>" export TF_VAR_password="<registry-password>"These credentials are required because the commands re-apply Stage 05. For more information, refer to Troubleshooting.
The user’s public key file (
.pub) is available. Keep the corresponding private key on the user’s device, do not send it to the cluster administrator, and restrict access to it. On Linux/macOS, usechmod 600 <key-name>if needed. On Windows, restrict the file’s ACL to the user.On secured clusters, use a supported key type. Standard clusters do not apply these secured-cluster key restrictions:
| Key type | Secured cluster support | Example generation command |
|---|---|---|
| RSA, 2048 bits or more | Supported | ssh-keygen -t rsa -b 4096 -f <key-name> -N "" |
| ECDSA P-256, P-384, or P-521 | Supported | ssh-keygen -t ecdsa -b 256 -f <key-name> -N "" |
| Ed25519 | Rejected | Not supported on secured clusters |
| DSA | Rejected | Not supported on secured clusters |
| RSA shorter than 2048 bits | Rejected | Not supported on secured clusters |
The ECDSA command above generates a P-256 key. The key type is checked against the CLI pod’s SSH policy before enrollment.
Adding CLI user
To add a user with SSH access to the PPC CLI, perform the following steps:
Generate a key pair using either a 4096-bit RSA key or an ECDSA P-256 key.
ssh-keygen -t rsa -b 4096 -f <key-name> -N "" # For RSA, 2048 bits or more ssh-keygen -t ecdsa -b 256 -f <key-name> -N "" # For ECDSA P-256, P-384, or P-521<key-name>is the private-key filename. The public key is written to<key-name>.pub. Use only the.pubfile for enrollment. Keep the private key local and appropriately permissioned.Enroll the public key of the required user.
./bootstrap.sh --add-cli-user --user <user-name> --public-key-file <key-name>.pubTo select the cloud explicitly, add
--cloud awsor--cloud azure. By default, the script detects the cloud from the activekubectlcontext.Confirm that the command reports the public key as validated and authorized. The script applies Stage 05 and verifies the key in the
user-svc-keyssecret. The apply targets only the CLI key resource. Resource-targeting warnings in the command output are expected.Expected result: Stage 05 completes, and the enrolled user’s public key is present in
user-svc-keys. This confirms enrollment, but does not by itself prove that SSH authentication works.Verify SSH access by connecting to the CLI host with the matching private key:
ssh -o IdentitiesOnly=yes -i <key-name> -p 22 ptyitusr@<FQDN>For example:
ssh -o IdentitiesOnly=yes -i user.key -p 22 ptyitusr@user.example.com.Expected result: SSH authenticates with the enrolled key and opens the CLI session. Then provide the user’s Protegrity CLI username and password when prompted. This application sign-in is separate from SSH authentication.
Each username maps to one public key. When rotating a key for an existing username, verify the resulting fingerprint with --list-cli-user and test SSH using the new private key. Do not assume the previous key was replaced until the list, and login checks confirm it. If the command reports a duplicate-user or key-validation error, refer to Troubleshooting.
To verify multi-user access, enroll two distinct usernames with their own public keys. List both entries, and have each user authenticate with their own private key. After revoking one user, confirm the other user’s fingerprint remains listed and that user’s SSH login still succeeds.
Listing CLI users
To list the enrolled users and their public-key fingerprints, run the following command:
./bootstrap.sh --list-cli-user
Expected result: For every enrolled username, verify the username and the fingerprint match the public key that user supplied. The list contains fingerprints, not private keys. For example, output should identify entries equivalent to:
<user-name> <public-key-fingerprint>
Revoking a CLI user
To remove a CLI user SSH access to the PPC CLI, run the following command:
./bootstrap.sh --revoke-cli-user --user <user-name>
Specify --cloud aws or --cloud azure to bypass automatic cloud detection. The command applies Stage 05 to revoke the user’s CLI pod SSH access.
Expected result: The command completes successfully and applies the updated CLI key resource. Run --list-cli-user and verify that the revoked username is no longer listed. Then attempt SSH using that user’s previously authorized private key; authentication should be denied. Confirm other enrolled usernames and fingerprints remain listed, and verify another user’s SSH login still succeeds.
The following are illustrative verification checkpoints, exact command messages can vary:
Add: key validated; Stage 05 applied; key verified in user-svc-keys
List: <user-name> <public-key-fingerprint>
Revoke: Stage 05 applied; <revoked-user> absent from --list-cli-user
SSH: Permission denied (publickey) for the revoked user's key
Dry Run
Append --dry-run to an add or revoke command to preview its changes. The script runs an OpenTofu plan instead of applying the change.
./bootstrap.sh --add-cli-user --user <user-name> --public-key-file <key-name>.pub --dry-run # add cli user command
./bootstrap.sh --revoke-cli-user --user <user-name> --dry-run # revoke cli user command
Expected result: Review the plan and confirm it targets the intended CLI key resource and the intended username or key change. A dry run does not persist changes to terraform.tfvars, update the user-svc-keys secret, authorize a new key, or revoke an existing key. Verify no access state changed by listing users. Do not treat a dry run as proof of successful SSH access or revocation. Run the command again without --dry-run to apply it.
Troubleshooting
| Issue | Checks and resolution |
|---|---|
| Enrollment reports an invalid or unsupported key | Confirm that --public-key-file points to the public .pub file, contains a complete OpenSSH public-key line, and meets the secured-cluster key requirements above. Do not provide the private key. Correct or regenerate the key, then retry. |
| An existing username or key is rejected | Check the exact username and current fingerprint with --list-cli-user. A username has one associated public-key entry; do not assume a failed add replaced the existing key. If rotation is required and add cannot update that entry, revoke the username, add it again with the new public key, then verify its fingerprint and SSH login. Ensure another enrolled user’s entry remains present. |
The key is listed but SSH reports Permission denied (publickey) | Confirm the username and fingerprint in --list-cli-user, use the matching private key with -i <key-name> and IdentitiesOnly=yes, and confirm the non-dry-run Stage 05 apply completed and user-svc-keys contains the enrolled key. Retry SSH after the apply completes. |
SSH reports Connection refused or time out | Verify the CLI host name resolves to the expected load balancer address, the host/port are reachable, and the cluster’s CLI endpoint is available. A network connection failure is different from a rejected key. |
| Stage 05 fails while applying the key resource | Review the command output for the failing stage and resource. On a private-registry cluster, follow the registry-credentials resolution in Troubleshooting. |
| SSH works but interactive CLI sign-in fails | SSH access does not create an application account. Verify the user’s Protegrity CLI credentials separately. |
Feedback
Was this page helpful?