blob: f381849681c444aeac56ba158e44aad60637a1d7 (
plain) (
blame)
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
81
82
83
84
85
86
87
88
89
90
|
#!/bin/sh -
# $Id$
#
# Script to test against testroot.py.
#
# This blows away rpkid's database and rebuilds it with what we need
# for this test, and knows far too much about the id numbers that
# rpkid and mysql will assign. In the long run we must do better than
# this, but gotta start somewhere.
openssl=../openssl/openssl/apps/openssl
# Halt on first error
set -e
# Generate new key and cert for testroot.py if needed
if test ! -r testroot.cer -o ! -r testroot.key
then
$openssl req -new -newkey rsa:2048 -nodes -keyout testroot.key -out testroot.req -config testroot.cnf
$openssl x509 -req -in testroot.req -out testroot.cer -extfile testroot.cnf -extensions req_x509_ext -signkey testroot.key -text -sha256
rm -f testroot.req
fi
# Blow away old rpkid database (!) so we can start clean
mysql -u rpki -p`awk '$1 == "sql-password" {print $3}' rpkid.conf` rpki <../docs/rpki-db-schema.sql
# Start rpkid so we can configure it, make sure we shut it down on exit
python rpkid.py & rpkid=$!
trap "kill $rpkid" 0
# Create a self instance
python irbe-cli.py self --action create --crl_interval 84600
# Create a business signing context, issue the necessary business cert, and set up the cert chain
python irbe-cli.py --pem_out bsc.req bsc --action create --self_id 1 --generate_keypair --signing_cert biz-certs/Bob-CA.cer
$openssl x509 -req -in bsc.req -out bsc.cer -CA biz-certs/Bob-CA.cer -CAkey biz-certs/Bob-CA.key -CAserial biz-certs/Bob-CA.srl
python irbe-cli.py bsc --action set --self_id 1 --bsc_id 1 --signing_cert bsc.cer
rm -f bsc.req bsc.cer
# Create a repository context
python irbe-cli.py repository --self_id 1 --action create --bsc_id 1
# Create a parent context pointing at testroot.py
python irbe-cli.py parent --self_id 1 --action create --bsc_id 1 --repository_id 1 \
--peer_contact_uri https://localhost:44333/ \
--cms_ta biz-certs/Elena-Root.cer \
--https_ta biz-certs/Elena-Root.cer \
--sia_base rsync://wombat.invalid/
# Create a child context -- note that we're using the -CA as trust anchor rather than -Root,
# because the APNIC poke tool doesn't offer any way to construct CMS chains
python irbe-cli.py child --self_id 1 --action create --bsc_id 1 --cms_ta biz-certs/Frank-Root.cer
# Need to link irdb to created child. For now, just do this manually in MySQL CLI:
#
# UPDATE registrant SET rpki_self_id = 1, rpki_child_id = 1 WHERE subject_name = "Epilogue Technology Corporation"
if test "$1" = "run"
then
rm -rf publication
python testroot.py & testroot=$!
python irdb.py & irdb=$!
trap "kill $rpkid $irdb $testroot" 0
python http-client.py
python testpoke.py -r list
python testpoke.py -r issue
python http-client.py
python testpoke.py -r list
python testpoke.py -r issue
python testpoke.py -r issue |
qh |
sed -n '/^(certificate/,/^)certificate/s/^-//p' |
mimencode -u |
$openssl x509 -noout -inform DER -text
fi
|