| 1 |
To create CRLs, first create the CA and the server/client certs: |
| 2 |
|
| 3 |
# cert-tool --create-ca=crl-ca --signing-ca=self --combined \ |
| 4 |
--days-valid 3650 |
| 5 |
|
| 6 |
# cert-tool --create-cert=crl-server-cert --signing-ca=crl-ca.pem \ |
| 7 |
--signing-key=crl-ca.pem --combined --days-valid 3650 |
| 8 |
|
| 9 |
# cert-tool --create-cert=crl-client-cert --signing-ca=crl-ca.pem \ |
| 10 |
--signing-key=crl-ca.pem --combined --days-valid 3650 |
| 11 |
|
| 12 |
To create the crl-ca-revoked.pem file in this directory, I used the following |
| 13 |
OpenSSL command: |
| 14 |
|
| 15 |
# openssl ca -config ./etc/cert-tool.conf -revoke crl-ca.pem \ |
| 16 |
-cert crl-ca.pem -keyfile crl-ca.pem -crl_reason keyCompromise \ |
| 17 |
-crldays 3650 |
| 18 |
|
| 19 |
Note that you will need to set the following environment variables for the |
| 20 |
above 'openssl ca' command to succeed; the cert-tool.conf relies heavily |
| 21 |
on environment variables: |
| 22 |
|
| 23 |
CERT_TOOL_HOME |
| 24 |
CERT_TOOL_DAYS_VALID |
| 25 |
CERT_TOOL_KEY_LEN |
| 26 |
CERT_TOOL_COMMON_NAME |
| 27 |
CERT_TOOL_ALT_DNS |
| 28 |
CERT_TOOL_ALT_EMAIL |
| 29 |
CERT_TOOL_ALT_IP |
| 30 |
CERT_TOOL_ALT_URI |
| 31 |
|
| 32 |
For example: |
| 33 |
|
| 34 |
# CERT_TOOL_HOME=`pwd` CERT_TOOL_DAYS_VALID=3650 CERT_TOOL_KEY_LEN=1024 CERT_TOOL_COMMON_NAME=crl-ca CERT_TOOL_ALT_DNS=www.castaglia.org [email protected] CERT_TOOL_ALT_IP=127.0.0.1 CERT_TOOL_ALT_URI=http://www.castaglia.org/proftpd openssl ca -config ./etc/cert-tool.conf -revoke crl-ca.pem -cert crl-ca.pem -keyfile crl-ca.pem -crl_reason keyCompromise -crldays 3650 |
| 35 |
|
| 36 |
Then to issue the CRL: |
| 37 |
|
| 38 |
# openssl ca -gencrl -cert crl-ca.pem -keyfile crl-ca.pem \ |
| 39 |
-out crl-ca-revoked.pem |
| 40 |
|
| 41 |
Note that the above command may fail like so: |
| 42 |
|
| 43 |
# openssl ca -gencrl -cert crl-ca.pem -keyfile crl-ca.pem \ |
| 44 |
-out crl-ca-revoked.pem |
| 45 |
Using configuration from /usr/lib/ssl/openssl.cnf |
| 46 |
./demoCA/index.txt: No such file or directory |
| 47 |
unable to open './demoCA/index.txt' |
| 48 |
20415:error:02001002:system library:fopen:No such file or directory:bss_file.c:352:fopen('./demoCA/index.txt','r') |
| 49 |
20415:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:354: |
| 50 |
|
| 51 |
Which suggests that using the cert-tool.conf is again necessary: |
| 52 |
|
| 53 |
# CERT_TOOL_HOME=`pwd` CERT_TOOL_DAYS_VALID=3650 CERT_TOOL_KEY_LEN=1024 CERT_TOOL_COMMON_NAME=crl-ca CERT_TOOL_ALT_DNS=www.castaglia.org [email protected] CERT_TOOL_ALT_IP=127.0.0.1 CERT_TOOL_ALT_URI=http://www.castaglia.org/proftpd openssl ca -config ./etc/cert-tool.conf -gencrl -cert crl-ca.pem -keyfile crl-ca.pem -out crl-ca-revoked.pem |
| 54 |
Using configuration from ./etc/cert-tool.conf |
| 55 |
cannot lookup how long until the next CRL is issued |
| 56 |
20417:error:0E06D06C:configuration file routines:NCONF_get_string:no value:conf_lib.c:329:group=cert_tool_ca name=crlnumber |
| 57 |
20417:error:0E06D06C:configuration file routines:NCONF_get_string:no value:conf_lib.c:329:group=cert_tool_ca name=default_crl_days |
| 58 |
20417:error:0E06D06C:configuration file routines:NCONF_get_string:no value:conf_lib.c:329:group=cert_tool_ca name=default_crl_hours |
| 59 |
|
| 60 |
Had to fix the cert-tool and its config file, but finally was able to issue the CRL: |
| 61 |
|
| 62 |
# CERT_TOOL_HOME=`pwd` CERT_TOOL_DAYS_VALID=3650 CERT_TOOL_KEY_LEN=1024 CERT_TOOL_COMMON_NAME=crl-ca CERT_TOOL_ALT_DNS=www.castaglia.org [email protected] CERT_TOOL_ALT_IP=127.0.0.1 CERT_TOOL_ALT_URI=http://www.castaglia.org/proftpd openssl ca -config ./etc/cert-tool.conf -gencrl -cert crl-ca.pem -keyfile crl-ca.pem -out crl-ca-revoked.pem |
| 63 |
Using configuration from ./etc/cert-tool.conf |
| 64 |
|
| 65 |
XXX Looks like I need to add --revoke-cert/--revoke-ca options to cert-tool, |
| 66 |
XXX and --create-crl |
| 67 |
XXX |
| 68 |
XXX To generate a cert with an AuthorityInfoAccess (AIA) attribute, use: |
| 69 |
XXX |
| 70 |
XXX authorityInfoAcces = OCSP;URI:http://localhost:7777 |
| 71 |
XXX |
| 72 |
XXX in the 'cert_tool_x509_ext' config section. |
| 73 |
|
| 74 |
To generate CAs for OCSP testing, I added support for the AIA OCSP attribute |
| 75 |
in both CAs and certs. For testing HTTPS OCSP responders, I had to manually |
| 76 |
tweak the cert-tool code so that the default OCSP responder URL was HTTPS. |
| 77 |
Then: |
| 78 |
|
| 79 |
CERT_TOOL_HOME=`pwd` ./cert-tool --create-ca=ocsp-https-ca --signing-ca=self --combined --days-valid 3650 |
| 80 |
CERT_TOOL_HOME=`pwd` ./cert-tool --create-cert=ocsp-https-server --signing-ca=ocsp-https-ca.pem --signing-key=ocsp-https-ca.pem --combined --days-valid 3650 |
| 81 |
CERT_TOOL_HOME=`pwd` ./cert-tool --create-cert=ocsp-https-client --signing-ca=ocsp-https-ca.pem --signing-key=ocsp-https-ca.pem --combined --days-valid 3650 |
| 82 |
|
| 83 |
For running OpenSSL's ocsp(1) as a responder, I use: |
| 84 |
|
| 85 |
cd cert-tool/ |
| 86 |
openssl ocsp -index etc/cert-tool.index -CA ocsp-ca.pem \ |
| 87 |
-rsigner ocsp-ca.pem -url http://localhost:7777 -ignore_err |
| 88 |
|
| 89 |
And for testing the ocsp(1) as a client: |
| 90 |
|
| 91 |
cd cert-tool/ |
| 92 |
openssl ocsp -issuer ocsp-ca.pem -cert ocsp-ca.pem -nonce -text \ |
| 93 |
-url http://localhost:7777 -CAfile ocsp-ca.pem |
| 94 |
|
| 95 |
Keep in mind the following: |
| 96 |
|
| 97 |
1. OpenSSL-1.0.0 apps bind to IPv6 _only_ sockets by default (should |
| 98 |
hopefully be fixed in future versions). |
| 99 |
|
| 100 |
2. OpenSSL ocsp(1) responder does NOT support HTTPS, only HTTP. |
| 101 |
|
| 102 |
To create the .p12 (PKCS#12) file in this directory, I used the following |
| 103 |
OpenSSL command: |
| 104 |
|
| 105 |
# openssl pkcs12 -export -in server-cert.cert.pem \ |
| 106 |
-inkey server-cert.key.pem \ |
| 107 |
-out server-cert.p12 \ |
| 108 |
-name "ProFTPD PKCS12" |
| 109 |
|
| 110 |
When prompted for a password, leave it blank (i.e. just hit enter). |
| 111 |
|
| 112 |
To create the client-cert-localhost.pem file in this directory, I used: |
| 113 |
|
| 114 |
# cert-tool --days-valid=3650 --common-name=localhost --combined \ |
| 115 |
--create-cert=client-cert-localhost \ |
| 116 |
--signing-ca=ca-cert.pem --signing-key=ca-cert.pem |
| 117 |
|
| 118 |
To create the password-protected server cert server-cert-passwd.pem in this |
| 119 |
directory, I used: |
| 120 |
|
| 121 |
# cert-tool --days-valid=3650 --combined --key-cipher aes128 \ |
| 122 |
--create-cert=server-cert-passwd \ |
| 123 |
--signing-ca=ca-cert.pem --signing-key=ca-cert.pem |
| 124 |
|
| 125 |
The passphrase is "password". |
| 126 |
|
| 127 |
To create the DSA cert, I used: |
| 128 |
|
| 129 |
# CERT_TOOL_USE_DSA=1 ./cert-tool --create-ca=dsa-server-cert --combined --signing-ca=dsa-ca.pem --signing-key=dsa-ca.pem --verbose --key-length=512 |
| 130 |
|
| 131 |
NOTE: the --key-length=512 is important. By default, cert-tool creates keys |
| 132 |
of 1024 bits; this turns out to be too large for DSA keys for OpenSSL. |
| 133 |
|
| 134 |
To create an EC cert, I used: |
| 135 |
|
| 136 |
# cert-tool --create-ca=ec-ca --combined --signing-ca=self \ |
| 137 |
--verbose --key-cipher curve:secp256k1 --days-valid 3650 |
| 138 |
# cert-tool --create-cert=ec-server-cert --combined --signing-ca=ec-ca.pem \ |
| 139 |
--signing-key=ec-ca.pem --verbose --key-cipher= curve:secp256k1 \ |
| 140 |
--days-valid 3650 |
| 141 |
|
| 142 |
The passphrase is "password". |