コンテンツにスキップ

Netlogon Secure Channel と Schannel

Windows の資料に出てくる secure channel は、文脈によって別の仕組みを指します。特に、Active Directory の Netlogon secure channel と、TLS を実装する Secure Channel Security Support Provider (Schannel SSP) は名前が似ていますが、目的も credential も protocol も異なります。

用語主な目的相手主な trust material
Netlogon secure channelDomain member / domain 間の信頼を確認し、Netlogon RPC を保護するDomain member と Domain Controller (DC)、または trust 関係の DC 間Computer account password / trust password から導出した session key
Secure Channel / Schannel SSPTLS / DTLS handshake と record protectionTLS client と TLS serverX.509 certificate、TLS key exchange で得た key
SSPI security contextSSP が確立した認証・message protection の状態Application の client / server peer選択した SSP に依存
CredSSP の TLS channelCredential delegation を運ぶ暗号化 channelCredSSP client と target serverTLS server certificate と TLS session key

「Secure Channel が壊れた」という Windows domain の error は通常 Netlogon を指し、「Schannel event」や TLS handshake error は Schannel SSP を指します。

Domain join した computer は、Active Directory (AD) 内の computer account と、それに対応する machine account password を持ちます。Local computer と AD の双方が対応する secret を保持し、Netlogon Remote Protocol (MS-NRPC) がこの共有情報を基に DC との secure channel を確立・維持します。

Microsoft の MS-NRPC 仕様では、client と DC が Netlogon credential を相互検証し、双方が同じ password information を共有していることを確認した後、session key を導出します。この session key は後続の RPC communication の signing / encryption に使われます。

Netlogon secure channel の主な役割は次のとおりです。

  • Domain member と DC の machine trust を確認する。
  • Member server が受けた NTLM network logon の検証情報を account authority / DC へ安全に運ぶ。
  • Domain trust に関係する DC 間の secure channel を提供する。
  • Computer account password や trust password の維持に関する Netlogon operation を保護する。
  • Netlogon RPC message に integrity、sequence detection、必要な confidentiality を提供する。

これは「Domain member の全通信を DC まで暗号化する VPN」ではありません。また、user の Kerberos AS-REQ / TGS-REQ がすべて Netlogon secure channel 内を流れるわけでもありません。Kerberos client は KDC と Kerberos protocol を行い、Netlogon service は DC Locator など別の役割も担います。

MS-NRPC には複数の NETLOGON_SECURE_CHANNEL_TYPE が定義されています。

Type意味
WorkstationSecureChannelDomain member から DC への channel。
TrustedDnsDomainSecureChannel / TrustedDomainSecureChannelDomain trust で接続された DC 間の channel。
ServerSecureChannelBackup Domain Controller (BDC) から Primary Domain Controller (PDC) への channel として定義された type。
CdcServerSecureChannelRead-Only Domain Controller (RODC) から writable DC への channel。

実務で workstation / member server の「trust relationship」が問題になる場合は、通常 WorkstationSecureChannel と computer account secret の整合性を調べます。

Microsoft の troubleshooting 文書は、broken secure channel の代表原因を次の2つに整理しています。

  • Local computer と DC 間の network / port 到達性の問題。
  • Local に保存された machine password と AD の computer account password の不一致。

典型的な症状には、domain logon failure、The trust relationship between this workstation and the primary domain failed、no logon servers available、Netlogon event ID 5719、5722、5723 などがあります。ただし、同じ error でも DNS、DC Locator、firewall、replication、snapshot rollback、duplicate computer object など原因は複数あり得ます。

ターミナルウィンドウ
# Member computer と domain の trust relationship を確認
Test-ComputerSecureChannel -Verbose
# Netlogon secure channel の状態を確認
nltest /sc_query:corp.example.com
# DC Locator と到達先を確認
nltest /dsgetdc:corp.example.com

Test-ComputerSecureChannel は domain member computer 用です。Microsoft は DC 上では false positive error を返すことがあるため、DC の確認・reset には netdom.exe または nltest.exe を使うよう説明しています。

nltest /sc_query は最後に利用した secure channel の状態を報告します。一方、nltest /sc_verify:<DomainName> は検証に失敗すると既存 channel を削除して再構築する動作を含むため、純粋な read-only command ではありません。変更管理下で使用します。

Member computer では Test-ComputerSecureChannel -Repair や Reset-ComputerMachinePassword、状況により nltest を利用できます。しかし、repair は local / AD の trust state を変更します。次を確認せず、最初から domain rejoin や password reset を行うと、根本原因や調査 evidence を失う場合があります。

  1. DNS と DC Locator が正しい DC を返すか。
  2. Kerberos、LDAP、SMB、RPC endpoint mapper と dynamic RPC など必要 port が到達可能か。
  3. Local と DC の時刻が許容範囲か。
  4. AD replication が正常で、操作対象 DC が最新の computer account password を持つか。
  5. VM snapshot restore、computer clone、同名再作成など password mismatch の原因がないか。
  6. Member computer か DC かを区別し、対象 role に対応した Microsoft 手順を選んでいるか。

Secure Channel (Schannel) SSP は Windows の TLS / DTLS 実装です。Server certificate による server authentication、任意の client certificate authentication、TLS key exchange、record encryption / integrity を提供します。Application は Schannel も SSPI API 経由で利用できます。Server が client certificate を要求する構成では、certificate の検証や account mapping について application / server 側が担う処理もあります。

Application
-> SSPI: Schannel package を選択
-> InitializeSecurityContext / AcceptSecurityContext
-> TLS handshake token を transport で交換
-> Certificate validation と key establishment
-> EncryptMessage / DecryptMessage などで TLS record を保護

Schannel は Kerberos / NTLM を選択する Negotiate SSP とは別 package です。ただし同じ application stack 内で重ねて使えます。

HTTPS + Integrated Windows Authentication
TCP
└─ TLS / Schannel # Server certificate と transport protection
└─ HTTP
└─ Negotiate / SPNEGO # Kerberos または NTLM を選択
└─ Application identity

CredSSP も先に TLS channel を確立し、その内側で SPNEGO authentication と credential delegation を行います。このため、「TLS server authentication」「Windows user authentication」「credential delegation」は別々に評価する必要があります。

  • Netlogon secure channel の異常を、単なる user password error として扱わない。Machine trust、network、DC Locator、replication を確認する。
  • Domain member の machine account credential も security principal の credential として保護する。
  • Netlogon RPC の security enforcement を弱めず、client / DC を support 中の patch level に保つ。
  • Schannel では support 中の TLS version / cipher suite、certificate chain、name validation、revocation policy を管理する。
  • HTTPS を使っていても、内側の HTTP Negotiate が NTLM を選択する可能性は残る。TLS と authentication mechanism の両方を観測する。
  • 「channel が暗号化されている」ことと、「接続相手に credential を委任してよい」ことを分けて判断する。