ComposantsComponents

ComposantsComponents › InternetInternet

tSetKerberosConfiguration

tSetKerberosConfiguration

InternetInternet

Configure Kerberos pour le job : il pose le serveur KDC et le domaine (realm) dans les propriétés système de la JVM, puis ouvre une session Kerberos avec l'utilisateur et le mot de passe, en demandant un ticket au KDC. L'identité obtenue est rangée dans une variable globale, que le tSOAP utilise quand sa case Utiliser Kerberos est cochée. Le composant s'appuie sur le module de connexion Kerberos du JDK et n'a besoin d'aucune bibliothèque. Configures Kerberos for the job: it sets the KDC server and the realm in the system properties of the JVM, then opens a Kerberos session with the user and the password, requesting a ticket from the KDC. The obtained identity is stored in a global variable, which the tSOAP uses when its Use Kerberos box is checked. The component relies on the Kerberos login module of the JDK and needs no library.

EntréeInput

Aucune : il forme un sous-job à lui seul, en général le premier du job. Ni flux, ni Iterate. None: it forms a subjob on its own, usually the first of the job. Neither flow nor Iterate.

SortieOutput

Aucun flux : des propriétés de la JVM et la variable globale kerberos_subject_tSetKerberosConfiguration_1. No flow: JVM properties and the global variable kerberos_subject_tSetKerberosConfiguration_1.

Déclencheurs en sortieOutput triggers

On Subjob Ok On Subjob Error On Component Ok On Component Error Run if

UtilisationUsage

Ouvrir la session, puis appeler le serviceOpen the session, then call the service

OnSubjobOkrow1 (Main)tSetKerberosConfiguration_1tSOAP_1tLogRow_1

