Kerberos credential delegation: allowDelegation() and CLI --allow-delegate (winrs -allowdelegate)

オープン
#141 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
java

調査の方向性

まず既存の KerberosAuthScheme と client builder の検証を読み、次に CLI オプションの解析と Authentication および CLI のマニュアルページを追跡します。単体テストで委任設定と Kerberos 以外の認証の拒否を確認し、文書化された前提条件を満たしたうえで、内部 AD ホストに対する実環境での検証を完了します。

索引モデルが issue の本文から書いたものです。

説明

winrs parity: -a[llow]d[elegate] — let the remote shell use the user's credentials to reach a further hop (a share on a third machine, a database, ...). Without delegation, anything the remote command does with the user's identity over the network fails with access denied (the classic double-hop problem).

Context

winrs implements this with CredSSP or Kerberos delegation. For this client:

  • Kerberos (in scope): the JDK GSS-API supports delegation natively — GSSContext.requestCredDeleg(true) on the context KerberosAuthScheme already creates. The TGT must be forwardable (forwardable = true in krb5.conf, or a forwardable ticket in the ticket cache), and the target service must be trusted for delegation in AD (OK-AS-DELEGATE; for constrained delegation the KDC decides). All pure JDK, zero new dependencies.
  • CredSSP (out of scope): NTLM-based delegation requires implementing CredSSP (TLS channel + SPNEGO inside TSRequest ASN.1 structures + credential submission). That is a whole new authentication protocol and a significant security surface; explicitly not part of this issue — file separately if ever needed.

Proposed API

try (WinRMClient client = WinRMClient.builder("server.example.net")
        .https()
        .authentication(AuthScheme.KERBEROS)
        .allowDelegation()                       // connection-scoped, Kerberos only
        .credentials("DOMAIN\user", password)
        .build()) {
    client.command("dir \\fileserver\share").execute();
}
  • Builder-level (delegation is a property of the authentication, not of one command).
  • build() rejects allowDelegation() when Kerberos is not among the requested schemes — silently ignoring it would give a false sense of security posture.
  • When the KDC does not grant a forwardable/delegable ticket, GSS reports it — surface a clear message (this is the number-one support question with delegation).

CLI

winrm-java -h server -u 'DOMAIN\user' -pf pw.txt \
  --https --kerberos --allow-delegate \
  exec 'dir \fileserver\share'

Usage error when --allow-delegate is given without --kerberos.

Acceptance criteria

  • requestCredDeleg(true) set on the GSS context iff delegation was requested; unit-testable at the KerberosAuthScheme level.
  • Configuration rejections (NTLM-only + delegation) at build() / CLI parse time with actionable messages.
  • Live validation against a real AD host with OK-AS-DELEGATE (see the internal test host) — the FakeWsmanServer speaks NTLM only, so delegation is covered by unit + live tests.
  • Documented on the Authentication page (including the krb5.conf forwardable and AD trust prerequisites) and in the CLI manual.

🤖 Generated with Claude Code

主要言語
Java
スター
11
フォーク
4
平均マージ
5日 5時間
マージ済み PR(30日)
6

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MetricsHub/winrm-java のほかの issue

MetricsHub/winrm-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。