差異處
這裏顯示兩個版本的差異處。
| 兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
| tech:openssl_cacrl [2008/08/21 18:23] – jonathan | tech:openssl_cacrl [2008/08/22 14:37] (目前版本) – jonathan | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| + | ====== OpenSSL 廢止憑證方式 ====== | ||
| + | ===== - 修改 openssl.cnf 參數檔 ===== | ||
| + | * openssl.cnf 參數檔 : / | ||
| + | * 建立自己的憑證參數 Exp. CA_trysoft | ||
| + | ++++ 看修改 openssl.cnf 內容| | ||
| + | < | ||
| + | : | ||
| + | [ca] | ||
| + | default_ca | ||
| + | trysoft_ca | ||
| + | : | ||
| + | [ CA_trysoft ] | ||
| + | |||
| + | dir = / | ||
| + | certs = $dir/ | ||
| + | crl_dir | ||
| + | database | ||
| + | new_certs_dir | ||
| + | certificate | ||
| + | serial | ||
| + | crlnumber | ||
| + | # must be commented out to leave a V1 CRL | ||
| + | crl = $dir/ | ||
| + | private_key | ||
| + | RANDFILE | ||
| + | |||
| + | x509_extensions = usr_cert | ||
| + | |||
| + | # Comment out the following two lines for the " | ||
| + | # (and highly broken) format. | ||
| + | name_opt | ||
| + | cert_opt | ||
| + | |||
| + | # Extension copying option: use with caution. | ||
| + | # copy_extensions = copy | ||
| + | |||
| + | # Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs | ||
| + | # so this is commented out by default to leave a V1 CRL. | ||
| + | # crlnumber must also be commented out to leave a V1 CRL. | ||
| + | # crl_extensions | ||
| + | |||
| + | default_days | ||
| + | default_crl_days= 30 # how long before next CRL | ||
| + | default_md | ||
| + | preserve | ||
| + | |||
| + | # A few difference way of specifying how similar the request should look | ||
| + | # For type CA, the listed attributes must be the same, and the optional | ||
| + | # and supplied fields are just that :-) | ||
| + | policy | ||
| + | : | ||
| + | : | ||
| + | [ req ] | ||
| + | default_bits | ||
| + | : | ||
| + | [ req_distinguished_name ] | ||
| + | : | ||
| + | countryName_default | ||
| + | : | ||
| + | stateOrProvinceName_default | ||
| + | : | ||
| + | localityName_default | ||
| + | : | ||
| + | </ | ||
| + | ++++ | ||
| + | * 將 **[[tech: | ||
| + | < | ||
| + | / | ||
| + | |-- RootCA.crt | ||
| + | |-- RootCA.srl | ||
| + | |-- certs | ||
| + | | |-- ClientCA.crt | ||
| + | |-- crl | ||
| + | |-- jonathan | ||
| + | | |-- ClientCA.crt | ||
| + | | |-- ClientCA.key | ||
| + | | |-- ClientCA.pem | ||
| + | | `-- ClientCA.pfx | ||
| + | |-- mail.ichiayi.com | ||
| + | | |-- ServerCA.crt | ||
| + | | `-- ServerCA.key | ||
| + | |-- newcerts | ||
| + | `-- private | ||
| + | `-- RootCA.key | ||
| + | </ | ||
| + | |||
| + | ===== - 產生設定檔內相關檔案 ===== | ||
| + | <code sh> | ||
| + | cd / | ||
| + | touch index.txt | ||
| + | cp RootCA.srl CRL.srl | ||
| + | </ | ||
| + | |||
| + | ===== - 測試進行廢止 ClientCA ===== | ||
| + | * 廢止以下這個憑證 | ||
| + | < | ||
| + | / | ||
| + | |-- certs | ||
| + | |-- ClientCA.crt | ||
| + | </ | ||
| + | |||
| + | <code sh> | ||
| + | cd / | ||
| + | openssl ca -name CA_trysoft -revoke ClientCA.crt | ||
| + | </ | ||
| + | ++++看執行結果| | ||
| + | < | ||
| + | [jonathan@pd920 certs]$ openssl ca -name CA_trysoft -revoke ClientCA.crt | ||
| + | Using configuration from / | ||
| + | Enter pass phrase for / | ||
| + | Adding Entry with serial number E0B893FC9733381E to DB for / | ||
| + | Revoking Certificate E0B893FC9733381E. | ||
| + | Data Base Updated | ||
| + | </ | ||
| + | ++++ | ||
| + | |||
| + | ===== - 產生 CRL 檔 trysoft.crl ===== | ||
| + | <code sh> | ||
| + | cd / | ||
| + | openssl ca -name CA_trysoft -gencrl -out trysoft.crl | ||
| + | </ | ||
| + | ++++看執行結果| | ||
| + | < | ||
| + | [jonathan@pd920 certs]$ cd / | ||
| + | [jonathan@pd920 crl]$ openssl ca -name CA_trysoft -gencrl -out trysoft.crl | ||
| + | Using configuration from / | ||
| + | Enter pass phrase for / | ||
| + | </ | ||
| + | ++++ | ||
| + | * 要轉成 DER 格式可執行以下命令< | ||
| + | openssl crl -in trysoft.crl -outform DER -out trysoft.crl | ||
| + | </ | ||
| + | |||
| + | ===== - 執行後檔案目錄結果 ===== | ||
| + | < | ||
| + | / | ||
| + | |-- CRL.srl | ||
| + | |-- CRL.srl.old | ||
| + | |-- RootCA.crt | ||
| + | |-- RootCA.srl | ||
| + | |-- certs | ||
| + | | |-- ClientCA.crt | ||
| + | |-- crl | ||
| + | | `-- trysoft.crl | ||
| + | |-- index.txt | ||
| + | |-- index.txt.attr | ||
| + | |-- index.txt.attr.old | ||
| + | |-- index.txt.old | ||
| + | |-- jonathan | ||
| + | | |-- ClientCA.crt | ||
| + | | |-- ClientCA.key | ||
| + | | |-- ClientCA.pem | ||
| + | | `-- ClientCA.pfx | ||
| + | |-- mail.ichiayi.com | ||
| + | | |-- ServerCA.crt | ||
| + | | `-- ServerCA.key | ||
| + | |-- newcerts | ||
| + | `-- private | ||
| + | `-- RootCA.key | ||
| + | </ | ||
| + | |||
| + | | {{: | ||
| + | |||
| + | ===== 參考網址 ===== | ||
| + | * http:// | ||
| + | |||
| + | {{tag>ca openssl crl pki}} | ||