Le tSetKerberosConfiguration ouvre la session ; le tSOAP, paramètres avancés Utiliser Kerberos coché et Configuration de Kerberos = tSetKerberosConfiguration_1, envoie sa requête sous cette identité (Subject.doAs). Si la session échoue, le job s'arrête sur le premier sous-job. The tSetKerberosConfiguration opens the session; the tSOAP, advanced settings Use Kerberos checked and Kerberos configuration = tSetKerberosConfiguration_1, sends its request under that identity (Subject.doAs). If the session fails, the job stops on the first subjob.

  1. Déposez le tSetKerberosConfiguration depuis la famille Internet de la palette, au début du job. Drop the tSetKerberosConfiguration from the Internet family of the palette, at the start of the job.
  2. Donnez le Serveur KDC (nom d'hôte, sans port) et le Domaine en majuscules ("EXAMPLE.COM"), puis l'Utilisateur et son Mot de passe, de préférence par des variables de contexte. Give the KDC Server (host name, without port) and the Realm in capitals ("EXAMPLE.COM"), then the Username and its Password, preferably through context variables.
  3. Reliez la suite par On Subjob Ok ; dans le tSOAP, choisissez ce composant comme configuration de Kerberos. Connect the rest with On Subjob Ok; in the tSOAP, choose this component as Kerberos configuration.
  4. Pour comprendre un échec, ajoutez l'argument de JVM -Dsun.security.krb5.debug=true (onglet Exécuter) : le message d'erreur du composant ne donne pas la cause (voir Exemples). To understand a failure, add the JVM argument -Dsun.security.krb5.debug=true (Run tab): the error message of the component does not give the cause (see Examples).

Paramètres simplesBasic settings

Quatre champs, tous visibles, tous des expressions Java ; pas de paramètres avancés propres. Les libellés sont ceux de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Four fields, all shown, all Java expressions; no advanced settings of its own. Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file.

ParamètreSetting DéfautDefault VisibleShown Description
Serveur KDCKDC ServerKDC "localhost" ToujoursAlways Nom ou adresse du centre de distribution de clés (le contrôleur de domaine sous Active Directory). Copié dans la propriété système java.security.krb5.kdc. Le JDK lit le caractère : comme séparateur de plusieurs KDC (sun.security.krb5.Config) : n'y mettez pas de port. La trace a montré l'envoi au port 88, en UDP. Name or address of the key distribution center (the domain controller with Active Directory). Copied into the java.security.krb5.kdc system property. The JDK reads the : character as a separator of several KDCs (sun.security.krb5.Config): do not put a port in it. The trace showed the sending to port 88, over UDP.
DomaineRealmREALM "domain.host" ToujoursAlways Domaine Kerberos, en général le domaine DNS en majuscules : "EXAMPLE.COM". Copié dans java.security.krb5.realm ; l'utilisateur devient utilisateur@DOMAINE. Kerberos realm, usually the DNS domain in capitals: "EXAMPLE.COM". Copied into java.security.krb5.realm; the user becomes user@REALM.
UtilisateurUsernameUSERNAME "username" ToujoursAlways Nom du compte Kerberos (principal), sans le domaine. Name of the Kerberos account (principal), without the realm.
Mot de passePasswordPASSWORD "password" ToujoursAlways Mot de passe du compte. Une valeur entre guillemets est chiffrée dans le code généré, avec une clé livrée avec le job ; préférez une variable de contexte chargée au lancement (tContextLoad). Pas de fichier keytab ni de cache de tickets : le mot de passe est le seul moyen. Password of the account. A value in quotes is encrypted in the generated code, with a key that ships with the job; prefer a context variable loaded at start (tContextLoad). No keytab file nor ticket cache: the password is the only way.

Ce que pose le composantWhat the component sets

Lu dans le modèle du composant et vérifié par un tJava du même job, dans l'ordre d'exécution : Read in the template of the component and checked by a tJava of the same job, in the order of execution:

ÉtapeStep EffetEffect
1. Propriétés système1. System properties System.setProperty("java.security.krb5.kdc", …) et ("java.security.krb5.realm", …), pour toute la JVM du job et jusqu'à sa fin. Elles remplacent les mêmes propriétés données en arguments de JVM. Posées avant la connexion, elles restent même si elle échoue.System.setProperty("java.security.krb5.kdc", …) and ("java.security.krb5.realm", …), for the whole JVM of the job and until its end. They replace the same properties given as JVM arguments. Set before the connection, they stay even if it fails.
2. Fichier de configuration2. Configuration file Le composant n'écrit aucun fichier. Le JDK lit toujours un fichier Kerberos pour les autres réglages (délais, chiffrements) : celui de l'argument -Djava.security.krb5.conf=…, sinon conf/security/krb5.conf du JDK, sinon, sous Windows, C:\Windows\krb5.ini (ou /etc/krb5.conf sous Linux). Un fichier absent n'est pas une erreur.The component writes no file. The JDK always reads a Kerberos file for the other settings (timeouts, encryption types): the one of the -Djava.security.krb5.conf=… argument, otherwise conf/security/krb5.conf of the JDK, otherwise, on Windows, C:\Windows\krb5.ini (or /etc/krb5.conf on Linux). A missing file is not an error.
3. Connexion au KDC3. Connection to the KDC Un Krb5LoginModule du JDK reçoit l'utilisateur et le mot de passe (options tryFirstPass, useTicketCache=false, storePass=false) et demande un ticket au KDC, dans le composant même. Le cache de tickets du compte (Windows ou MIT) n'est ni lu ni écrit.A JDK Krb5LoginModule receives the user and the password (options tryFirstPass, useTicketCache=false, storePass=false) and requests a ticket from the KDC, inside the component itself. The ticket cache of the account (Windows or MIT) is neither read nor written.
4. Succès4. Success Affiche Build the connection with Kerberos Successfully! sur la sortie standard, puis range l'identité (javax.security.auth.Subject, avec le ticket) dans globalMap sous kerberos_subject_tSetKerberosConfiguration_1. Non observé lors de nos essais, faute de KDC.Prints Build the connection with Kerberos Successfully! on the standard output, then stores the identity (javax.security.auth.Subject, with the ticket) in globalMap under kerberos_subject_tSetKerberosConfiguration_1. Not observed in our runs, for lack of a KDC.
5. Échec5. Failure Une LoginException arrête le composant (il n'a pas d'option pour continuer) ; la variable kerberos_subject_… n'est pas créée. Le message Fail to build the connection with Kerberos! prévu par le modèle ne s'affiche jamais : le module du JDK lève une exception au lieu de répondre « non ».A LoginException stops the component (it has no option to go on); the kerberos_subject_… variable is not created. The Fail to build the connection with Kerberos! message planned by the template never prints: the JDK module throws an exception instead of answering "no".

Variables globalesGlobal variables

Le composant ne déclare aucune variable dans la liste du Studio. Il range pourtant l'identité Kerberos, après un succès, sous un nom qui ne suit pas la forme habituelle (préfixe, puis nom du composant) ; et, comme tout composant, le message d'une erreur dans ERROR_MESSAGE : The component declares no variable in the Studio list. It still stores the Kerberos identity, after a success, under a name that does not follow the usual form (prefix, then component name); and, as any component, the message of an error in ERROR_MESSAGE:

((javax.security.auth.Subject) globalMap.get("kerberos_subject_tSetKerberosConfiguration_1"))
((String) globalMap.get("tSetKerberosConfiguration_1_ERROR_MESSAGE"))

ExemplesExamples

Aucun KDC n'était disponible pour nos essais : les jobs (lancés depuis Talaxie, Java 21) visent 127.0.0.1, où rien n'écoute, et montrent ce que le composant pose et comment il échoue. Domaine "EXAMPLE.COM", Utilisateur "demo", mot de passe fictif. Consoles copiées telles quelles, nom du job remplacé par MyJob, chemins par C:\data, piles abrégées (…). Le tJava qui décrit l'état est : No KDC was available for our runs: the jobs (started from Talaxie, Java 21) target 127.0.0.1, where nothing listens, and show what the component sets and how it fails. Realm "EXAMPLE.COM", Username "demo", fictitious password. Consoles copied as they are, job name replaced with MyJob, paths with C:\data, stacks shortened (…). The tJava that describes the state is:

System.out.println("tJava_2 (On Component Error): java.security.krb5.kdc = " + System.getProperty("java.security.krb5.kdc"));
System.out.println("tJava_2 (On Component Error): java.security.krb5.realm = " + System.getProperty("java.security.krb5.realm"));
System.out.println("tJava_2 (On Component Error): kerberos_subject_tSetKerberosConfiguration_1 = " + globalMap.get("kerberos_subject_tSetKerberosConfiguration_1"));
System.out.println("tJava_2 (On Component Error): tSetKerberosConfiguration_1_ERROR_MESSAGE = " + globalMap.get("tSetKerberosConfiguration_1_ERROR_MESSAGE"));

KDC injoignable, erreur repriseKDC unreachable, error taken over

OnComponentErrortSetKerberosConfiguration_1tJava_2

Serveur KDC "127.0.0.1". Console : KDC Server "127.0.0.1". Console:

Exception in component tSetKerberosConfiguration_1 (MyJob)
javax.security.auth.login.LoginException: No CallbackHandler available to garner authentication information from the user
	at jdk.security.auth/com.sun.security.auth.module.Krb5LoginModule.promptForName(Krb5LoginModule.java:822)
	at jdk.security.auth/com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:689)
	at jdk.security.auth/com.sun.security.auth.module.Krb5LoginModule.login(Krb5LoginModule.java:597)
	…
