5.8. Cisco ルーターでの証明書の登録

Cisco によって設計された Simple Certificate Enrollment Protocol (SCEP) は、ルーターが CA などの証明書発行機関と通信して、ルーターの証明書を登録するための方法です。
通常、ルーターインストーラーは CA の URL とチャレンジパスワード (ワンタイム PIN とも呼ばれます) をルーターに入力し、コマンドを発行して登録を開始します。次に、ルーターは SCEP を介して CA と通信し、証明書を生成、要求、および取得します。ルーターは、SCEP を使用して保留中の要求のステータスを確認することもできます。

5.8.1. SCEP 登録の有効化

セキュリティー上の理由から、SCEP 登録は CA でデフォルトで無効になっています。ルーターの登録を可能にするには、CA に対して SCEP 登録を手動で有効にする必要があります。
  1. 設定ファイルを編集できるように CA サーバーを停止します。
    systemctl stop pki-tomcatd@instance_name.service
  2. CA の CS.cfg ファイルを開きます。
    vim /var/lib/pki/instance_name/ca/conf/CS.cfg
  3. ca.scep.enable を true に設定します。パラメーターが存在しない場合は、パラメーターで行を追加します。
    ca.scep.enable=true
  4. CA サーバーを起動します。
    systemctl start pki-tomcatd@instance_name.service

5.8.2. SCEP のセキュリティー設定の設定

管理者は、登録認証と通常の証明書登録に同じ証明書を使用しない、または接続強度の低下を防ぐために許可された暗号化アルゴリズムを設定するなど、いくつかの異なるパラメーターを使用して、SCEP 接続に特定のセキュリティー要件を設定できます。これらのパラメーターは、表5.2「SCEP セキュリティーの設定パラメーター」 に一覧表示されます。

表5.2 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 登録の接続にセキュリティー設定を設定するには、以下を実行します。
  1. 設定ファイルを編集できるように CA サーバーを停止します。
    systemctl stop pki-tomcatd@instance_name.service
  2. CA の CS.cfg ファイルを開きます。
    vim /var/lib/pki/instance_name/ca/conf/CS.cfg
  3. 表5.2「SCEP セキュリティーの設定パラメーター」 に記載されているように、必要なセキュリティーパラメーターを設定します。このパラメーターが存在しない場合は、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
  4. CA サーバーを起動します。
    systemctl start pki-tomcatd@instance_name.service

5.8.3. SCEP 登録のルーターの設定

注記
ルーター IOS の全バージョンには関連する暗号化機能があるわけではありません。ファームウェアイメージに認証局の相互運用性があることを確認します。証明書システム SCEP サポートは、IOS C2600 Software (C2600-JK9S-M), バージョン 12.2(40), RELEASE SOFTWARE (fc1) を実行している Cisco 2611 ルーターでテストされました。
ルーターに SCEP 証明書を登録する前に、ルーターが適切に設定されていることを確認します。
  • ルーターは、IP アドレス、DNS サーバー、およびルーティング情報で設定する必要があります。
  • ルーターの日付/時刻が正しく設定されている必要があります。
  • ルーターのホスト名と dnsname を設定する必要があります。
ルーターのハードウェアの設定方法は、ルーターのドキュメントを参照してください。

5.8.4. ルーターの SCEP 証明書の生成

以下の手順では、ルーターの SCEP 証明書を生成する方法を説明します。
  1. ランダムな PIN を選択します。
  2. ルーターが 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 アドレスになります。
    フラットファイルの認証の使用は、「フラットファイル認証の設定」 に記載されています。
  3. ルーターのコンソールにログインします。以下の例では、ルーターの名前は scep です。
    scep>
  4. 特権コマンドを有効にします。
    scep> enable
  5. 設定モードを入力します。
    scep# conf t
  6. 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
  7. 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
  8. 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
  9. 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]
  10. 最後に、ルーターに証明書を生成します。
    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
  11. 設定モードを閉じます。
     scep(config)# exit
  12. ルーターが適切に登録されたことを確認するには、ルーターに保存されている証明書の一覧を表示します。
    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.8.5. 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.8.6. ルーターの再登録

ルーターを新しい証明書で再登録できるようにするには、既存の設定を削除する必要があります。
  1. 既存のキーを削除 (ゼロ化)。
    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
  2. 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.8.7. デバッグの有効化

ルーターは、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.8.8. SCEP で ECC 証明書を発行

デフォルトでは、ECCCA はすぐに使用できる SCEP をサポートしていません。ただし、指定した RSA 証明書を使用して、以下の 2 つの領域を処理することで回避できます。
  • 暗号化/複号証明書 - 暗号化機能/複号機能を持つ RSA 証明書 (以下の例では scepRSAcert) を指定します。
  • 署名証明書 - 自己署名ではなく、クライアント側で使用する RSA 証明書を取得します (以下の例では signingCert 証明書)。
たとえば、scepRSAcert 証明書が暗号化/複号証明書で、署名証明書である SignCert を使用する場合は、次のコマンドを実行します。
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'