Prompt

How do I keep SSH keys and certificates out of config files?

Technology / Cybersecurity1 observationLast seen Oct 25, 2026

Latest observation

Oct 25, 2026OpenAI APIWeb search: off

A good way to keep SSH keys and certificates out of config files is to treat them as secrets and load them from a separate secret store or runtime input, rather than hardcoding them in your app config.

Common approaches

1. Use environment variables

Store only references in config, not the secret itself.

export SSH_PRIVATE_KEY="$(cat /secure/path/id_rsa)"
export SSH_CERT="$(cat /secure/path/id_rsa-cert.pub)"

Then your app reads them from the environment.

Pros: simple, portable
Cons: can still leak via process listings, crash dumps, or misconfigured logging


2. Mount secrets as files

Keep the key/cert on disk with restrictive permissions and point your app to the file path.

Example config:

ssh:
  private_key_file: /run/secrets/ssh/id_rsa
  cert_file: /run/secrets/ssh/id_rsa-cert.pub

In containers, this is often done with:

  • Docker secrets
  • Kubernetes Secrets mounted as volumes
  • systemd credentials
  • HashiCorp Vault Agent sidecar writing files

Pros: better than embedding contents in config
Cons: still needs file access controls


3. Use a secret manager

Store keys in a tool like:

  • HashiCorp Vault
  • AWS Secrets Manager
  • Azure Key Vault
  • Google Secret Manager
  • 1Password Secrets Automation / Infisical / Doppler

Your app fetches the secret at startup or via a sidecar/agent.

Pros: strongest operational pattern
Cons: more setup


4. Use SSH agent or hardware-backed keys

Instead of storing the private key in a config file, load it into:

  • ssh-agent
  • a smartcard / YubiKey / TPM
  • cloud KMS/HSM-backed signing flow

Then config only includes the socket/path to the agent if needed.

Pros: private key never sits in app config
Cons: more complex; not always supported by libraries


Good config pattern

Keep config like this:

ssh:
  private_key_source: file
  private_key_path: /run/secrets/ssh/id_ed25519
  certificate_path: /run/secrets/ssh/id_ed25519-cert.pub

or:

ssh:
  private_key_source: env
  private_key_env: SSH_PRIVATE_KEY

This way the config stores only where to get the secret, not the secret itself.


Security tips

  • Never commit keys to git
  • Use least-privilege file permissions (chmod 600)
  • Avoid logging secret values
  • Rotate keys/certs regularly
  • Prefer short-lived SSH certificates over long-lived keys when possible
  • Separate config from secrets in CI/CD and deployment manifests

If you want, I can show examples for a specific stack like OpenSSH, Ansible, Docker/Kubernetes, Go/Python/Node, or Vault.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.