tJava_2 (On Component Error): java.security.krb5.kdc = 127.0.0.1
tJava_2 (On Component Error): java.security.krb5.realm = EXAMPLE.COM
tJava_2 (On Component Error): kerberos_subject_tSetKerberosConfiguration_1 = null
tJava_2 (On Component Error): tSetKerberosConfiguration_1_ERROR_MESSAGE = No CallbackHandler available to garner authentication information from the user

Les propriétés sont posées, l'identité manque. Le message ne parle pas du KDC : le premier essai, avec le mot de passe donné, a échoué, et le module a alors voulu demander un nom à l'utilisateur, sans moyen de le faire. Le même message couvre donc un KDC injoignable, un mot de passe faux ou un compte inconnu. Le tJava relié par On Subjob Ok ne s'est pas exécuté ; job terminé avec le code 0. Sans le lien d'erreur, le job s'est arrêté avec le code 1. The properties are set, the identity is missing. The message does not mention the KDC: the first attempt, with the given password, failed, and the module then wanted to ask the user for a name, with no way to do so. The same message thus covers an unreachable KDC, a wrong password or an unknown account. The tJava connected with On Subjob Ok did not run; job ended with code 0. Without the error link, the job stopped with code 1.

La cause, avec la trace KerberosThe cause, with the Kerberos trace

