5.6. 一括発行の実行
状況によっては、管理者が大量の証明書を同時に送信および生成する必要があることもあります。Certificate System で提供されるツールの組み合わせを使用して、証明書要求を含むファイルを CA に送信できます。この手順例では、要求を生成する PKCS10Client
コマンドと、CA に要求を送信する sslget
コマンドを使用します。
CA (ホスト、ポート)、および認証に使用される項目 (エージェント証明書、証明書データベース、パスワード) を識別するには、複数の変数が必要です。たとえば、これらの変数をエクスポートするには、以下を実行します。
export d=/var/tmp/testDir export p=password export f=/var/tmp/server.csr.txt export nick="PKI Administrator for example.test" export cahost=1.2.3.4 export caport=8443
# cat << EOF > ${d}/pwd.txt password EOF
自動証明書発行用の SSL クライアント証明書を持つエージェントの NSS データベースを作成します。
# pki -d ${d}-c ${p} client-init
以前の CA インストールから admin PKCS#12 ファイルをインポートします。
# pk12util -i ~/ca_admin_cert.p12 -d ${d}
CA 証明書をエクスポートします。
# pki-server cert-export ca_signing -i subca1 --cert-file ${d}/myca.crt
証明書をインポートします。
# pki -d ${d} -n "${nick}" -C ${d}/pwd.txt client-cert-import myCA --ca-cert ${d}/myca.crt
管理者証明書の信頼チェーンを確認します。
# certutil -O -d ${d}/ -n "PKI Administrator for example.test" "myCA" [CN=CA Signing Certificate,OU=subca1,O=Sub CA1 Example Test] "PKI Administrator for example.test" [CN=PKI Administrator,E=caadmin@example.test,OU=subca1,O=Sub CA1 Example Test]
ヘッダーとフッターが含まれる個別の CSR ファイルを作成します。
time for i in {1..10}; do /usr/bin/PKCS10Client -d ${d} -p ${p} -o ${f}.${i} -n "cn=testms${i}.example.test"; done
次の CSR ファイルを CA に順番に送信します。
tail -f /var/log/pki/subca1/ca/transactions & time for i in {1..10}; do pki -U https://${cahost}:${caport}/ca -d ${d} -n "${nick}" -C ${d}/pwd.txt ca-cert-request-submit --profile caAgentServerCert --csr-file ${f}.${i} ; done
5.6.1. Cisco ルーターでの証明書の登録
Cisco によって設計された Simple Certificate Enrollment Protocol (SCEP) は、ルーターが CA などの証明書発行機関と通信して、ルーターの証明書を登録するための方法です。
通常、ルーターインストーラーは CA の URL とチャレンジパスワード (ワンタイム PIN とも呼ばれます) をルーターに入力し、コマンドを発行して登録を開始します。次に、ルーターは SCEP を介して CA と通信し、証明書を生成、要求、および取得します。ルーターは、SCEP を使用して保留中の要求のステータスを確認することもできます。
5.6.2. SCEP 登録の有効化
セキュリティー上の理由から、SCEP 登録は CA でデフォルトで無効になっています。ルーターの登録を可能にするには、CA に対して SCEP 登録を手動で有効にする必要があります。
設定ファイルを編集できるように CA サーバーを停止します。
# pki-server stop instance_name
CA の
CS.cfg
ファイルを開きます。# vim /var/lib/pki/ instance_name/ca/conf/CS.cfg
ca.scep.enable
を true に設定します。パラメーターが存在しない場合は、パラメーターで行を追加します。ca.scep.enable=true
CA サーバーを起動します。
pki-server start instance_name
5.6.3. SCEP のセキュリティー設定
管理者は、登録認証と通常の証明書登録に同じ証明書を使用しない、または接続強度の低下を防ぐために許可された暗号化アルゴリズムを設定するなど、いくつかの異なるパラメーターを使用して、SCEP 接続に特定のセキュリティー要件を設定できます。これらのパラメーターは次の表にリストされています。
パラメーター | 説明 |
---|---|
ca.scep.encryptionAlgorithm | デフォルトまたは優先暗号化アルゴリズムを設定します。 |
ca.scep.allowedEncryptionAlgorithms | 許可される暗号化アルゴリズムのコンマ区切りリストを設定します。 |
ca.scep.hashAlgorithm | デフォルトまたは優先ハッシュアルゴリズムを設定します。 |
ca.scep.allowedHashAlgorithms | 許可されるハッシュアルゴリズムのコンマ区切りリストを設定します。 |
ca.scep.nickname | SCEP 通信に使用する証明書のニックネームを指定します。このパラメーターが設定されていない限り、デフォルトで CA のキーペアおよび証明書が使用されます。 |
ca.scep.nonceSizeLimit | SCEP リクエストに許可される最大 nonce サイズ (バイト単位) を設定します。デフォルトは 16 バイトです。 |
SCEP 登録の接続にセキュリティー設定を設定するには、以下を実行します。
設定ファイルを編集できるように CA サーバーを停止します。
# pki-server stop instance_name
CA の
CS.cfg
ファイルを開きます。# vim /var/lib/pki/ instance_name/ca/conf/CS.cfg
上記の表に記載されているように、必要なセキュリティーパラメーターを設定します。このパラメーターが存在しない場合は、
CS.cfg
ファイルに追加します。ca.scep.encryptionAlgorithm=DES3 ca.scep.allowedEncryptionAlgorithms=DES3 ca.scep.hashAlgorithm=SHA1 ca.scep.allowedHashAlgorithms=SHA1,SHA256,SHA512 ca.scep.nickname=Server-Cert ca.scep.nonceSizeLimit=20
CA サーバーを起動します。
pki-server start instance_name
5.6.4. SCEP 登録のルーターの設定
ルーター IOS の全バージョンには関連する暗号化機能があるわけではありません。ファームウェアイメージに認証局の相互運用性があることを確認します。Certificate System SCEP サポートは、IOS C2600 Software (C2600-JK9S-M), バージョン 12.2(40), RELEASE SOFTWARE (fc1) を実行している Cisco 2611 ルーターでテストされました。
ルーターに SCEP 証明書を登録する前に、ルーターが適切に設定されていることを確認します。
- ルーターは、IP アドレス、DNS サーバー、およびルーティング情報で設定する必要があります。
- ルーターの日付/時刻が正しく設定されている必要があります。
- ルーターのホスト名と dnsname を設定する必要があります。
ルーターのハードウェアの設定方法は、ルーターのドキュメントを参照してください。
5.6.5. ルーターの SCEP 証明書の生成
以下の手順では、ルーターの SCEP 証明書を生成する方法を説明します。
- ランダムな PIN を選択します。
ルーターが CA に対して直接認証できるように、PIN とルーターの ID を
flatfile.txt
ファイルに追加します。以下に例を示します。# vim /var/lib/pki/ instance_name/ca/conf/flatfile.txt UID:172.16.24.238 PWD:Uojs93wkfd0IS
必ず
PWD
行の後に空の行を挿入してください。ルーターの IP アドレスは、IPv4 アドレスまたは IPv6 アドレスになります。
フラットファイル認証の使用は、「フラットファイル認証の設定」 に記載されています。
ルーターのコンソールにログインします。以下の例では、ルーターの名前は
scep
です。scep>
特権コマンドを有効にします。
scep> enable
設定モードを入力します。
scep# conf t
root で始まり、証明書チェーン内のすべての CA に CA 証明書をインポートします。たとえば、次のコマンドシーケンスは、チェーン内の 2 つの CA 証明書をルーターにインポートします。
scep(config)# crypto ca trusted-root1 scep(ca-root)# root CEP http://server.example.com:8080/ca/cgi-bin/pkiclient.exe scep(ca-root)# crl optional scep(ca-root)# exit scep(config)# cry ca authenticate 1 scep(config)# crypto ca trusted-root0 scep(ca-root)# root CEP http://server.example.com:8080/ca/cgi-bin/pkiclient.exe scep(ca-root)# crl optional scep(ca-root)# exit scep(config)# cry ca authenticate 0
CA アイデンティティーを設定し、SCEP 登録プロファイルにアクセスするための URL を入力します。CA の場合の例を以下に示します。
scep(config)# crypto ca identity CA scep(ca-identity)# enrollment url http://server.example.com:8080/ca/cgi-bin scep(ca-identity)# crl optional
CA の証明書を取得します。
scep(config)# crypto ca authenticate CA Certificate has the following attributes: Fingerprint: 145E3825 31998BA7 F001EA9A B4001F57 % Do you accept this certificate? [yes/no]: yes
RSA 鍵ペアを生成します。
scep(config)# crypto key generate rsa The name for the keys will be: scep.server.example.com Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes. How many bits in the modulus [512]: Generating RSA keys ... [OK]
最後に、ルーターに証明書を生成します。
scep(config)# crypto ca enroll CA % % Start certificate enrollment .. % Create a challenge password. You will need to verbally provide this password to the CA Administrator in order to revoke your certificate. For security reasons your password will not be saved in the configuration. Please make a note of it. Password: secret Re-enter password: secret % The subject name in the certificate will be: scep.server.example.com % Include the router serial number in the subject name? [yes/no]: yes % The serial number in the certificate will be: 57DE391C % Include an IP address in the subject name? [yes/no]: yes % Interface: Ethernet0/0 % Request certificate from CA? [yes/no]: yes % Certificate request sent to Certificate Authority % The certificate request fingerprint will be displayed. % The 'show crypto ca certificate' command will also show the fingerprint. % Fingerprint:D89DB555 E64CC2F7 123725B4 3DBDF263 Jan 12 13:41:17.348: %CRYPTO-6-CERTRET: Certificate received from Certificate
設定モードを閉じます。
scep(config)# exit
ルーターが適切に登録されたことを確認するには、ルーターに保存されている証明書のリストを表示します。
scep# show crypto ca certificates Certificate Status: Available Certificate Serial Number: 0C Key Usage: General Purpose Issuer: CN = Certificate Authority O = Sfbay Red hat Domain 20070111d12 Subject Name Contains: Name: scep.server.example.com IP Address: 10.14.1.94 Serial Number: 57DE391C Validity Date: start date: 21:42:40 UTC Jan 12 2007 end date: 21:49:50 UTC Dec 31 2008 Associated Identity: CA CA Certificate Status: Available Certificate Serial Number: 01 Key Usage: Signature Issuer: CN = Certificate Authority O = Sfbay Red hat Domain 20070111d12 Subject: CN = Certificate Authority O = Sfbay Red hat Domain 20070111d12 Validity Date: start date: 21:49:50 UTC Jan 11 2007 end date: 21:49:50 UTC Dec 31 2008 Associated Identity: CA
5.6.6. Subordinate CA の使用
ルーターが CA に対して認証できるようにするには、ルートから CA 証明書チェーンのすべての CA 証明書をルーターにインポートする必要があります。たとえば、次のコマンドシーケンスは、チェーン内の 2 つの CA 証明書をルーターにインポートします。
scep(config)# crypto ca trusted-root1 scep(ca-root)# root CEP http://server.example.com:8080/ca/cgi-bin/pkiclient.exe scep(ca-root)# crl optional scep(ca-root)# exit scep(config)# cry ca authenticate 1 scep(config)# crypto ca trusted-root0 scep(ca-root)# root CEP http://server.example.com:8080/ca/cgi-bin/pkiclient.exe scep(ca-root)# crl optional scep(ca-root)# exit scep(config)# cry ca authenticate 0
CA 証明書に CRL ディストリビューションポイントの拡張が設定されていない場合は、optional
に設定して CRL 要件をオフにします。
scep(ca-root)# crl optional
その後、「ルーターの SCEP 証明書の生成」 の説明に従って CA アイデンティティーを設定します。
5.6.7. ルーターの再登録
ルーターを新しい証明書で再登録できるようにするには、既存の設定を削除する必要があります。
既存のキーを削除 (ゼロ化)。
scep(config)# crypto key zeroize rsa % Keys to be removed are named scep.server.example.com. Do you really want to remove these keys? [yes/no]: yes
CA アイデンティティーを削除します。
scep(config)# no crypto ca identity CA % Removing an identity will destroy all certificates received from the related Certificate Authority. Are you sure you want to do this? [yes/no]: yes % Be sure to ask the CA administrator to revoke your certificates. No enrollment sessions are currently active.
5.6.8. デバッグの有効化
ルーターは、debug ステートメントを有効にして、SCEP 操作中に追加のデバッグを提供します。
scep# debug crypto pki callbacks Crypto PKI callbacks debugging is on scep# debug crypto pki messages Crypto PKI Msg debugging is on scep# debug crypto pki transactions Crypto PKI Trans debugging is on scep#debug crypto verbose verbose debug output debugging is on
5.6.9. SCEP による ECC 証明書の発行
デフォルトでは、ECC CA はすぐに使用できる SCEP をサポートしていません。ただし、指定した RSA 証明書を使用して、以下の 2 つの領域を処理することで回避できます。
- 暗号化/複号証明書 - 暗号化機能/複号機能を持つ RSA 証明書 (以下の例では scepRSAcert) を指定します。
- 署名証明書 - 自己署名ではなく、クライアント側で使用する RSA 証明書を取得します (以下の例では signingCert 証明書)。
たとえば、scepRSAcert
証明書が暗号化/複号証明書で、署名証明書である signingCert
を使用する場合は、次のコマンドを実行します。
sscep enroll -c ca.crt -e scepRSAcert.crt -k local.key -r local.csr -K sign.key -O sign.crt -E 3des -S sha256 -l cert.crt -u 'http://example.example.com:8080/ca/cgi-bin/pkiclient.exe'