Skip to content

Commit d102448

Browse files
README: add mirror example and usage of -X (#68)
README: add mirror example and usage of -X Cf #39 Co-authored-by: Luke Valenta <lvalenta@cloudflare.com> --------- Co-authored-by: Luke Valenta <lvalenta@cloudflare.com>
1 parent 5b90e7d commit d102448

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,34 @@ The second is optional "evidence" that's published alongside the
100100
assertions. In the future this could for instance be used for
101101
serialized DNSSEC proofs.
102102

103+
We can also create an assertion request derived from an existing X.509
104+
certificate at a TLS server using the `-X` flag:
105+
106+
```
107+
$ mtc new-assertion-request -X example.com:443 | mtc inspect assertion-request
108+
checksum 015d4da06412b4e48f8d93bcbe7bbf43c4684579322cbfbc88d8b653bb2f7e51
109+
not_after unset
110+
subject_type TLS
111+
signature_scheme p256
112+
public_key_hash 8d566a5407ab85b413925911c4ce6b13013516006fa8568bf2ec58b9abe04af1
113+
dns [example.com]
114+
dns_wildcard [example.com]
115+
evidence-list (1 entries)
116+
umbilical
117+
certificate 0
118+
subject CN=*.example.com,O=Internet Corporation for Assigned Names and Numbers,L=Los Angeles,ST=California,C=US
119+
issuer CN=DigiCert Global G3 TLS ECC SHA384 2020 CA1,O=DigiCert Inc,C=US
120+
serial_no ad893bafa68b0b7fb7a404f06ecaf9a
121+
not_before 2025-01-15 00:00:00 +0000 UTC
122+
not_after 2026-01-15 23:59:59 +0000 UTC
123+
certificate 1
124+
subject CN=DigiCert Global G3 TLS ECC SHA384 2020 CA1,O=DigiCert Inc,C=US
125+
issuer CN=DigiCert Global Root G3,OU=www.digicert.com,O=DigiCert Inc,C=US
126+
serial_no b00e92d4d6d731fca3059c7cb1e1886
127+
not_before 2021-04-14 00:00:00 +0000 UTC
128+
not_after 2031-04-13 23:59:59 +0000 UTC
129+
```
130+
103131
### Batches, merkle trees and signed validity windows
104132

105133
An MTCA doesn't give you a certificate for an assertion request immediately.
@@ -481,3 +509,66 @@ recomputed tree head 043bc6b0e49a085f2370b2e0f0876d154c2e8d8fe049077dbad118a3635
481509
authentication path
482510
8964f010faa9e499b21917f8792b541b7b1ac19f313a5d53094c698c2edc330b
483511
```
512+
513+
### Mirroring a CA
514+
515+
We can set up a new mirror with the `mtc mirror new` command:
516+
517+
```
518+
$ mtc mirror new ca.example.com/path
519+
```
520+
521+
This will download the `ca-params`
522+
from `https://ca.example.com/path/mtc/v04b/ca-params` and
523+
set up a directory structure similar to that of a CA:
524+
525+
```
526+
$ find .
527+
.
528+
./www
529+
./www/mtc
530+
./www/mtc/v04b
531+
./www/mtc/v04b/ca-params
532+
./www/mtc/v04b/batches
533+
./tmp
534+
```
535+
536+
To bring the mirror up to date with the CA, use the `update` command:
537+
538+
```
539+
$ mtc mirror update
540+
2025/04/24 11:54:53 INFO Current state expectedStoredRemote=0 expectedActiveRemote=0 latestRemoteBatch=0 mirroredBatches=⌀
541+
2025/04/24 11:54:53 INFO Fetching batch=0
542+
2025/04/24 11:54:53 INFO Next batch at the earliest in 49s
543+
$ find .
544+
.
545+
./www
546+
./www/mtc
547+
./www/mtc/v04b
548+
./www/mtc/v04b/ca-params
549+
./www/mtc/v04b/batches
550+
./www/mtc/v04b/batches/0
551+
./www/mtc/v04b/batches/0/validity-window
552+
./www/mtc/v04b/batches/0/tree
553+
./www/mtc/v04b/batches/0/entries
554+
./www/mtc/v04b/batches/0/evidence
555+
./www/mtc/v04b/batches/latest
556+
./tmp
557+
```
558+
559+
#### Local testing
560+
561+
To make local testing convenient, when you use `localhost` as server prefix,
562+
the mirror will use `http` instead of `https`. This allows a quick testing
563+
set up as follows:
564+
565+
```
566+
# Set up a CA in the ca folder
567+
$ mtc ca -p ca new --batch-duration 5m --lifetime 1h 62253.12.15 localhost:8080
568+
$ mtc ca -p ca queue -X example.com:443
569+
$ mtc ca -p ca issue
570+
$ mtc ca -p ca server -listen-addr localhost:8080 &
571+
# Set up a mirror of the CA in the mirror folder
572+
$ mtc mirror -p mirror new localhost:8080
573+
$ mtc mirror -p mirror update
574+
```

0 commit comments

Comments
 (0)