Même job, argument de JVM -Dsun.security.krb5.debug=true. Début de la console : Same job, JVM argument -Dsun.security.krb5.debug=true. Start of the console:

Java config name: null
Native config name: C:\Windows\krb5.ini
Loading config file from C:\Windows\krb5.ini
Loaded from native config
>>> KdcAccessibility: reset
Getting permitted_enctypes from libdefaults
default_enctypes were null, using builtin default etypes for configuration default_tkt_enctypes
default etypes for default_tkt_enctypes: 18 17 20 19.
>>> KrbAsReq creating message
>>> KrbKdcReq send: kdc=127.0.0.1 UDP:88, timeout=30000, number of retries =3, #bytes=140
>>> KDCCommunication: kdc=127.0.0.1 UDP:88, timeout=30000,Attempt =1, #bytes=140
>>> KrbKdcReq send: error trying 127.0.0.1
java.net.PortUnreachableException
	at java.base/sun.nio.ch.DatagramChannelImpl.receive0(Native Method)
	…
>>> KdcAccessibility: add 127.0.0.1
Exception in component tSetKerberosConfiguration_1 (MyJob)
javax.security.auth.login.LoginException: No CallbackHandler available to garner authentication information from the user

On y voit le fichier de configuration cherché (absent ici), la demande de ticket envoyée au port 88 en UDP et sa cause d'échec. Délais par défaut : 30 s par essai, 3 essais par KDC ; un KDC qui ne répond pas du tout peut donc retenir le composant une minute et demie. Avec la trace, la JVM écrit aussi, à sa fin, des lignes LSA: … (bibliothèque Kerberos de Windows). It shows the configuration file looked for (missing here), the ticket request sent to port 88 over UDP and its cause of failure. Default timeouts: 30 s per attempt, 3 attempts per KDC; a KDC that does not answer at all can therefore hold the component for a minute and a half. With the trace, the JVM also writes, at its end, LSA: … lines (Kerberos library of Windows).

Le fichier krb5.conf est luThe krb5.conf file is read

Arguments de JVM -Djava.security.krb5.conf=C:\data\krb5.conf et la trace ; le fichier contient [libdefaults], kdc_timeout = 2000, max_retries = 1. Extrait : JVM arguments -Djava.security.krb5.conf=C:\data\krb5.conf and the trace; the file holds [libdefaults], kdc_timeout = 2000, max_retries = 1. Excerpt:

Java config name: C:\data\krb5.conf
Loading config file from C:\data\krb5.conf
Loading krb5 profile at C:\data\krb5.conf
libdefaults = {
kdc_timeout = 2000
max_retries = 1
}
Loaded from Java config
…
>>> KrbKdcReq send: kdc=127.0.0.1 UDP:88, timeout=2000, number of retries =1, #bytes=140

Le KDC et le domaine viennent du composant, mais les autres réglages du fichier s'appliquent : c'est là qu'on règle délais, nombre d'essais ou types de chiffrement. The KDC and the realm come from the component, but the other settings of the file apply: this is where timeouts, number of attempts or encryption types are set.

Propriétés déjà données à la JVMProperties already given to the JVM

Arguments de JVM -Djava.security.krb5.kdc=kdc.example.com et -Djava.security.krb5.realm=JVM.EXAMPLE.COM ; un tJava affiche l'état avant le composant, un autre après (On Component Error) : JVM arguments -Djava.security.krb5.kdc=kdc.example.com and -Djava.security.krb5.realm=JVM.EXAMPLE.COM; a tJava prints the state before the component, another one after (On Component Error):

tJava_1 (before): java.security.krb5.kdc = kdc.example.com
tJava_1 (before): java.security.krb5.realm = JVM.EXAMPLE.COM
…
tJava_2 (On Component Error): java.security.krb5.kdc = 127.0.0.1
tJava_2 (On Component Error): java.security.krb5.realm = EXAMPLE.COM

Le composant écrase les valeurs données au lancement : ses champs l'emportent. The component overwrites the values given at start: its fields win.

PiègesPitfalls

Une seule configuration par JVMA single configuration per JVM

OnComponentErrorOnComponentOkOnComponentErrortSetKerberosConfiguration_1tJava_1tSetKerberosConfiguration_2tJava_2

tSetKerberosConfiguration_1 avec "127.0.0.1" et "EXAMPLE.COM", puis tSetKerberosConfiguration_2 avec "localhost", "OTHER.EXAMPLE.COM" et un autre utilisateur, trace Kerberos active. Extrait de la console, à partir du tJava_1 : tSetKerberosConfiguration_1 with "127.0.0.1" and "EXAMPLE.COM", then tSetKerberosConfiguration_2 with "localhost", "OTHER.EXAMPLE.COM" and another user, Kerberos trace on. Excerpt of the console, from tJava_1:

tJava_1: java.security.krb5.kdc = 127.0.0.1
tJava_1: java.security.krb5.realm = EXAMPLE.COM
tJava_1: kerberos_subject_tSetKerberosConfiguration_1 = null
tJava_1: tSetKerberosConfiguration_1_ERROR_MESSAGE = No CallbackHandler available to garner authentication information from the user
Getting permitted_enctypes from libdefaults
default_enctypes were null, using builtin default etypes for configuration default_tkt_enctypes
default etypes for default_tkt_enctypes: 18 17 20 19.
>>> KrbAsReq creating message
>>> KrbKdcReq send: kdc=127.0.0.1 UDP:88, timeout=30000, number of retries =3, #bytes=141
…
Exception in component tSetKerberosConfiguration_2 (MyJob)
javax.security.auth.login.LoginException: No CallbackHandler available to garner authentication information from the user
…
tJava_2: java.security.krb5.kdc = localhost
tJava_2: java.security.krb5.realm = OTHER.EXAMPLE.COM

Le second composant a bien posé ses propriétés, mais sa demande est partie vers le KDC du premier (kdc=127.0.0.1), sans relire la configuration (pas de nouvelle ligne Loaded from …) ; sa taille, un octet de plus pour un nom d'utilisateur d'une lettre de plus, montre qu'elle portait encore le domaine du premier. Le JDK lit la configuration Kerberos à la première connexion et la garde pour toute la JVM ; le composant ne lui demande pas de la recharger (option refreshKrb5Config absente du modèle). Un seul KDC et un seul domaine par job, donc ; un job enfant lancé par tRunJob dans la même JVM hérite aussi de cette configuration. Pour deux domaines, lancez des jobs séparés (tRunJob avec Utiliser un processus indépendant pour exécuter le sous-Job). The second component did set its properties, but its request went to the KDC of the first one (kdc=127.0.0.1), without reading the configuration again (no new Loaded from … line); its size, one byte more for a user name one letter longer, shows that it still carried the realm of the first one. The JDK reads the Kerberos configuration at the first connection and keeps it for the whole JVM; the component does not ask it to reload it (refreshKrb5Config option missing from the template). One KDC and one realm per job, therefore; a child job started by tRunJob in the same JVM also inherits this configuration. For two realms, start separate jobs (tRunJob with Use an independent process to run subjob).

Les propriétés touchent tout le jobThe properties affect the whole job

java.security.krb5.kdc et java.security.krb5.realm valent pour tout composant du job qui utilise Kerberos par Java (connexions JDBC ou Hadoop en Kerberos, par exemple), même sans lien avec ce composant : placez-le avant eux et donnez-leur le même domaine. java.security.krb5.kdc and java.security.krb5.realm apply to any component of the job that uses Kerberos through Java (JDBC or Hadoop connections with Kerberos, for example), even with no link to this component: place it before them and give them the same realm.

Seul le tSOAP s'en sertOnly the tSOAP uses it

Parmi les composants livrés, seul le tSOAP lit kerberos_subject_…. Si la variable manque (session non ouverte), il écrit Subject for Kerberos is null! sur la sortie d'erreur et envoie quand même sa requête, sans identité Kerberos. Ne reliez donc le tSOAP que par On Subjob Ok. Among the delivered components, only the tSOAP reads kerberos_subject_…. If the variable is missing (session not opened), it writes Subject for Kerberos is null! to the error output and still sends its request, without a Kerberos identity. So only connect the tSOAP with On Subjob Ok.

Voir aussiSee also