Repository: provectus/kafka-ui
Issue: Wizard: SASL_SSL generates wrong case of 'useKeytab'
Labels: type/bug
scope/frontend
status/accepted
area/wizard

### Issue submitter TODO list

- [X] I've looked up my issue in [FAQ](https://docs.kafka-ui.provectus.io/faq/common-problems)
- [X] I've searched for an already existing issues [here](https://github.com/provectus/kafka-ui/issues)
- [X] I've tried running `master`-labeled docker image and the issue still persists there
- [X] I'm running a supported version of the application which is listed [here](https://github.com/provectus/kafka-ui/blob/master/SECURITY.md)

### Describe the bug (actual behavior)

Create new cluster with SASL_SSL with kerberos will generate wrong sasl.jaas.config

```
  - bootstrapServers: xxx:9092,xxx:9092,xxx:9092
    name: test-cluster
    properties:
      security.protocol: SASL_SSL
      sasl.mechanism: GSSAPI
      sasl.jaas.config: com.sun.security.auth.module.Krb5LoginModule required useKeytab="true"
        keyTab="/etc/kafkaui/uploads/kfuat_BDH_CES.client.keytab-1686539412" storeKey="true"
        principal="priciple@KAFKA.SECURE";
      sasl.kerberos.service.name: bigfoot
    readOnly: true
    ssl:
      truststoreLocation: /etc/kafkaui/uploads/my.client.truststore.jks-1686539188
      truststorePassword: xxxxx
```
      
This will cause the following error
```
Caused by: javax.security.auth.login.LoginException: Configuration Error - useKeyTab should be set to true to use the keytab
```


### Expected behavior

sasl.jaas.config must include useKeyTab (with uppercase T) and without double quote between boolean value.

### Your installation details

Commit: fdd9ad9

### Steps to reproduce

Create new cluster with SASL_SSL with kerberos and keytab file.




### Screenshots

_No response_

### Logs

_No response_

### Additional context

_No response_

Issue comments:
Hello there pombuppa! 👋

Thank you and congratulations 🎉 for opening your very first issue in this project! 💖

In case you want to claim this issue, please comment down below! We will try to get back to you as soon as we can. 👀
@pombuppa thanks for reporting this, could you try the following docker image?
`public.ecr.aws/provectus/kafka-ui-custom-build:3934`


Pull request review comments:

Patch that resolved the issue:
diff --git a/kafka-ui-react-app/src/widgets/ClusterConfigForm/utils/getJaasConfig.ts b/kafka-ui-react-app/src/widgets/ClusterConfigForm/utils/getJaasConfig.ts
index 065612451fc..23578159d44 100644
--- a/kafka-ui-react-app/src/widgets/ClusterConfigForm/utils/getJaasConfig.ts
+++ b/kafka-ui-react-app/src/widgets/ClusterConfigForm/utils/getJaasConfig.ts
@@ -20,7 +20,13 @@ export const getJaasConfig = (
   options: Record<string, string>
 ) => {
   const optionsString = Object.entries(options)
-    .map(([key, value]) => (isUndefined(value) ? null : ` ${key}="${value}"`))
+    .map(([key, value]) => {
+      if (isUndefined(value)) return null;
+      if (value === 'true' || value === 'false') {
+        return ` ${key}=${value}`;
+      }
+      return ` ${key}="${value}"`;
+    })
     .join('');
 
   return `${JAAS_CONFIGS[method]} required${optionsString};`;
diff --git a/kafka-ui-react-app/src/widgets/ClusterConfigForm/utils/transformFormDataToPayload.ts b/kafka-ui-react-app/src/widgets/ClusterConfigForm/utils/transformFormDataToPayload.ts
index 0a5d6c35235..91f9ad1e289 100644
--- a/kafka-ui-react-app/src/widgets/ClusterConfigForm/utils/transformFormDataToPayload.ts
+++ b/kafka-ui-react-app/src/widgets/ClusterConfigForm/utils/transformFormDataToPayload.ts
@@ -122,7 +122,7 @@ export const transformFormDataToPayload = (data: ClusterConfigFormValues) => {
           'sasl.mechanism': 'GSSAPI',
           'sasl.kerberos.service.name': props.saslKerberosServiceName,
           'sasl.jaas.config': getJaasConfig('SASL/GSSAPI', {
-            useKeytab: props.keyTabFile ? 'true' : 'false',
+            useKeyTab: props.keyTabFile ? 'true' : 'false',
             keyTab: props.keyTabFile,
             storeKey: String(!!props.storeKey),
             principal: props.principal,


Test patch: