Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-24884

Insufficient logging while RBAC is used for HAL console secured by OIDC

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • None
    • None
    • Web Console
    • False
    • None
    • False
    • Hide

      Follow the steps in Keycloak’s getting started guide to add a new realm called wildfly-infra.

      Then, create a new OpenID Connect client called wildfly-console. Set the Valid Redirect URIs using the URI used to access the WildFly management console, e.g., http://localhost:9990/console/. Similarly, you’ll also need to set *Web Origins using the management port for your WildFly instance, e.g., http://localhost:9990.

      Next, create a second OpenID Connect client called wildfly-management. This will be a bearer-only client so in the Capability configuration, be sure to uncheck the Standard flow and Direct access grants.

      Configuring WildFly to enable Role Based Access Control (RBAC), And don't create ADMINISTRATOR role. 

      Elytron OIDC Client Subsystem Configuration
      We need to add a secure-deployment resource that references the wildfly-management client that was created in the previous section.

      A secure-server that references the wildfly-console client is also needed.

      Some example CLI commands that add these resources can be seen here:
      Configure the Keycloak provider

      /subsystem=elytron-oidc-client/provider=keycloak:add(provider-url=http://localhost:8180/realms/wildfly-infra)

      Create a secure-deployment in order to protect mgmt interface

      /subsystem=elytron-oidc-client/secure-deployment=wildfly-management:add(provider=keycloak,client-id=wildfly-management,principal-attribute=preferred_username,bearer-only=true,ssl-required=EXTERNAL)

      Enable RBAC where roles are obtained from the identity

      /core-service=management/access=authorization:write-attribute(name=provider,value=rbac)
      /core-service=management/access=authorization:write-attribute(name=use-identity-roles,value=true)

      Create a secure-server in order to publish the management console configuration via mgmt interface

      /subsystem=elytron-oidc-client/secure-server=wildfly-console:add(provider=keycloak,client-id=wildfly-console,public-client=true)

      Reload

      reload

      Show
      Follow the steps in Keycloak’s getting started guide to add a new realm called wildfly-infra. Then, create a new OpenID Connect client called wildfly-console. Set the Valid Redirect URIs using the URI used to access the WildFly management console, e.g.,  http://localhost:9990/console/ . Similarly, you’ll also need to set *Web Origins using the management port for your WildFly instance, e.g.,  http://localhost:9990 . Next, create a second OpenID Connect client called wildfly-management. This will be a bearer-only client so in the Capability configuration, be sure to uncheck the Standard flow and Direct access grants. Configuring WildFly to enable Role Based Access Control (RBAC), And don't create ADMINISTRATOR role.   Elytron OIDC Client Subsystem Configuration We need to add a secure-deployment resource that references the wildfly-management client that was created in the previous section. A secure-server that references the wildfly-console client is also needed. Some example CLI commands that add these resources can be seen here: Configure the Keycloak provider /subsystem=elytron-oidc-client/provider=keycloak:add(provider-url= http://localhost:8180/realms/wildfly-infra ) Create a secure-deployment in order to protect mgmt interface /subsystem=elytron-oidc-client/secure-deployment=wildfly-management:add(provider=keycloak,client-id=wildfly-management,principal-attribute=preferred_username,bearer-only=true,ssl-required=EXTERNAL) Enable RBAC where roles are obtained from the identity /core-service=management/access=authorization:write-attribute(name=provider,value=rbac) /core-service=management/access=authorization:write-attribute(name=use-identity-roles,value=true) Create a secure-server in order to publish the management console configuration via mgmt interface /subsystem=elytron-oidc-client/secure-server=wildfly-console:add(provider=keycloak,client-id=wildfly-console,public-client=true) Reload reload

      If a user with insufficient role is authenticated. Then is produced only debug message in log of server: 

      17:58:56,684 DEBUG [org.jboss.as.controller.management-operation] (External Management Request Threads – 1) WFLYCTL0017: Operation ("read-resource") failed - address: ([]) - failure description: "WFLYCTL0313: Unauthorized to execute operation 'read-resource' for resource '[]' – \"WFLYCTL0332: Permission denied\""

      And the HAL console page is blank without any text, warning or error.

      When the debug mode isn't enabled then it doesn't provide enough information what is wrong.

              hpehl@redhat.com Harald Pehl
              rhn-support-kstekovi Krystof Stekovic
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: