Skip to content

Port Status Attributes Cause Error 500 in Control center

Port Status Attributes Cause Error 500 in Control center in Keycloak Operational Issues.

4 min read Updated SS RS

Port Status Attributes Cause Error 500 in Control center#

The issue occurs when we try to add port status attributes for any service in Control Center.

Cause:

The producer is not mapped to the KPI. Map the producer to the KPI before adding attributes.

Keycloak Issues screenshot (page 36)

Solution:

Map the KPI to the instance with the producer in metric details.

Delay in Reflecting Control Center Changes on Heal UI#

Issue: The changes in threshold or persistency/suppression values made from Control center is not reflecting in HEAL UI on immediate basis.

Solution: Follow the below steps to rectify the issue:

  1. The issue is faced for one particular service.
  2. For this service, the threshold set at service level is getting reflected in service_kpi_threshold table in percona. But not reflecting in the UI.
  3. Set the threshold at instance level and it is successfully getting reflected in the UI.
  4. Hence, continue to update threshold at instance level as there are only two instances in this service.

Weak SSL/TLS Key Keycloak Ports#

Keycloak Issues screenshot (page 37)
  1. Update the Java Security file: Modify the java.Security file to adjust a parameter value. Change the jdk.tls.disabledAlgorithms setting from DH keySize < 1024 to DH keySize < 2048.

    The updated line should be as below:

    YAML

    jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, DH keySize <
    2048
    
  2. Validate TLS Cipher Key Size: Use the following NPM command to validate the TLS cipher key size:

    CSS

    nmap -sV --script ssl-enum-ciphers -p <keycloak_port> <keycloak_ip>
    
  3. Update Java Options in Configuration File:

    1. Modify the standalone.conf file by mounting it inside the Nomad file:

      File

      `"/tmp/standalone.conf:/opt/jboss/keycloak/bin/standalone.conf"`
      
    2. Update the JAVA_OPTS settings as follows:

      Bash

      JAVA_OPTS="-Xms${min_heap}m -Xmx${max_heap}m -XX:MetaspaceSize=96M -
      XX:MaxMetaspaceSize=${max_meta_space}m -
      Djava.net.preferIPv4Stack=true"
      JAVA_OPTS="$JAVA_OPTS -
      Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -
      Djava.awt.headless=true -Djdk.tls.ephemeralDHKeySize=2048"
      
  4. Restart Keycloak Service: After the changes, restart the Keycloak service to apply the updates.

Keycloak Restart Issues with Inbound/Outbound Tab Access#

Keycloak was restarting unexpectedly when accessing the inbound/outbound tabs.

The error was due to the logs displayed in the following exception:

Bash

java.lang.NoClassDefFoundError: Could not initialize class
org.elasticsearch.search.builder.SearchSourceBuilder

Solution:

First Solution:

  • In a session, modify the value of the consul key service/elasticsearch/ip to blank.
  • Restarted Keycloak, but it was operational only for 30 minutes.
  • There was high utilization (99%) of the Cassandra service, and observed the increase in its memory from 3GB to 7GB.

Additional Issue:

  1. Nomad status showed Keycloak as running, but it wasn't visible in podman ps, indicating that the Keycloak service had stopped.
  2. But the Analytics department was using an outdated Keycloak image, so it was updated to the latest version.

Second Solution:

  1. Updated Elasticsearch configurations in Keycloak:

    Bash

    elasticsearch.host={{ key "service/elasticsearch/ip" }}
    elasticsearch.port={{ key "service/elasticsearch/port" }}
    elasticsearch.protocol={{ key "service/elasticsearch/protocol" }}
    
  2. Restart Keycloak.

Further Errors Observed:

Logs showed errors, leading the development team to recommend setting certain values as EMPTY:

Bash

docker exited -> driver was unable to get the exit code, unknown
error code

Final Solution:

  1. Cleared Podman caches using the below command:

    Bash

    podman system prune -a
    
  2. Resolve the issue with the following database queries and updates:

    Bash

    select kpi_id kpiId, category_id categoryId, name,
    category_identifier identifier, kpi_type_id kpiTypeId,
    is_informative isInformative from view_kpi_category_details where
    kpi_id = 406
    INSERT INTO tag_mapping (tag_id, object_id, object_ref_table,
    tag_key, tag_value, created_time, updated_time, account_id,
    user_details_id) VALUES (5, 406, 'mst_kpi_details', 76, 'Success',
    '2019-08-09 00:00:00', '2019-08-09 00:00:00', 1, '7640123a-fbde-
    4fe5-9812-581cd1e3a9c1');
    select * from tag_mapping where tag_id = 5 and object_id= 406;
    update mst_category_details set status = 0 where id = 76;
    

Addressing No Rate Limiting on Endpoints#

The Nomad services were not starting up on the UAT server.

Network Mode Adjustment: After changing the network mode to ‘host’, which led to the successful operation of the services.

HAProxy Configuration Changes:

  1. Modify the haproxy.cfg file to configure Keycloak to run behind HAProxy.
  2. The changes and the haproxy.nomad file are attached in the comment.
  3. Update the below consul key with the value ‘9998’.

    Bash

    service/keycloak/port/https
    

Rate Limiting Implementation in HAProxy:

  1. Add specific lines to the haproxy.cfg file to implement rate limiting for account creation in the Control Center (CC). This includes a stick-table for tracking request rates and conditions to deny requests exceeding the rate limit.
  2. The configuration snippet is as follows:

    Bash

    stick-table type binary len 8 size 100k expire 100s store
    http_req_rate(59s)
    http-request track-sc0 base32+src
    http-request set-var(req.rate_limit)
    path,map_beg(/usr/local/etc/haproxy/rates.map,20000)
    http-request set-var(req.request_rate)
    base32+src,table_http_req_rate()
    acl rate_abuse var(req.rate_limit),sub(req.request_rate) lt 0
    http-request deny deny_status 429 if rate_abuse
    
  3. Include the rates.map file in the HAProxy directory, specifying the rate limit for account creation requests.

  4. Content of rates.map file:

    /appsone-controlcenter/v2.0/api/accounts 5 (indicating the number of accounts allowed in a specific time frame).