Active Directoryによるクライアントログオン¶
Compatible Nitrokeys |
|||||||
|---|---|---|---|---|---|---|---|
✓ active |
⨯ inactive |
⨯ inactive |
⨯ inactive |
⨯ inactive |
⨯ inactive |
⨯ inactive |
⨯ inactive |
This document explains how to use the PIV smart card of a Nitrokey 3 for logon with Active Directory. It is available as of firmware version 1.8 and higher.
将来的には、この手動プロビジョニングをWindowsのMiniDriverで自動化することも可能です。
前提条件¶
セットアップには、Active Directory Directory Services (ADDS)とActive Directory Certificate Services (ADCS)を実行しているマシンへの管理者アクセスが必要である。クライアント・マシンでは、ログオンに使用する各ユーザー・アカウントへのアクセスのみが必要である。
Windows server (supported versions are Windows Server 2016, 2019, 2022, 2025 in Standard and Enterprise editions)
ADDSロールがインストールされ、構成されている。
ADCSロールがインストールされ、ルート証明書が設定された*Enterprise-CA* 。
各ドメインコントローラー(DC)には、ドメインコントローラー 、ドメインコントローラー認証 、Kerberos認証 証明書が発行されている必要があります。
社内ネットワークを離れるクライアントがある場合、公開されている完全およびデルタ証明書失効リスト(CRL)が外部ネットワークから取得可能であることを確認する。
Windowsクライアント(対応バージョンはWindows 10、11、エディションは*Professional* 、Enterprise )。
クライアントはActive Directory(AD)ドメインのドメインメンバーでなければならない。
Nitrokey 3 with PIV smart card.
Active Directory(AD)で使用するスマートカードログオンの設定¶
スマートカード・ログオンには、ドメインの認証局(CA)の証明書テンプレートが必要である。このテンプレートは、ユーザ証明書の値と制約を定義する。このテンプレートは、Nitrokey のプロビジョニング中に証明書要求(CSR)に署名するために使用される。
スマートカード・ログオン用の証明書要求に署名するには、認証局に証明書テンプレートを作成する必要がある。
コマンドライン、PowerShell、またはRunから、
certtmpl.mscと入力し、Enterを押す。詳細ペインでテンプレート**Smartcard Logon** を選択する。
メニューバーで**アクション → すべてのタスク → テンプレートの複製** をクリックします。
テンプレート上の以下の設定を、前述のタブに従って設定する。
Compatibility * Disable Show resulting changes * Set Certificate Authority and Certificate recipient to the oldest clients in the domain which are supposed to use smartcard logon.
重要
楕円曲線(EC)鍵を使用する場合、クライアントはWindows Server 2008およびWindows Vista以下でなければならない。
General * Set a Template display name. * Set the Validity period and Renewal period.
Request handling * Set a purpose of Signature and smartcard logon.
Cryptography * Set a provider category of Key Storage Provider. * Set a algorithm name and minimum key size.
重要
Microsoft recommends to use the RSA algorithm with a key length of
2048Bit. If you choose to use Elliptic Curve (EC) keys you need to make additional changes on your client computers.Subject Name * Set Supply in the request.
OK でテンプレートの作成を確認する。
証明書テンプレートの作成後、クライアントが使用できるようにテンプレートを発行しなければならない。
From the Command Line, PowerShell, or Run, type
certmgr.mscand press Enter.ナビゲーシ ョ ンペインで認証局 (CA) を展開 し 、証明書テ ン プ レー ト に移動。
メニューバーで、Action → New → Certificate Template to Issue をクリックする。
発行する証明書テンプレートを選択し、OK で確認する。
Active Directoryでスマートカードログオン用にNitrokey 3をプロビジョニングする¶
The smartcard logon requires to provision a Nitrokey for a user in Active Directory. The provisioning contains the private key and Certificate Singing Request (CSR) generation. The certificate is then written to the Nitrokey.
警告
以下の手順を実行する前に、スマートカード・ログオンに使用する Active Directory ユーザー・アカウントが存在することを確認してください。証明書の作成時刻がユーザーアカウントの作成時刻より前の場合、ログオンに失敗します。
以下のコマンドで秘密鍵を生成し、CSRをファイルに書き込む。
nitropy nk3 piv --experimental generate-key --key 9A --algo <algorithm> --subject-name <subject-name> --subject-alt-name-upn <subject-alternative-name> --path <file>The value of
<algorithm>is the used algorithm with its key length, e.g.rsa2048. The value of<subject-name>corresponds to the value of thedistinguishedNameattribute of the Active Directory user account. In most cases it is only necessary to include the common name part of the distinguished name, e.g.CN=John Doe. The value of<subject-alternative-name>corresponds to the value of theuserPrincipalNameattribute of the Active Directory user account.以下のコマンドを使用して、ドメインの認証局(CA)でCSRに署名する。
certreq -attrib CertificateTemplate:<template-name> -submit <file><template-name>``の値は、スマートカードログオン用の証明書テンプレートの名前である。``<file>の値は、証明書歌唱要求ファイルである。以下のコマンドで、署名された証明書をNitrokeyに書き込む。
nitropy nk3 piv --experimental write-certificate --key 9A --format PEM --path <file><file>の値は証明書ファイルである。証明書を Active Directory のユーザー・アカウントにマッピングする。以下のコマンドで証明書のマッピングを作成する。
nitropy nk3 piv --experimental get-windows-auth-mappingChoose one of the offered certificate mappings.
Tip
マイクロソフトでは、
X509IssuerSerialNumberマッピングの使用を推奨している。選択したマッピングを Active Directory ユーザーオブジェクトの``altSecurityIdentities`` 属性に書き込む。この操作には、Active Directory Users and Computers アプリケーションまたは PowerShell を使用できます。
From the Command Line, PowerShell, or Run, type
dsa.mscand press Enter.In the menu bar click View → Advanced Features.
それぞれのユーザーオブジェクトを選択する。
In the menu bar click Action → Properties.
Attribute Editor タブを開く。
``altSecurityIdentities``という属性を選択する。
Click on Edit.
Insert the certificate mapping in the text field and click Add.
OK をクリックして変更を適用する。
PowerShellを開く。
<sAMAccountName>をユーザー・ログオン名の値に、<certificate-mapping>を上記で選択した証明書マッピングに置き換えて、Set-ADUser -Identity "<sAMAccountName>" -Add @{altSecurityIdentities="<certificate-mapping>"}の値を追加する。
重要
証明書のマッピングが正しく設定されていない場合、ログオンしようとするとエラーメッセージ``Logon screen message: Your credentials could not be verified.`` が表示されます。さらに、Windowsのシステムイベントログに以下のイベントメッセージが表示されます。
Source
Kerberos-Key-Distribution-Center
Message
The Key Distribution Center (KDC) encountered a user certificate that was valid but could not be mapped to a user in a secure way (such as via explicit mapping, key trust mapping, or a SID). Such certificates should either be replaced or mapped directly to the user via explicit mapping. See https://go.microsoft.com/fwlink/?linkid=2189925 to learn more.
Active Directory (AD)で使用するスマートカードログオンを無効にする。¶
発行されたユーザー・ログオン証明書は、Active Directory Certificate Services(ADCS)にリストされる。ADCS から証明書を失効させることができ、設定された証明書失効リスト(CRL)に追加されます。これは、Nitrokey を紛失または破損した場合に必要です。
重要
未使用のユーザー証明書を失効させずに放置しないことを強く推奨する。
注釈
Certificate Hold という理由で証明書を一時的に失効させることができる。この失効は取り消すことができ、永久的なものではない。
コマンドライン、PowerShell、またはRunから、
certsrv.mscと入力し、Enterを押す。ナビゲーシ ョ ンペインで認証局 (CA) を展開し、Issued Certificates に移動する。
詳細ペインで、失効させたいユーザー証明書を選択する。
メニューバーで**アクション → すべてのタスク → 証明書の失効** をクリックする。
失効理由、日時を指定し、はい で確認する。
ナビゲーション・ペインで**Revoked Certificates** に移動する。
メニューバーで**アクション → すべてのタスク → パブリッシュ** をクリックする。
公開したい失効リストを選択し、OK で確認する。
注釈
各スマートカードのログオン試行中、Windowsは、スマートカードから提示された証明書が証明書失効リスト(CRL)に記載されているかどうかを確認する。証明書がCRLで見つかった場合、ログオンは拒否される。各CRLには有効期限が含まれている。Windowsは取得したCRLをキャッシュし、CRLが期限切れになりそうな場合は更新する。したがって、失効は即時ではなく、クライアントが持っているCRLの有効期限に依存する。
ユーザースマートカード証明書を個人証明書ストアにインポートする¶
Nitrokey に保存されているユーザー証明書は、ユーザー個人の証明書ストアにインポートすることができます。特定の状況では、これは必須の手順です。
証明書が対応するユーザーアカウントにログオンしていることを確認してください。
コマンドライン、PowerShell、またはRunから、
certsrv.mscと入力し、Enterを押す。ナビゲーション・ペインで、Personal キー・ストアを展開し、Certificates に移動する。
メニューバーで**アクション → すべてのタスク → インポート** をクリックする。
インポートウィザードに従い、要求されたらユーザー証明書ファイルを提供する。
インポートが完了したら、インポートした証明書の詳細ペインを確認します。Nitrokey が接続されていれば、証明書のプロパティに*この証明書に対応する秘密鍵があります。* というメッセージが表示され、Nitrokey 上の秘密鍵が特定できたことがわかります。
証明書が対応するユーザーアカウントにログオンしていることを確認してください。
PowerShellを開く。
Import the certificate with
Import-Certificate -CertStoreLocation Cert:\CurrentUser\My -FilePath <path>, replacing<file>with the certificate file path.After the import completed check for the certificate with
Get-ChildItem Cert:\CurrentUser\My.