blob: 6c706fd83666321fa41f5573b4b845f04d95e0cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/bin/sh
set -o nounset
set -o errexit
SOFTHSM=/usr/local/bin/softhsm2-util
top_srcdir=$(cd $(dirname $0)/../..; pwd)
. ${top_srcdir}/test/scripts/testutils.sh
createca () {
mkdir httpsca
( cd httpsca ; \
mkdir -p demoCA/newcerts ; \
touch demoCA/index.txt ; \
echo 00 > demoCA/serial ; \
echo '[ req ]' > caconfig.txt ; \
echo 'distinguished_name = req_distinguished_name' >> caconfig.txt ; \
echo 'x509_extensions = v3_ca' >> caconfig.txt ; \
echo 'string_mask = utf8only' >> caconfig.txt ; \
echo '[ req_distinguished_name ]' >> caconfig.txt ; \
echo '[ v3_ca ]' >> caconfig.txt ; \
echo 'basicConstraints=CA:true' >> caconfig.txt ; \
openssl req -newkey rsa:2048 -keyout key.pem -out req.csr -nodes -subj '/countryName=SE/stateOrProvinceName=Stockholm/organizationName=Test/commonName=ca/O=ca' -config caconfig.txt ; \
openssl ca -in req.csr -selfsign -keyfile key.pem -out demoCA/cacert.pem -batch \
)
}
createcert () {
mkdir httpscert
openssl req -new -newkey rsa:2048 -keyout httpscert/httpskey-1.pem -out httpsca/httpscert-1.csr -nodes -subj '/countryName=SE/stateOrProvinceName=Stockholm/organizationName=Test/CN=localhost'
( cd httpsca ; \
openssl ca -in httpscert-1.csr -keyfile key.pem -out httpscert-1.pem -batch \
)
cp httpsca/httpscert-1.pem httpscert/
}
createca
createcert
mkdir keys
(cd keys ; ${top_srcdir}/tools/create-key.sh logkey)
openssl pkcs8 -topk8 -nocrypt -in keys/logkey-private.pem -out keys/logkey-private.pkcs8
mkdir mergedb
touch mergedb/logorder
mkdir mergedb-secondary
touch mergedb-secondary/logorder
printf 0 > mergedb-secondary/verifiedsize
mkdir known_roots
cp ${top_srcdir}/tools/testcerts/roots/* known_roots
mkdir privatekeys
for node in ${NODES}; do \
(cd privatekeys ; ${top_srcdir}/tools/create-key.sh ${node})
mkdir -p nodes/${node}/log
done
${top_srcdir}/tools/genconfig.sh ${top_srcdir}/test/catlfish-test.cfg.in privatekeys keys/logkey.pem httpsca/demoCA/cacert.pem ${top_srcdir}/test/logadminkey-private.pem catlfish-test-generated.cfg
for machine in ${MACHINES}; do \
mkdir -p machine/machine-${machine}/db
cp ${top_srcdir}/test/catlfish-test-local-${machine}.cfg machine/machine-${machine}/
${top_srcdir}/tools/getconfig.py --localconfig machine/machine-${machine}/catlfish-test-local-${machine}.cfg --dest machine/machine-${machine}/catlfish-test.cfg
${top_srcdir}/tools/compileconfig.py --config machine/machine-${machine}/catlfish-test.cfg --localconfig machine/machine-${machine}/catlfish-test-local-${machine}.cfg
touch machine/machine-${machine}/db/index && touch machine/machine-${machine}/db/newentries
done
mkdir -p machine/merge
cp ${top_srcdir}/test/catlfish-test-local-merge.cfg machine/merge/
${top_srcdir}/tools/getconfig.py --localconfig machine/merge/catlfish-test-local-merge.cfg --dest machine/merge/catlfish-test.cfg
${top_srcdir}/tools/compileconfig.py --config machine/merge/catlfish-test.cfg --localconfig machine/merge/catlfish-test-local-merge.cfg
mkdir -p machine/merge-2
cp ${top_srcdir}/test/catlfish-test-local-merge-2.cfg machine/merge-2/
${top_srcdir}/tools/getconfig.py --localconfig machine/merge-2/catlfish-test-local-merge-2.cfg --dest machine/merge-2/catlfish-test.cfg
${top_srcdir}/tools/compileconfig.py --config machine/merge-2/catlfish-test.cfg --localconfig machine/merge-2/catlfish-test-local-merge-2.cfg
mkdir -p machine/signing
cp ${top_srcdir}/test/catlfish-test-local-signing.cfg machine/signing/
${top_srcdir}/tools/getconfig.py --localconfig machine/signing/catlfish-test-local-signing.cfg --dest machine/signing/catlfish-test.cfg
${top_srcdir}/tools/compileconfig.py --config machine/signing/catlfish-test.cfg --localconfig machine/signing/catlfish-test-local-signing.cfg
test -x ${SOFTHSM} && ${SOFTHSM} --init-token --slot=0 --label=mylabel --so-pin=ffff --pin=ffff || true
test -x ${SOFTHSM} && ${SOFTHSM} --import keys/logkey-private.pkcs8 --slot 0 --label mylabel --pin ffff --id 00 || true
|