Separate secret generation, storage, retrieval, and revocation. Interviewers can keep asking "who can decrypt it?" until your answer reaches an actual identity and policy. The credential questions below come directly from the preparation list.
Generate a unique root password and 1,000 SSH key pairs for Linux servers.
Generate independent passwords with an operating-system cryptographic random source, and key pairs with OpenSSH. Use named accounts with narrowly scoped privilege elevation for routine work; root passwords can be separately controlled recovery credentials if required.
import secrets
def new_password():
return secrets.token_urlsafe(32)
This draws 32 random bytes, giving 256 bits of source entropy before encoding. Check generated values against your inventory and regenerate on a collision if literal uniqueness is required; randomness makes collision extremely unlikely but does not logically guarantee it. Validate the target system's password constraints. secrets is designed for credentials; random is designed for simulation.
For an interactive lab key, use ssh-keygen -t ed25519 -f ./lab-key -C interview-lab and supply a passphrase at the prompt. For 1,000 identities, orchestrate generation on the intended host/runner or isolated worker, assign metadata/fingerprints, store each result before proceeding, and make retries recognize existing inventory entries. Do not overwrite existing keys or print private material into job logs. Algorithm choice must fit the fleet's policy and compatibility requirements. See ssh-keygen.
A server's host key identifies the server. A client authentication key identifies a user or automation identity. The public half belongs in trust configuration; sharing a server's host private key with automation confuses those roles. Ask which key type the question intends.
Keys must be stored securely and accessible to other automations. How?
Store required private material in a secret manager encrypted under a separately controlled key-management system. Attach identity, owner, permitted consumers, creation/expiry, and rotation state. Give each workload access only to the secrets it needs; audit retrieval without logging values.
The automation first authenticates using a platform/workload identity, such as a cloud identity or a verified service-account identity. That identity maps to a short-lived token and a narrowly scoped secret policy. It must not need a fleet-wide static password embedded in source to obtain the fleet-wide keys. Vault's Kubernetes authentication is one concrete identity-to-policy mechanism.
Where feasible, generate private keys locally and issue short-lived SSH certificates for their public keys. This reduces central private-key distribution; the certificate authority, signing policy, and revocation path still need protection. See Vault's SSH secrets engine.
How do you protect keys at rest and in transit?
At rest: encrypt secret storage and backups, keep decryption authority separate, restrict readers, and use restrictive filesystem permissions on temporary copies. In transit: use authenticated TLS for secret APIs and verified SSH host identity for SSH connections. Encryption without peer verification can send a secret securely to an impostor.
On OpenSSH clients, StrictHostKeyChecking yes with managed known-host entries or a trusted host CA provides a concrete verification policy. Accepting a newly observed key without verifying it leaves first-contact impersonation possible; ssh-keyscan collects a key but does not authenticate its owner. See ssh_config.
Keep secrets out of command-line arguments, debug tracing, logs, and build artifacts. Environment variables are not universally private either; prefer the application's supported protected file/descriptor or direct secret-client interface. OWASP's secret lifecycle guidance covers access controls, transport, and rotation.
What Linux system security should you revise?
Patch the kernel and packages; restrict exposed listeners and SSH access; use separate service identities, least privilege, and appropriate file permissions. Understand sudo policy, SELinux/AppArmor enforcement, security logs, and recovery access. Explain the boundary each control protects instead of listing tools.
For a compromised service account, ask which files it can read, which network destinations it can reach, what privileges it can obtain, and which secrets must be revoked. Container identity alone does not prove isolation from host resources; privileges, mounts, namespaces, and kernel controls determine the boundary.
Follow-up: what happens after a key is leaked?
Revoke its authorization or certificate trust as applicable, stop new use, and investigate existing sessions, copies, logs, and scope of access. Replace it through the inventory, verify consumers switched, then retire the old credential. Expiry limits duration but does not end every session already established with that credential.
Rotation should tolerate an overlap only where policy permits, prove the new credential works, and record which hosts remain on the old one. Define the secret-manager outage behavior: short bounded retries, existing credentials only within their permitted lifetime, and a controlled recovery path.
Two-minute drill
"I encrypt every key and put it in a bucket." Answer the next questions: who decrypts, how does that identity authenticate, which exact keys can it read, how is the remote endpoint verified, where are values exposed, and how does revocation reach every consumer?
Expected: a concrete chain from workload identity to scoped policy to authenticated retrieval, with inventory and rotation evidence. Return to the complete preparation route.