Skip to content

MASCORE-13194: Fix MREF AES encryption keystore not the same amongst all customer instances#2437

Open
LamyaG10 wants to merge 29 commits into
masterfrom
mascore-13194
Open

MASCORE-13194: Fix MREF AES encryption keystore not the same amongst all customer instances#2437
LamyaG10 wants to merge 29 commits into
masterfrom
mascore-13194

Conversation

@LamyaG10

Copy link
Copy Markdown

Isuue

https://jsw.ibm.com/browse/MASCORE-13194

Description

Implemented ICN (IBM Customer Number) extraction from multiple sources to support customer-level secrets in Facilities and other MAS applications, enabling both standard and centralized SLS deployments.

  1. Direct ICN (SLS_LICENSE_ICN): Pre-configured ICN passed directly via environment variable (highest priority)
  1. Entitlement ICN (LICENSE_FILE): Extracted from license file content for standard SLS deployments
  1. Centralized ICN (CENTRALIZED_SLS_SERVICE): Extracted from centralized SLS service path for shared SLS deployments

Screenshots

  1. Direct ICN
Screenshot 2026-06-26 at 7 40 12 PM SLS configuration Screenshot 2026-06-26 at 7 42 25 PM Parameters Screenshot 2026-06-26 at 7 44 02 PM APP-CFG-FACILTIES LOG - ICN EXTRACTION & PASSWORD SETUP
  1. Entitlement LIC
Screenshot 2026-06-26 at 7 48 44 PM SLS configuration Screenshot 2026-06-26 at 7 47 08 PM APP-CFG-FACILTIES LOG - ICN EXTRACTION & PASSWORD SETUP
  1. Centralized ICN
image SLS configuration Screenshot 2026-06-26 at 7 32 49 PM APP-CFG-FACILTIES LOG - ICN EXTRACTION Screenshot 2026-06-26 at 7 36 32 PM APP-CFG-FACILTIES LOG - PASSWORD SETUP

LamyaG10 added 27 commits June 5, 2026 17:57
@LamyaG10 LamyaG10 requested a review from mnivedithaa June 26, 2026 14:21
@LamyaG10 LamyaG10 requested a review from a team as a code owner June 26, 2026 14:21
@LamyaG10 LamyaG10 requested a review from rbinns June 29, 2026 04:18
echo "Error: Secret name $FACILITIES_LIBERTY_EXTENSIONS_SECRET_NAME does not match ${MAS_WORKSPACE_ID}-facilities-lexml--sn"

# Sanitize ICN to prevent path injection (allow only alphanumeric, underscore, hyphen)
SANITIZED_ICN=$(echo "${ICN}" | tr -cd 'A-Za-z0-9_-')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to use the passed ICN value as is




function gitops_suite_app_config_help() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass the newly added params to this function

fi

# Try SLS_LICENSE_FILE if LICENSE_FILE didn't work
if [[ -z "${ICN}" ]] && [[ -n "${SLS_LICENSE_FILE}" ]] && [[ -f "${SLS_LICENSE_FILE}" ]]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only LICENSE_FILE is passed. In that case, we need not check SLS_LICENSE_FILE

Comment on lines +31 to +34
- name: sls_license_icn
value: $(params.sls_license_icn)
- name: centralized_sls_service
value: $(params.centralized_sls_service)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This info is required only for Facilities. Need to be removed for other apps

@LamyaG10 LamyaG10 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have made the requested changes.

Comment on lines +549 to +567
# Source gitops_utils unconditionally in callback context
# Nested functions require explicit sourcing even if parent has it loaded
if [[ -n "${CLI_DIR}" ]]; then
echo "DEBUG: Sourcing ${CLI_DIR}/functions/gitops_utils"
ls -l "${CLI_DIR}/functions/gitops_utils" || echo "WARNING: File not found"
if ! source "${CLI_DIR}/functions/gitops_utils"; then
echo "ERROR: Failed to source gitops_utils from ${CLI_DIR}/functions/gitops_utils"
exit 1
fi
else
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "DEBUG: Sourcing ${DIR}/gitops_utils"
ls -l "${DIR}/gitops_utils" || echo "WARNING: File not found"
if ! source "${DIR}/gitops_utils"; then
echo "ERROR: Failed to source gitops_utils from ${DIR}/gitops_utils"
exit 1
fi
fi
echo "- Sourced gitops_utils in apply_suite_app_config_changes callback"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't need to source the gitops_utils as it should already be sourced

Comment on lines +571 to +582
declare -F manage_customer_mref_password || echo "WARNING: Function not found in declare -F"

if ! declare -F manage_customer_mref_password >/dev/null; then
echo "ERROR: manage_customer_mref_password function not loaded after sourcing gitops_utils"
echo "DEBUG: Checking file contents for function definition"
if [[ -n "${CLI_DIR}" ]]; then
grep -n "^function manage_customer_mref_password" "${CLI_DIR}/functions/gitops_utils" || echo "Function definition not found in file"
else
grep -n "^function manage_customer_mref_password" "${DIR}/gitops_utils" || echo "Function definition not found in file"
fi
exit 1
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code is delivered as a container image so the function in gitops_utils will be available so no need to check it

--manage-update-schedule ${COLOR_YELLOW}MANAGE_UPDATE_SCHEDULE${TEXT_RESET} Cron based schedule to indicate when manage will do the offline update when the onlineUpgrade is set in the ManageWorkspace CR. Optional as default is "0 0 * * *"

SLS License Configuration:
--sls-license-icn ${COLOR_YELLOW}SLS_LICENSE_ICN${TEXT_RESET} SLS License ICN (Installation Customer Number)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is "IBM customer number"

Comment on lines +60 to +61
--license-file ${COLOR_YELLOW}LICENSE_FILE${TEXT_RESET} Path to SLS license file (ICN will be extracted)
--centralized-sls-service ${COLOR_YELLOW}CENTRALIZED_SLS_SERVICE${TEXT_RESET} Centralized SLS service path

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it isn't obvious that you only need one of these and not all three. Can we update the description to say what order these will be check in, i.e. the SLS_LICENSE_ICN first, and if that is not set then LICENSE_FILE and if that is not set then CENTRALIZED_SLS_SERVICE (which I think is a ref path to something? that might need an example or pointer to another function)

Comment on lines +233 to +247
if ! type manage_customer_mref_password &>/dev/null; then
if [[ -n "${CLI_DIR}" ]]; then
if ! source "${CLI_DIR}/functions/gitops_utils"; then
echo "ERROR: Failed to source gitops_utils from ${CLI_DIR}/functions/gitops_utils"
exit 1
fi
else
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if ! source "${DIR}/gitops_utils"; then
echo "ERROR: Failed to source gitops_utils from ${DIR}/gitops_utils"
exit 1
fi
fi
echo "- Sourced gitops_utils for manage_customer_mref_password function"
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't need this

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants