Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Private keys and generation intermediates for the s11-relay spike are
# produced locally by generate-certs.sh and are never committed.
# (The public certificates .pem/.der and leaf.ext stay tracked.)
*.key
*.csr
*.srl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# s11-relay spike certificates

This directory holds the TLS material for the s11-relay spike (see
`../RESULTS.md` for the runs it fed).

**Private keys are never committed.** The tracked files are the public
certificates (`gen/*.pem`, `gen/*.der`), the leaf extension template
(`gen/leaf.ext`), and `generate-certs.sh`. The `*.key`, `*.csr`, and
`*.srl` files are produced locally and are covered by this directory's
`.gitignore`.

To (re)generate everything, with the topology the spike expects
(CA 1 signs leafA/leafB, CA 2 signs leafC, leafB installed as the live
leaf, all leaves `CN=localhost` with SAN `DNS:localhost, IP:127.0.0.1`,
EC P-256 keys):

```sh
./generate-certs.sh
```

The configs under `../config/` (`tls-manual.toml`, `tls-reloading.toml`)
read `live/leaf.pem` / `live/leaf.key`, which the script installs.

History note: the original spike run committed its throwaway keys
(removed under developing-today/code#12150). They only ever signed this
spike's test chains — no environment trusts CA 1 or CA 2 — and the
certificates in git history are expired. Rewriting history to purge
them was left as a separate human decision.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash
# Regenerate the s11-relay spike's TLS material.
#
# The certificates are public and stay tracked; the private keys are
# generated locally by this script and are never committed (see .gitignore
# in this directory and README.md). Running this script (re)creates every
# key and certificate under gen/ and installs leafB as the live leaf,
# matching the topology recorded in ../RESULTS.md:
#
# CA 1 (CN=s11 test CA 1) signs leafA and leafB; leafB is the live leaf
# CA 2 (CN=s11 test CA 2) signs leafC (the wrong-CA / rotation leaf)
# every leaf is CN=localhost with SAN DNS:localhost, IP:127.0.0.1
# all keys are EC P-256, as in the original spike material
set -euo pipefail
cd "$(dirname "$0")"

DAYS=3650

mk_ca() { # file-stem subject
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
-keyout "gen/$1.key" -out "gen/$1.pem" -days "$DAYS" \
-subj "/CN=$2" \
-addext "basicConstraints=critical,CA:TRUE" \
-addext "keyUsage=critical,keyCertSign,cRLSign" \
-addext "subjectKeyIdentifier=hash" \
-addext "authorityKeyIdentifier=keyid:always"
openssl x509 -in "gen/$1.pem" -outform DER -out "gen/$1.der"
}

mk_leaf() { # file-stem ca-stem
openssl req -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
-keyout "gen/$1.key" -out "gen/$1.csr" -subj "/CN=localhost"
openssl x509 -req -in "gen/$1.csr" -CA "gen/$2.pem" -CAkey "gen/$2.key" \
-CAcreateserial -out "gen/$1.pem" -days "$DAYS" -extfile gen/leaf.ext
}

mk_ca ca1 "s11 test CA 1"
mk_ca ca2 "s11 test CA 2"
mk_leaf leafA ca1
mk_leaf leafB ca1
mk_leaf leafC ca2

cp gen/leafB.pem live/leaf.pem
cp gen/leafB.key live/leaf.key
chmod 600 gen/*.key live/leaf.key
echo "generated: gen/{ca1,ca2,leafA,leafB,leafC} + live/leaf (copy of leafB)"

This file was deleted.