Skip to content

KC_CACHE_EMBEDDED_MTLS_ENABLED is ignored #34644

Closed
@philliphnguyen

Description

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

infinispan

Describe the bug

The environment variable KC_CACHE_EMBEDDED_MTLS_ENABLED is always evaluating to its default value, false.

In the CacheManagerFactory class, the condition

Configuration.isTrue(CachingOptions.CACHE_EMBEDDED_MTLS_ENABLED_PROPERTY)

is always set to false.

The problem is that the kc. header, known as NS_KEYCLOAK_PREFIX, isn't being added to the string when being evaluated. A workaround for this problem is to use CACHE_EMBEDDED_MTLS_ENABLED, without the KC_ prefix.

To fix this, there are two potential solutions.

  1. Add the NS_KEYCLOAK_PREFIX to the Configuration.isTrue(String) method.
    Change
public static boolean isTrue(String propertyName) {
        return getOptionalBooleanValue(propertyName).orElse(false);
    }

to

public static boolean isTrue(String propertyName) {
        return getOptionalBooleanValue(NS_KEYCLOAK_PREFIX + propertyName).orElse(false);
    }
  1. Use Configuration.isTrue(Option) instead in CacheManagerFactory.
    Change
if (Configuration.isTrue(CachingOptions.CACHE_EMBEDDED_MTLS_ENABLED_PROPERTY)) {
            ...
        }

to

if (Configuration.isTrue(CachingOptions.CACHE_EMBEDDED_MTLS_ENABLED)) {
            ...
        }

Version

26.0.0

Regression

  • The issue is a regression

Expected behavior

By setting KC_CACHE_EMBEDDED_MTLS_ENABLED to true, the log message MTLS enabled for communications for embedded caches should appear

Actual behavior

Since it's always defaulting to false, the log message doesn't appear and TLS doesn't get properly set up.

How to Reproduce?

Set the environment variable KC_CACHE_EMBEDDED_MTLS_ENABLED to true, and the MTLS enabled logging message will not appear.

Anything else?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions