|
2 | 2 |
|
3 | 3 | ## Prerequisites
|
4 | 4 | You'll need to have a VM running in the same GCP project that you can SSH to,
|
5 |
| -with Go installed. |
| 5 | +with Go installed, and your favourite terminal multiplexer. |
6 | 6 |
|
7 | 7 | ## Overview
|
8 | 8 |
|
@@ -35,8 +35,89 @@ Terraforming the project can be done by:
|
35 | 35 | 2. Run `terragrunt apply`
|
36 | 36 |
|
37 | 37 | ## Run the SCTFE
|
| 38 | +### With fake chains |
38 | 39 |
|
39 |
| -On the VM, run the following command: |
| 40 | +On the VM, run the following command to bring up the SCTFE: |
40 | 41 | ```bash
|
41 | 42 | go run ./cmd/gcp/ --project_id=${GOOGLE_PROJECT} --bucket=${GOOGLE_PROJECT}-${TESSERA_BASE_NAME}-bucket --spanner_db_path=projects/${GOOGLE_PROJECT}/instances/${TESSERA_BASE_NAME}/databases/${TESSERA_BASE_NAME}-db --spanner_db_path=projects/${GOOGLE_PROJECT}/instances/${TESSERA_BASE_NAME}/databases/${TESSERA_BASE_NAME}-dedup-db --private_key=./testdata/ct-http-server.privkey.pem --password=dirk --roots_pem_file=./testdata/fake-ca.cert --origin=${TESSERA_BASE_NAME}
|
42 | 43 | ```
|
| 44 | + |
| 45 | +In a different terminal you can either mint and submit certificates manually, or |
| 46 | +use the [ct_hammer |
| 47 | +tool](https://github.com/google/certificate-transparency-go/blob/master/trillian/integration/ct_hammer/main.go) |
| 48 | +to do this. |
| 49 | + |
| 50 | +#### Generate chains manually |
| 51 | +First, save the SCTFE repo's path: |
| 52 | + |
| 53 | +```bash |
| 54 | +export SCTFE_REPO=$(pwd) |
| 55 | +``` |
| 56 | + |
| 57 | +Clone the [certificate-transparency-go](https://github.com/google/certificate-transparency-go) repo. |
| 58 | +Then, generate a chain manually. The password for the private key is `gently`: |
| 59 | + |
| 60 | +```bash |
| 61 | +mkdir -p /tmp/httpschain |
| 62 | +openssl genrsa -out /tmp/httpschain/cert.key 2048 |
| 63 | +openssl req -new -key /tmp/httpschain/cert.key -out /tmp/httpschain/cert.csr -config=${SCTFE_REPO}/testdata/fake-ca.cfg |
| 64 | +openssl x509 -req -days 3650 -in /tmp/httpschain/cert.csr -CAkey ${SCTFE_REPO}/testdata/fake-ca.privkey.pem -CA ${SCTFE_REPO}/testdata/fake-ca.cert -outform pem -out /tmp/httpschain/chain.pem -provider legacy -provider default |
| 65 | +cat ${SCTFE_REPO}/testdata/fake-ca.cert >> /tmp/httpschain/chain.pem |
| 66 | +``` |
| 67 | + |
| 68 | +Finally, submit the chain to the SCTFE: |
| 69 | + |
| 70 | +```bash |
| 71 | +go run ./client/ctclient upload --cert_chain=/tmp/httpschain/chain.pem --skip_https_verify --log_uri=http://localhost:6962/${TESSERA_BASE_NAME} |
| 72 | +``` |
| 73 | + |
| 74 | +#### Automatically generate chains |
| 75 | +Save the SCTFE repo's path: |
| 76 | + |
| 77 | +```bash |
| 78 | +export SCTFE_REPO=$(pwd) |
| 79 | +``` |
| 80 | + |
| 81 | +Clone the [certificate-transparency-go](https://github.com/google/certificate-transparency-go) repo, and from there run: |
| 82 | + |
| 83 | +```bash |
| 84 | +go run ./trillian/integration/ct_hammer/ --ct_http_servers=localhost:6962/${TESSERA_BASE_NAME} --max_retry=2m --invalid_chance=0 --get_sth=0 --get_sth_consistency=0 --get_proof_by_hash=0 --get_entries=0 --get_roots=0 --get_entry_and_proof=0 --max_parallel_chains=4 --skip_https_verify=true --operations=10000 --rate_limit=150 --log_config=${SCTFE_REPO}/testdata/hammer.cfg --testdata_dir=./trillian/testdata/ |
| 85 | +``` |
| 86 | + |
| 87 | +### With real HTTPS certificates |
| 88 | +We'll run a SCTFE and copy certificates from an existing RFC6962 log to it. |
| 89 | +It uses the [ct_hammer tool from certificate-transparency-go](https://github.com/google/certificate-transparency-go/tree/aceb1d4481907b00c087020a3930c7bd691a0110/trillian/integration/ct_hammer). |
| 90 | + |
| 91 | +First, set a few environment variables: |
| 92 | + |
| 93 | +```bash |
| 94 | +export SCTFE_REPO=$(pwd) |
| 95 | +export SRC_LOG_URI=https://ct.googleapis.com/logs/xenon2022 |
| 96 | +``` |
| 97 | + |
| 98 | +Then, get fetch the roots the source logs accepts, and edit configs accordingly. |
| 99 | +To do so, clone the [certificate-transparency-go](https://github.com/google/certificate-transparency-go) repo, and from there run: |
| 100 | + |
| 101 | +```bash |
| 102 | +export CTGO_REPO=$(pwd) |
| 103 | +mkdir -p /tmp/hammercfg |
| 104 | +cp ${SCTFE_REPO}/testdata/hammer.cfg /tmp/hammercfg |
| 105 | +go run ./client/ctclient get-roots --log_uri=${SRC_LOG_URI} --text=false > /tmp/hammercfg/roots.pem |
| 106 | +sed -i 's-""-"/tmp/hammercfg/roots.pem"-g' /tmp/hammercfg/hammer.cfg |
| 107 | +``` |
| 108 | + |
| 109 | + |
| 110 | +Run the SCTFE with the same roots: |
| 111 | + |
| 112 | +```bash |
| 113 | +cd ${SCTFE_REPO} |
| 114 | +go run ./cmd/gcp/ --project_id=${GOOGLE_PROJECT} --bucket=${GOOGLE_PROJECT}-${TESSERA_BASE_NAME}-bucket --spanner_db_path=projects/${GOOGLE_PROJECT}/instances/${TESSERA_BASE_NAME}/databases/${TESSERA_BASE_NAME}-db --private_key=./testdata/ct-http-server.privkey.pem --password=dirk --roots_pem_file=/tmp/hammercfg/roots.pem --origin=${TESSERA_BASE_NAME} --spanner_dedup_db_path=projects/${GOOGLE_PROJECT}/instances/${TESSERA_BASE_NAME}/databases/${TESSERA_BASE_NAME}-dedup-db -v=3 |
| 115 | +``` |
| 116 | + |
| 117 | +Run `ct_hammer` in a different terminal: |
| 118 | + |
| 119 | +```bash |
| 120 | +cd ${CTGO_REPO} |
| 121 | +go run ./trillian/integration/ct_hammer/ --ct_http_servers=localhost:6962/${TESSERA_BASE_NAME} --max_retry=2m --invalid_chance=0 --get_sth=0 --get_sth_consistency=0 --get_proof_by_hash=0 --get_entries=0 --get_roots=0 --get_entry_and_proof=0 --max_parallel_chains=4 --skip_https_verify=true --operations=10000 --rate_limit=150 --log_config=/tmp/hammercfg/hammer.cfg --src_log_uri=${SRC_LOG_URI} |
| 122 | +``` |
| 123 | + |
0 commit comments