Keys, agent, and config

Protect private keys and use the agent

Use passphrases and an agent to balance theft resistance with usable sessions.

9 minute lesson

~~~

Start from the behavior you can observe. The operator unlocks the key locally and verifies which identities the agent currently offers.

A passphrase protects a copied private-key file, while an agent can hold an unlocked key for a controlled session. The useful target is not encyclopedic coverage. Make one deliberate choice, observe its consequences, and know which requirement would make you revise it.

It is tempting to remove the passphrase or forward the agent everywhere for convenience. That trades a clear decision for an assumption you will eventually have to debug. The stronger move is to use a strong passphrase, load only needed identities, bound agent lifetime, and avoid forwarding unless the threat model requires it. Make the boundary explicit in code and in the project notes.

Tie the decision back to the larger job: Create a maintainable client identity setup without copying private keys or making authentication implicit. Record enough evidence that another developer can repeat the result without relying on your memory.

List agent identities, connect with identities-only behavior, remove the key, and observe the authentication difference. Repeat it once with an invalid or hostile condition and write down the boundary the failure revealed.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →