Chapter 26
Who may issue the request?
Connect encrypted transport to identity, authorization, secrets and data lifecycle.
Prerequisite: Encrypt a connection. Course map →
The situation
A client connects with a newly generated key using CURVE, the protocol ZeroMQ uses to protect messages in this example. The application then permits an operation that should require a specific business role.
Separate the controls
Encryption protects transport under its key and protocol assumptions. Authentication establishes an identity under a trust policy. Authorization decides which operations that identity may perform. Business validation decides whether a permitted request is meaningful. A successful handshake does not collapse those controls into one.
In the CURVE lab, the client uses the expected public key for its server. The server uses no list of approved client keys. A service can use the ZeroMQ Authentication Protocol (ZAP) to check client identities, then decide which actions each identity may take.
Operate keys as identities
Specify how public keys are obtained and trusted, how secret keys are stored, who can rotate/revoke them and how clients learn a new server identity. Test denied credentials and transitions, including old connections and unavailable authorization services.
The guest generates fresh keys for each run and discards them when it stops. A deployed service needs its own way to distribute and renew trusted keys. Avoid copying production credentials into teaching examples or diagnostic exports. Prefer narrow deployment identities and a reviewed key-management process.
Protection and permission
Illustrative case.
Compare a successful CURVE exchange with an authorized request. What evidence would show that the caller may issue the request?
| Boundary | Useful evidence | Remaining question |
|---|---|---|
| CURVE exchange | Protected connection with pinned server key | Client trust/permissions still required |
| ZAP policy | Authentication decision | Business authorization separate |
| Authorized request | Permission checked | Validate values and bound cost |
| Logs/exports | Operational evidence | Minimization, access and retention |
Bound the exposed work
An authenticated sender can still overload a service or submit oversized payloads. Apply limits to bytes, frames, outstanding requests, retry amplification, handler cost and retained IDs. Decide how unauthenticated/unauthorized traffic is observed and rejected without amplifying the attack.
Keep personal and confidential data to what is needed. Apply access and retention rules to copies in logs, caches, snapshots, quarantine and exports. A routing identity or hashed ID can remain linkable data. Access and retention belong to every destination, not just the main transport.
Verify the actual deployment
Rehearse allowed and denied operations, malformed messages, key rotation/revocation, worker reconnect, authorization outages and resource exhaustion. Include business audit evidence without leaking unnecessary payloads. Assign owners for incidents and data lifecycle decisions.
The guest uses private loopback and synthetic messages. It establishes the local CURVE mechanism exercised, not a compliance result, external network policy or production tenant isolation. Use the selected libzmq/PyZMQ versions’ documentation and actual deployed controls.
Check your understanding
A production server accepts connections from any client that creates a valid CURVE key pair. The service should accept only approved devices. What decision is missing?
Show hints
Hint 1
Who decides which public keys belong to approved devices?
Hint 2
Where will the service reject a client with an unknown key?
Show explanation
Keep a record of approved client keys and check it when a device connects. Separately check which actions each approved device may request. Test how a device is added and removed, and confirm that unknown keys and forbidden actions are rejected.
ReferencesPrimary sources for this chapter’s design case
Use these guides to check the framework or protocol contract discussed in this chapter. Moving “stable” or “current” guides can describe a different release; check the version used by your deployment. These readings do not execute the distributed frameworks they compare.
CURVE socket configuration
ZAP specification