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