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

Abierto
#141 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
java

Línea de trabajo

Empieza leyendo KerberosAuthScheme y la validación del constructor del cliente; después, sigue el análisis de las opciones de CLI y las páginas del manual de Authentication y CLI. Verifica la configuración de delegación y el rechazo de autenticación no basada en Kerberos con pruebas unitarias, y completa los requisitos previos documentados y la validación en vivo contra el host AD interno.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Java
Estrellas
11
Forks
4
Merge medio
5 d 5 h
PR fusionados (30 d)
6

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MetricsHub/winrm-java

Todos los issues de MetricsHub/winrm-java

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.