◇ OpenCyber Academy
Technologist · Chapter 22 · English

Chapter 22 — Cryptography and trust services: automation

Open, free learning for anyone who wants to protect people and technology. No account is required to read this text or its worked answers.

Chapter 22 — Cryptography and trust services: automation

Lesson map

Lesson 22 published. Map, example, EX064.

flowchart TD
  N0["Learning outcomes"]
  N1["22.1 Why automate"]
  N2["Lab — Renewal planner"]
  N3["22.2 Reading the planner"]
  N4["22.3 Humans and exceptions"]
  N5["Synthesis"]
  N0 --> N1 --> N2 --> N3 --> N4 --> N5
  N5 --> EX["Worked example"]
  EX --> Q["Exercise EX064"]

Logical drawing

flowchart LR
  N0["Learning outcomes"]
  N1["22.1 Why automate"]
  N2["Lab — Renewal planner"]
  N3["22.2 Reading the planner"]
  N4["22.3 Humans and exceptions"]
  N5["Synthesis"]
  N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> Q["EX064"]
[Learning outcomes]
    |
    v
[22.1 Why automate]
    |
    v
[Lab — Renewal planner]
    |
    v
[22.2 Reading the planner]
    |
    v
[22.3 Humans and exceptions]
    |
    v
[Synthesis]
    |
    v
[Worked example] --> [Exercise EX064]

Learning outcomes

You will (1) automate renewal planning from inventory data; (2) separate automatic and manual paths; (3) keep humans in control of exceptions.

22.1 Why automate

Manual renewal caused the council's past outages. Rosa writes a planner that reads the inventory and decides, for each certificate, whether to renew now, skip or escalate. Automation repeats the same correct decision every day, which people forget to do during holidays. Still, automation must be observable and must hand exceptions to people, because some certificates cannot be renewed automatically and some decisions need judgement. Rosa writes down what the planner must never do, such as deleting certificates or changing keys, and makes those actions impossible in its code. She also stores each day's plan, so anyone can later see what was decided and why. The inventory becomes the single source the planner trusts, which gives teams a reason to keep it accurate.

Lab — Renewal planner

"""Dry-run renewal planner: which certificates an automation job would renew (renew at <= 30 days)."""
from datetime import date
TODAY = date(2026, 5, 1)
CERTS = [("permits", date(2026, 5, 20), "acme"), ("council-docs", date(2026, 9, 2), "acme"),
         ("staff-vpn", date(2026, 5, 9), "internal-ca"), ("legacy-gis", date(2026, 4, 28), "manual")]

def main():
    for name, exp, how in CERTS:
        left = (exp - TODAY).days
        act = "RENEW" if left <= 30 and how != "manual" else ("ESCALATE (manual)" if left <= 30 else "skip")
        print(f"{name:<13} {left:>4} d {how:<12} {act}")

if __name__ == "__main__":
    main()

Run with python3 lab_renewplan.py. Verified output:

permits         19 d acme         RENEW
council-docs   124 d acme         skip
staff-vpn        8 d internal-ca  RENEW
legacy-gis      -3 d manual       ESCALATE (manual)

22.2 Reading the planner

The planner renews certificates within thirty days of expiry. The permit site at 19 days is renewed automatically. Council-docs at 124 days is skipped. Staff-vpn at 8 days is renewed. Legacy-gis has already expired, at minus three days, and is managed manually because its old appliance cannot run an ACME client, so the planner escalates it to a person rather than attempting anything. Rosa likes that the planner's output is a readable plan, which can be reviewed before actions run. She adds a summary line counting each decision type for quick daily review.

22.3 Humans and exceptions

Rosa adds safeguards: the planner runs in a dry-run mode first and posts its plan to the operations channel; actual renewals run only through the vetted ACME client; any escalation creates a ticket with the owner; and failures alert monitoring. The legacy-gis appliance gets a replacement project, since an expired certificate on an unsupported device is a recurring risk. Owen notes that the best automation removes routine work so people can focus on the exceptions it reports. She reviews the dry-run plans for two weeks before allowing real renewals, comparing them with what she would have decided by hand.

Worked example

Rosa's planner renews two certificates, skips one and escalates an expired manual one, running dry first and opening tickets for exceptions.

Synthetic case. Inventory values are invented.

Errors and limits

Automation that fails silently is worse than manual work. Thresholds must suit certificate lifetimes.

Exercises

Synthesis

Automation should make routine renewals reliable, stay observable and hand exceptions to accountable people.

Continue studying — chapter 22 of 30

← Chapter 21 (draft) · Course chapter index · Chapter 23 (draft) →