Use this file to discover all available pages before exploring further.
rskey was designed for Infrastructure-as-Code and containerized deployments. It has no dependency on a Posit product installation or license, so you can generate keys and encrypt secrets during image builds, Terraform applies, Ansible runs, or any other pipeline step — before the target product is ever installed on the machine.
rskey encrypt accepts newline-separated values on stdin. Each line is encrypted independently and the corresponding ciphertext is written to stdout on a new line:
This is useful when a deployment script needs to encrypt several values in sequence, or when the list of secrets is generated dynamically:
# Encrypt all values from a secrets file and write ciphertexts to another filecat plaintext-secrets.txt | \ rskey encrypt -f /var/lib/rstudio-connect/rstudio-connect.key \ > encrypted-secrets.txt
A common pattern is to generate the key during the container’s first-start entrypoint so each instance gets a unique key, rather than baking a shared key into the image.
#!/bin/bash# entrypoint.shKEY_PATH=/var/lib/rstudio-connect/rstudio-connect.key# Generate a unique key on first startif [ ! -f "$KEY_PATH" ]; then rskey generate -o "$KEY_PATH"fi# Encrypt the database password from an environment variable and write# it into the config file. Remove the env var from memory afterwards.ENCRYPTED=$(echo "$DB_PASSWORD" | rskey encrypt -f "$KEY_PATH")unset DB_PASSWORDsed -i "s|^Password =.*|Password = $ENCRYPTED|" /etc/rstudio-connect/rstudio-connect.gcfgexec /usr/lib/rstudio-connect/bin/connect
If you mount the key file from a persistent volume, the if [ ! -f ... ] guard ensures the same key survives container restarts. Without persistence, a new key is generated on every start and previously encrypted values will no longer decrypt.
Mishandling key material in automated pipelines is easy. Follow these practices:
Do not store the key in an environment variable. Environment variables are visible in process listings, container inspection output, and CI logs. Write the key directly to a file with rskey generate -o, or pipe it immediately into a secrets manager.
Restrict key file permissions. The key file must be readable only by the service account running the Posit product. Use 0600 or tighter.
Use the fingerprint for identification. When you need to reference which key is in use in a log entry, Terraform output, or Ansible fact, print the fingerprint rather than any portion of the key itself.
Rotate keys deliberately. Re-encrypt all stored secrets with the new key before replacing the key file. There is no automatic re-encryption.
Verify the rskey binary signature before using it in production pipelines. Releases are signed with Sigstore using GitHub’s keyless OIDC mode: