Debian Codegraph @

testing/pluto/nss-cert-11-ca-expired-responder-1conn-ikev2/east.console.txt

raw
1 /testing/guestbin/swan-prep --nokeys
2 Creating empty NSS database
3 east #
4 # Generate two CA and certificate pairs:
5 east #
6 #
7 east #
8 # new-ca+new-west: the CA is valid for twelve months back-dated by two
9 east #
10 # months (-w 2 -v 12); same for the certificate (i.e., valid now and
11 east #
12 # 45 days ago).
13 east #
14 #
15 east #
16 # old-ca+old-west: this time the CA expired a month ago (-w -13 -v 12)
17 east #
18 # and use this to sign a cert that is still valid (just) (-w -11 -v
19 east #
20 # 12) (i.e., both are valid 45 days ago, and cert can't be verified).
21 east #
22 ipsec certutil -m 1 -S -k rsa -x -w -2 -n new-ca -s CN=new-ca -v 12 -t CT,C,C -z ipsec.conf
23 Generating key. This may take a few moments...
24 east #
25 ipsec certutil -m 2 -S -k rsa -c new-ca -n new-west -s CN=new-west -v 12 -t u,u,u -z ipsec.conf
26 Generating key. This may take a few moments...
27 Notice: Trust flag u is set automatically if the private key is present.
28 east #
29 ipsec certutil -m 1 -S -k rsa -x -w -13 -v 12 -n old-ca -s CN=old-ca -v 12 -t CT,C,C -z ipsec.conf
30 Generating key. This may take a few moments...
31 east #
32 ipsec certutil -m 2 -S -k rsa -c old-ca -w -11 -n old-west -s CN=old-west -v 12 -t u,u,u -z ipsec.conf
33 Generating key. This may take a few moments...
34 Notice: Trust flag u is set automatically if the private key is present.
35 east #
36 # Export the certs old-west and new-west both as p12s and as .crts
37 east #
38 # (the latter is fed to verify) and then delete them so that the peer
39 east #
40 # has to include them in the IKE_AUTH request.
41 east #
42 ipsec pk12util -W secret -o OUTPUT/new-west.p12 -n new-west
43 pk12util: PKCS12 EXPORT SUCCESSFUL
44 east #
45 ipsec pk12util -W secret -o OUTPUT/old-west.p12 -n old-west
46 pk12util: PKCS12 EXPORT SUCCESSFUL
47 east #
48 ipsec certutil -L -n new-west -a > OUTPUT/new-west.crt
49 east #
50 ipsec certutil -L -n old-west -a > OUTPUT/old-west.crt
51 east #
52 ipsec certutil -F -n new-west
53 east #
54 ipsec certutil -F -n old-west
55 east #
56 # Use ipsec vfychain to confirm the above settings
57 east #
58 #
59 east #
60 # -p -p engages the new PKIX interface that pluto is using.
61 east #
62 #
63 east #
64 # -u 12 -> 1<<12 is #define certificateUsageIPsec (0x1000)
65 east #
66 #
67 east #
68 # -b YYMMDDHHMMZ (yea, CC is magic)
69 east #
70 #
71 east #
72 # THEN is 45 days ago which is when everything was valid (just before
73 east #
74 # old-ca expires).
75 east #
76 NOW=$(date +%s)
77 east #
78 THEN=$((${NOW} - 45 * 24 * 60 * 60))
79 east #
80 VFYDATE=$(date -d @${THEN} +%y%m%d000000Z)
81 east #
82 ipsec vfychain -v -u 12 -p -p -a OUTPUT/new-west.crt
83 Chain is good!
84 Root Certificate Subject:: "CN=new-ca"
85 Certificate 1 Subject: "CN=new-west"
86 east #
87 ! ipsec vfychain -v -u 12 -p -p -b ${VFYDATE} -a OUTPUT/new-west.crt
88 Chain is bad!
89 PROBLEM WITH THE CERT CHAIN:
90 CERT 0. CN=new-west :
91 ERROR -8181: Peer's Certificate has expired.
92 east #
93 ! ipsec vfychain -v -u 12 -p -p -a OUTPUT/old-west.crt
94 Chain is bad!
95 PROBLEM WITH THE CERT CHAIN:
96 CERT 0. CN=old-west :
97 ERROR -8179: Peer's Certificate issuer is not recognized.
98 CN=old-ca
99 east #
100 ipsec vfychain -v -u 12 -p -p -b ${VFYDATE} -a OUTPUT/old-west.crt
101 Chain is good!
102 Root Certificate Subject:: "CN=old-ca"
103 Certificate 1 Subject: "CN=old-west"
104 east #
105 # Import the cert
106 east #
107 ipsec pk12util -i OUTPUT/east.p12 -W secret
108 pk12util: PKCS12 IMPORT SUCCESSFUL
109 east #
110 # now get going
111 east #
112 ipsec start
113 Redirecting to: [initsystem]
114 east #
115 ../../guestbin/wait-until-pluto-started
116 east #
117 ipsec auto --add east
118 "east": WARNING: left is a groundhog
119 "east": added IKEv2 connection
120 east #
121