Configure Kerberos for Business Hub
Overview
KNIME Business Hub executes workflows that may try to access Kerberos-secured services such as Apache Hive™, Apache Impala™ and Apache Hadoop® HDFS™.
This guide describes how to configure KNIME Business Hub so that it can authenticate itself against Kerberos.
To configure Kerberos on KNIME Analytics Platform, please refer to the Kerberos User Guide.
If you are using Kerberos authentication, you need to use user scope for deployments. Team scope is not supported with Kerberos authentication.
Prerequisites
Setting up KNIME Business Hub for Kerberos authentication has the following prerequisites:
For Kerberos:
An existing Kerberos KDC such as MIT Kerberos or Microsoft ActiveDirectory
A service principal for KNIME Business Hub. The recommended format is
knimehub/<host>@<REALM>, where:<host>is the fully-qualified domain name of the machine where KNIME Business Hub runs,<REALM>is the Kerberos realm.
A keytab file for the KNIME Business Hub service principal.
A Kerberos client configuration file (
krb5.conf). Alternatively, can be created manually (see section Setting upkrb5.conf).
For KNIME Business Hub:
An existing KNIME Business Hub instance.
An execution context that operates using a selected custom executor image. If you are working with executor version
= 4.7.2, the execution context needs to be created by pointing to a specific Docker image in order to work with Kerberos. A specific Docker image is available with the following name:knime/knime-lts-full:4.7.2-rc-000146-1816590If you are working with executor version> 4.7.2you can create the execution context using the corresponding docker image for the version that you want to use. A list is available here.Follow the instructions in the KNIME Business Hub User Guide to create a new execution context and specify the above Docker image.
Setting up krb5.conf
The KNIME Business Hub execution context might need to read the krb5.conf file during Kerberos authentication. In that case, a valid krb5.conf file needs to be obtained. In case the location of the file is unknown or the file is not available, please contact the local administrator.
Creating krb5.conf file
Alternatively, a krb5.conf file can be created manually. A minimal configuration file could look like this:
ini
[libdefaults]
default_realm = MYCOMPANY.COM
forwardable = true
udp_preference_limit = 1
[realms]
MYCOMPANY.COM = {
kdc = kdc.mycompany.com
admin_server = kdc.mycompany.com
}The above example declares that the Kerberos realm is called MYCOMPANY.COM and that the hostname of the Kerberos KDC is kdc.mycompany.com.
The forwardable flag is a prerequisite for some KNIME nodes to make use of Kerberos constrained delegation when executed on KNIME Business Hub. The udp_preference_limit variable value set to 1 is to ensure that when sending a message to the KDC, the library will try using TCP over UDP connection.
Adjust the values contained in the krb5.conf file as appropriate for the setup in use. Depending on the specific setup, more configuration settings may be necessary. The krb5.conf format is fully described as part of the MIT Kerberos documentation.
Providing the keytab file
The keytab file contains the credentials of the KNIME Business Hub service principal. Anyone who has the keytab can authenticate as this principal. Avoid including keytabs in customization profiles, as these profiles lack adequate access controls.
Instead, make the keytab available on the executor machines and reference it by its absolute path in the preferences. How you do this depends on where the executors run:
- Sovereign executors: Place the keytab on the local file system of each executor machine.
- Executors in the KNIME Business Hub cluster: Mount the keytab from a Kubernetes secret as a volume in the executor pods.
Sovereign executors
Sovereign executors run on machines that you operate. Place the keytab directly on their local file system:
Copy the keytab file to every executor machine of the execution context. Use the same absolute path on every machine, for example
/home/knime/kerberos/knimehub.keytab.Make sure that only the user who runs the executor can read the file. On Linux, for example:
shellchown knime:knime /home/knime/kerberos/knimehub.keytab chmod 600 /home/knime/kerberos/knimehub.keytabIn the preferences file, set the absolute path to the keytab:
text/instance/org.knime.kerberos/org.knime.kerberos.keytabFile=/home/knime/kerberos/knimehub.keytabOn Windows, use forward slashes in the path, for example
C:/knime/kerberos/knimehub.keytab. The preferences file treats backslashes as escape characters.
Executors in the KNIME Business Hub cluster
Executors in the KNIME Business Hub cluster run as Kubernetes pods. A file that you copy into a running pod is lost when the pod restarts. Instead, store the keytab in a Kubernetes secret and mount the secret as a volume in the executor pods of the execution context.
You need kubectl access to the cluster. The commands use the knime namespace, which is the default namespace of KNIME Business Hub. Replace it if your installation uses a different namespace.
Create a secret from the keytab file:
shellkubectl create secret generic kerberos-keytab --from-file=knimehub.keytab -n knimeFind the ID of the execution context. The
NAMEcolumn shows the IDs of all execution contexts:shellkubectl get executioncontext -n knimeAdd the secret as a volume to the executor pods of the execution context, and mount it at an absolute path. Replace
<EXECUTION_CONTEXT_ID>with the ID from the previous step:shellkubectl patch executioncontext <EXECUTION_CONTEXT_ID> -n knime --type=merge -p '{"spec":{"executor":{"volumes":[{"name":"kerberos-keytab","secret":{"secretName":"kerberos-keytab"}}],"volumeMounts":[{"name":"kerberos-keytab","mountPath":"/etc/kerberos","readOnly":true}]}}}'The executor pods then contain the keytab at
/etc/kerberos/knimehub.keytab.In the preferences file, set the absolute path to the keytab:
text/instance/org.knime.kerberos/org.knime.kerberos.keytabFile=/etc/kerberos/knimehub.keytab
WARNING
The patch replaces the custom volumes and volume mounts of the execution context. Before running it, inspect the current configuration with kubectl get executioncontext <EXECUTION_CONTEXT_ID> -n knime -o yaml. Include all existing entries from both spec.executor.volumes and spec.executor.volumeMounts in the patch.
Anyone who can read secrets in the namespace can read the keytab. Restrict read access to secrets in the namespace to the administrators who need it.
KNIME preferences
KNIME Business Hub allows to distribute customization profiles, which can be used to distribute Kerberos preferences (including the krb5.conf) to KNIME Business Hub executors and KNIME Analytics Platform clients.
It is recommended to create separate customization profiles for KNIME Business Hub executors and for KNIME Analytics Platform clients.
To create a customization profile you need to first create an .epf preference file that will contain the Kerberos configuration preferences. The table below contains all supported Kerberos configuration options.
/instance/org.knime.kerberos/org.knime.kerberos.conf=<VALUE>
Specifies the Kerberos configuration options. Replace <VALUE> with:
FILE: to use Kerberos client configuration file (krb5.conf).DEFAULT: to use system defaults (discouraged).REALM_KDC: to provide realm and KDC directly in the preferences file.Preference Description Applies to /instance/org.knime.kerberos/org.knime.kerberos.conf.file=<PATH>Specifies the location to krb5.conffile. Replace<PATH>with the path tokrb5.conf.Only applies if FILEis selected in the option above./instance/org.knime.kerberos/org.knime.kerberos.kdc=<KDC_VALUE>Specifies KDC value. Replace <KDC_VALUE>with the IP or hostname of the KDC.Only applies if REALM_KDCis selected in the first option listed above./instance/org.knime.kerberos/org.knime.kerberos.realm=<REALM_VALUE>Specifies Realm value. Replace <REALM_VALUE>with the name of the realm (the name needs to be in uppercase letters).Only applies if REALM_KDCis selected in the first option listed above./instance/org.knime.kerberos/org.knime.kerberos.authMethod=<VALUE>Specifies the Kerberos authentication method. Replace <VALUE>with:
•KEYTAB: to use keytab and service principal (recommended for KNIME Business Hub executors)
•USER_PWD: to use username and password (recommended for KNIME Analytics Platform clients)All configurations /instance/org.knime.kerberos/org.knime.kerberos.keytabFile=<PATH_TO_KEYTAB>Specifies the absolute path to the keytab file on the executor. Don't add the keytab to the profile folder. See Providing the keytab file. Only applies if KEYTABis selected as authentication method./instance/org.knime.kerberos/org.knime.kerberos.keytabPrincipal=<PRINCIPAL_VALUE>Specifies the keytab service principal value. Only applies if KEYTABis selected as authentication method./instance/org.knime.kerberos/org.knime.kerberos.showIcon=<true|false>Specifies whether to show Kerberos login status bar in the lower part of KNIME Analytics Platform. Only for KNIME Analytics Platform clients. /instance/org.knime.kerberos/org.knime.kerberos.debug=<true|false>Specifies whether to enable Kerberos debug. All configurations /instance/org.knime.kerberos/org.knime.kerberos.debugLogLevel=<LOG_LEVEL>Specifies the log level if Kerberos debug is enabled. Replace <LOG_LEVEL>with eitherWARN,DEBUGorERROR.Only applies if Kerberos debug is enabled.
For example, a recommended Kerberos configurations for KNIME Business Hub executors could look like the following:
/instance/org.knime.kerberos/org.knime.kerberos.conf=FILE
/instance/org.knime.kerberos/org.knime.kerberos.conf.file=${profile:location}/krb5.conf
/instance/org.knime.kerberos/org.knime.kerberos.authMethod=KEYTAB
/instance/org.knime.kerberos/org.knime.kerberos.keytabFile=<PATH_TO_KEYTAB>
/instance/org.knime.kerberos/org.knime.kerberos.keytabPrincipal=<PRINCIPAL_VALUE>If
krb5.confis used, copy thekrb5.conffile into the profile folder so that it will be distributed to all KNIME Business Hub executors along with the preferences file.
Replace
<PATH_TO_KEYTAB>with the absolute path to the keytab file on the executor and<PRINCIPAL_VALUE>with the service principal. For where to place the keytab, see Providing the keytab file.
Now, once you created the .epf file you can create a .zip file that contains the following files:
preferences.epf— created in the step above.krb5.conf— created in the previous section.
Then follow the instructions to upload a customization profile to your KNIME Business Hub instance.
For KNIME Business Hub executors
To apply the customization profile to a KNIME Hub execution context's executor, follow the instructions in the Customization profiles section.
For KNIME Analytics Platform clients
To apply the customization profile to a KNIME Analytics Platform client, follow the instructions in the Apply a customization profile to KNIME Analytics Platform client section.
Export preferences from KNIME Analytics Platform
This section describes an alternative way to set up Kerberos preferences graphically, instead of writing the preferences lines manually. The Kerberos preferences can be configured graphically in the preferences page in KNIME Analytics Platform. After that the preferences can be exported and the relevant lines copied to the profile file.
- Start KNIME Analytics Platform.
- Set all Kerberos preferences via File → Preferences → KNIME → Kerberos.
- Export the
.epffile from KNIME Analytics Platform. To do so, first switch to classic user interface (you can find the option in the Modern UI under Menu), then go to File > Export Preferences…. Please refer to Kerberos User Guide for more information on the Kerberos preferences page. - Open the exported preferences file and copy all the lines starting with
/instance/org.knime.kerberos/into the profile file. - Please make sure that any paths set in the preferences are valid on the Hub instance:
If
krb5.confis used, thekrb5.conffile needs to be added together with the.epffile to the.zipfile that will be uploaded to the KNIME Business Hub. After that, change the path tokrb5.confas following:text/instance/org.knime.kerberos/org.knime.kerberos.conf.file=${profile:location}/krb5.confIf keytab is used, change the keytab path to its absolute path on the executor. See Providing the keytab file.