Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tls version and cipher suit configuration #3943

Merged
merged 9 commits into from
Jan 14, 2025
53 changes: 51 additions & 2 deletions api-catalog-package/src/main/resources/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,52 @@ if [ "${ATTLS_CLIENT_ENABLED}" = "true" ]; then
internalProtocol=http
fi


get_enabled_protocol_limit() {
target=$1
type=$2
key_component="ZWE_configs_zowe_network_${target}_tls_${type}Tls"
value_component=$(eval echo \$$key_component)
key_gateway="ZWE_components_gateway_zowe_network_${target}_tls_${type}Tls"
value_gateway=$(eval echo \$$key_gateway)
key_zowe="ZWE_zowe_network_${target}_tls_${type}Tls"
value_zowe=$(eval echo \$$key_zowe)
enabled_protocol_limit=${value_component:-${value_gateway:-${value_zowe:-}}}
}

extract_between() {
echo "$1" | sed -e "s/.*$2,//" -e "s/$3.*//"
}

get_enabled_protocol() {
target=$1
get_enabled_protocol_limit "${target}" "min"
enabled_protocols_min=${enabled_protocol_limit}
get_enabled_protocol_limit "${target}" "max"
enabled_protocols_max=${enabled_protocol_limit}

if [ "${enabled_protocols_min:-}" = "${enabled_protocols_max:-}" ]; then
result="${enabled_protocols_max:-}"
elif [ -z "${enabled_protocols_min:-}" ]; then
result="${enabled_protocols_max:-}"
else
enabled_protocols_max=${enabled_protocols_max:-"TLSv1.2"}
enabled_protocols=,TLSv1,TLSv1.1,TLSv1.2,TLSv1.3,TLSv1.4,
# Extract protocols between min and max (inclusive)
result=$(extract_between "$enabled_protocols" "$enabled_protocols_min" "$enabled_protocols_max")
result="$enabled_protocols_min,$result$enabled_protocols_max"
fi
}

get_enabled_protocol_limit "server" "max"
server_protocol=${enabled_protocol_limit:-"TLS"}
get_enabled_protocol "server"
server_enabled_protocols=${result:-"TLSv1.2"}
server_ciphers=${ZWE_configs_zowe_network_server_tls_ciphers:-${ZWE_components_gateway_zowe_network_server_tls_ciphers:-${ZWE_zowe_network_server_tls_ciphers:-TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384}}}
get_enabled_protocol "client"
client_enabled_protocols=${ZWE_components_gateway_apiml_httpclient_ssl_enabled_protocols:-${result:-${server_enabled_protocols}}}
client_ciphers=${ZWE_configs_zowe_network_client_tls_ciphers:-${ZWE_components_gateway_zowe_network_client_tls_ciphers:-${ZWE_zowe_network_client_tls_ciphers:-${server_ciphers}}}}

keystore_type="${ZWE_configs_certificate_keystore_type:-${ZWE_zowe_certificate_keystore_type:-PKCS12}}"
keystore_pass="${ZWE_configs_certificate_keystore_password:-${ZWE_zowe_certificate_keystore_password}}"
key_alias="${ZWE_configs_certificate_keystore_alias:-${ZWE_zowe_certificate_keystore_alias}}"
Expand Down Expand Up @@ -251,11 +297,9 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${CATALOG_CODE} java \
-Dapiml.catalog.customStyle.headerColor=${ZWE_configs_apiml_catalog_customStyle_headerColor:-} \
-Dapiml.catalog.customStyle.textColor=${ZWE_configs_apiml_catalog_customStyle_textColor:-} \
-Dapiml.catalog.customStyle.docLink=${ZWE_configs_apiml_catalog_customStyle_docLink:-} \
-Dapiml.httpclient.ssl.enabled-protocols=${ZWE_components_gateway_apiml_httpclient_ssl_enabled_protocols:-"TLSv1.2"} \
-Dspring.profiles.include=$LOG_LEVEL \
-Dserver.address=0.0.0.0 \
-Dserver.ssl.enabled=${ZWE_configs_server_ssl_enabled:-true} \
-Dserver.ssl.protocol=${ZWE_configs_server_ssl_protocol:-"TLSv1.2"} \
-Dserver.ssl.keyStore="${keystore_location}" \
-Dserver.ssl.keyStoreType="${keystore_type}" \
-Dserver.ssl.keyStorePassword="${keystore_pass}" \
Expand All @@ -264,6 +308,11 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${CATALOG_CODE} java \
-Dserver.ssl.trustStore="${truststore_location}" \
-Dserver.ssl.trustStoreType="${truststore_type}" \
-Dserver.ssl.trustStorePassword="${truststore_pass}" \
-Dserver.ssl.ciphers=${server_ciphers} \
-Dserver.ssl.protocol=${ZWE_configs_server_ssl_protocol:-${server_protocol}} \
-Dserver.ssl.enabled-protocols=${server_enabled_protocols} \
-Dapiml.httpclient.ssl.enabled-protocols=${ZWE_components_gateway_apiml_httpclient_ssl_enabled_protocols:-${client_enabled_protocols}} \
-Djdk.tls.client.cipherSuites=${client_ciphers} \
-Djava.protocol.handler.pkgs=com.ibm.crypto.provider \
-Dloader.path=${COMMON_LIB} \
-Djava.library.path=${LIBPATH} \
Expand Down
52 changes: 50 additions & 2 deletions caching-service-package/src/main/resources/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,51 @@ if [ "${ATTLS_ENABLED}" = "true" -o "${ATTLS_CLIENT_ENABLED}" = "true" ]; then
ZWE_DISCOVERY_SERVICES_LIST=$(echo "${ZWE_DISCOVERY_SERVICES_LIST=}" | sed -e 's|https://|http://|g')
fi

get_enabled_protocol_limit() {
target=$1
type=$2
key_component="ZWE_configs_zowe_network_${target}_tls_${type}Tls"
value_component=$(eval echo \$$key_component)
key_gateway="ZWE_components_gateway_zowe_network_${target}_tls_${type}Tls"
value_gateway=$(eval echo \$$key_gateway)
key_zowe="ZWE_zowe_network_${target}_tls_${type}Tls"
value_zowe=$(eval echo \$$key_zowe)
enabled_protocol_limit=${value_component:-${value_gateway:-${value_zowe:-}}}
}

extract_between() {
echo "$1" | sed -e "s/.*$2,//" -e "s/$3.*//"
}

get_enabled_protocol() {
target=$1
get_enabled_protocol_limit "${target}" "min"
enabled_protocols_min=${enabled_protocol_limit}
get_enabled_protocol_limit "${target}" "max"
enabled_protocols_max=${enabled_protocol_limit}

if [ "${enabled_protocols_min:-}" = "${enabled_protocols_max:-}" ]; then
result="${enabled_protocols_max:-}"
elif [ -z "${enabled_protocols_min:-}" ]; then
result="${enabled_protocols_max:-}"
else
enabled_protocols_max=${enabled_protocols_max:-"TLSv1.2"}
enabled_protocols=,TLSv1,TLSv1.1,TLSv1.2,TLSv1.3,TLSv1.4,
# Extract protocols between min and max (inclusive)
result=$(extract_between "$enabled_protocols" "$enabled_protocols_min" "$enabled_protocols_max")
result="$enabled_protocols_min,$result$enabled_protocols_max"
fi
}

get_enabled_protocol_limit "server" "max"
server_protocol=${enabled_protocol_limit:-"TLS"}
get_enabled_protocol "server"
server_enabled_protocols=${result:-"TLSv1.2"}
server_ciphers=${ZWE_configs_zowe_network_server_tls_ciphers:-${ZWE_components_gateway_zowe_network_server_tls_ciphers:-${ZWE_zowe_network_server_tls_ciphers:-TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384}}}
get_enabled_protocol "client"
client_enabled_protocols=${ZWE_components_gateway_apiml_httpclient_ssl_enabled_protocols:-${result:-${server_enabled_protocols}}}
client_ciphers=${ZWE_configs_zowe_network_client_tls_ciphers:-${ZWE_components_gateway_zowe_network_client_tls_ciphers:-${ZWE_zowe_network_client_tls_ciphers:-${server_ciphers}}}}

keystore_type="${ZWE_configs_certificate_keystore_type:-${ZWE_zowe_certificate_keystore_type:-PKCS12}}"
keystore_pass="${ZWE_configs_certificate_keystore_password:-${ZWE_zowe_certificate_keystore_password}}"
key_alias="${ZWE_configs_certificate_keystore_alias:-${ZWE_zowe_certificate_keystore_alias}}"
Expand Down Expand Up @@ -214,7 +259,6 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${CACHING_CODE} java \
-Dapiml.service.customMetadata.apiml.gatewayPort=${ZWE_components_gateway_port:-7554} \
-Dapiml.service.ssl.verifySslCertificatesOfServices=${verifySslCertificatesOfServices:-false} \
-Dapiml.service.ssl.nonStrictVerifySslCertificatesOfServices=${nonStrictVerifySslCertificatesOfServices:-false} \
-Dapiml.httpclient.ssl.enabled-protocols=${ZWE_components_gateway_apiml_httpclient_ssl_enabled_protocols:-"TLSv1.2"} \
-Dcaching.storage.evictionStrategy=${ZWE_configs_storage_evictionStrategy:-reject} \
-Dcaching.storage.size=${ZWE_configs_storage_size:-10000} \
-Dcaching.storage.mode=${ZWE_configs_storage_mode:-inMemory} \
Expand All @@ -227,7 +271,9 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${CACHING_CODE} java \
-Dcaching.storage.infinispan.initialHosts=${ZWE_configs_storage_infinispan_initialHosts:-localhost[7098]} \
-Dserver.address=0.0.0.0 \
-Dserver.ssl.enabled=${ZWE_configs_server_ssl_enabled:-true} \
-Dserver.ssl.protocol=${ZWE_configs_server_ssl_protocol:-"TLSv1.2"} \
-Dserver.ssl.protocol=${ZWE_configs_server_ssl_protocol:-${server_protocol}} \
-Dserver.ssl.ciphers=${server_ciphers} \
-Dserver.ssl.enabled-protocols=${server_enabled_protocols} \
-Dserver.ssl.keyStore="${keystore_location}" \
-Dserver.ssl.keyStoreType="${keystore_type}" \
-Dserver.ssl.keyStorePassword="${keystore_pass}" \
Expand All @@ -236,6 +282,8 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${CACHING_CODE} java \
-Dserver.ssl.trustStore="${truststore_location}" \
-Dserver.ssl.trustStoreType="${truststore_type}" \
-Dserver.ssl.trustStorePassword="${truststore_pass}" \
-Dapiml.httpclient.ssl.enabled-protocols=${ZWE_components_gateway_apiml_httpclient_ssl_enabled_protocols:-${client_enabled_protocols}} \
-Djdk.tls.client.cipherSuites=${client_ciphers} \
-Djava.protocol.handler.pkgs=com.ibm.crypto.provider \
-Djavax.net.debug=${ZWE_configs_sslDebug:-""} \
-Djava.library.path=${LIBPATH} \
Expand Down
48 changes: 48 additions & 0 deletions cloud-gateway-package/src/main/resources/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,49 @@ if [ "${ATTLS_ENABLED}" = "true" -o "${ATTLS_CLIENT_ENABLED}" = "true" ]; then
ZWE_DISCOVERY_SERVICES_LIST=$(echo "${ZWE_DISCOVERY_SERVICES_LIST=}" | sed -e 's|https://|http://|g')
fi

get_enabled_protocol_limit() {
target=$1
type=$2
key_component="ZWE_configs_zowe_network_${target}_tls_${type}Tls"
value_component=$(eval echo \$$key_component)
key_zowe="ZWE_zowe_network_${target}_tls_${type}Tls"
value_zowe=$(eval echo \$$key_zowe)
enabled_protocol_limit=${value_component:-${value_zowe:-}}
}

extract_between() {
echo "$1" | sed -e "s/.*$2,//" -e "s/$3.*//"
}

get_enabled_protocol() {
target=$1
get_enabled_protocol_limit "${target}" "min"
enabled_protocols_min=${enabled_protocol_limit}
get_enabled_protocol_limit "${target}" "max"
enabled_protocols_max=${enabled_protocol_limit}

if [ "${enabled_protocols_min:-}" = "${enabled_protocols_max:-}" ]; then
result="${enabled_protocols_max:-}"
elif [ -z "${enabled_protocols_min:-}" ]; then
result="${enabled_protocols_max:-}"
else
enabled_protocols_max=${enabled_protocols_max:-"TLSv1.2"}
enabled_protocols=,TLSv1,TLSv1.1,TLSv1.2,TLSv1.3,TLSv1.4,
# Extract protocols between min and max (inclusive)
result=$(extract_between "$enabled_protocols" "$enabled_protocols_min" "$enabled_protocols_max")
result="$enabled_protocols_min,$result$enabled_protocols_max"
fi
}

get_enabled_protocol_limit "server" "max"
server_protocol=${enabled_protocol_limit:-"TLS"}
get_enabled_protocol "server"
server_enabled_protocols=${result:-"TLSv1.2"}
server_ciphers=${ZWE_configs_zowe_network_server_tls_ciphers:-${ZWE_components_gateway_zowe_network_server_tls_ciphers:-${ZWE_zowe_network_server_tls_ciphers:-TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384}}}
get_enabled_protocol "client"
client_enabled_protocols=${ZWE_configs_apiml_httpclient_ssl_enabled_protocols:-${result:-${server_enabled_protocols}}}
client_ciphers=${ZWE_configs_zowe_network_client_tls_ciphers:-${ZWE_components_gateway_zowe_network_client_tls_ciphers:-${ZWE_zowe_network_client_tls_ciphers:-${server_ciphers}}}}

keystore_type="${ZWE_configs_certificate_keystore_type:-${ZWE_zowe_certificate_keystore_type:-PKCS12}}"
keystore_pass="${ZWE_configs_certificate_keystore_password:-${ZWE_zowe_certificate_keystore_password}}"
key_alias="${ZWE_configs_certificate_keystore_alias:-${ZWE_zowe_certificate_keystore_alias}}"
Expand Down Expand Up @@ -188,6 +231,11 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${CLOUD_GATEWAY_CODE} java \
-Dserver.ssl.trustStore="${truststore_location}" \
-Dserver.ssl.trustStoreType="${truststore_type}" \
-Dserver.ssl.trustStorePassword="${truststore_pass}" \
-Dserver.ssl.ciphers=${server_ciphers} \
-Dserver.ssl.protocol=${ZWE_configs_server_ssl_protocol:-${server_protocol}} \
-Dserver.ssl.enabled-protocols=${server_enabled_protocols} \
-Dapiml.httpclient.ssl.enabled-protocols=${client_enabled_protocols} \
-Djdk.tls.client.cipherSuites=${client_ciphers} \
-Djava.protocol.handler.pkgs=com.ibm.crypto.provider \
-Djavax.net.debug=${ZWE_configs_sslDebug:-""} \
-Djava.library.path=${LIBPATH} \
Expand Down
52 changes: 50 additions & 2 deletions discovery-package/src/main/resources/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,51 @@ LIBPATH="$LIBPATH":"${JAVA_HOME}/lib/s390/default"
LIBPATH="$LIBPATH":"${JAVA_HOME}/lib/s390/j9vm"
LIBPATH="$LIBPATH":"${LIBRARY_PATH}"

get_enabled_protocol_limit() {
target=$1
type=$2
key_component="ZWE_configs_zowe_network_${target}_tls_${type}Tls"
value_component=$(eval echo \$$key_component)
key_gateway="ZWE_components_gateway_zowe_network_${target}_tls_${type}Tls"
value_gateway=$(eval echo \$$key_gateway)
key_zowe="ZWE_zowe_network_${target}_tls_${type}Tls"
value_zowe=$(eval echo \$$key_zowe)
enabled_protocol_limit=${value_component:-${value_gateway:-${value_zowe:-}}}
}

extract_between() {
echo "$1" | sed -e "s/.*$2,//" -e "s/$3.*//"
}

get_enabled_protocol() {
target=$1
get_enabled_protocol_limit "${target}" "min"
enabled_protocols_min=${enabled_protocol_limit}
get_enabled_protocol_limit "${target}" "max"
enabled_protocols_max=${enabled_protocol_limit}

if [ "${enabled_protocols_min:-}" = "${enabled_protocols_max:-}" ]; then
result="${enabled_protocols_max:-}"
elif [ -z "${enabled_protocols_min:-}" ]; then
result="${enabled_protocols_max:-}"
else
enabled_protocols_max=${enabled_protocols_max:-"TLSv1.2"}
enabled_protocols=,TLSv1,TLSv1.1,TLSv1.2,TLSv1.3,TLSv1.4,
# Extract protocols between min and max (inclusive)
result=$(extract_between "$enabled_protocols" "$enabled_protocols_min" "$enabled_protocols_max")
result="$enabled_protocols_min,$result$enabled_protocols_max"
fi
}

get_enabled_protocol_limit "server" "max"
server_protocol=${enabled_protocol_limit:-"TLS"}
get_enabled_protocol "server"
server_enabled_protocols=${result:-"TLSv1.2"}
server_ciphers=${ZWE_configs_zowe_network_server_tls_ciphers:-${ZWE_components_gateway_zowe_network_server_tls_ciphers:-${ZWE_zowe_network_server_tls_ciphers:-TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384}}}
get_enabled_protocol "client"
client_enabled_protocols=${ZWE_components_gateway_apiml_httpclient_ssl_enabled_protocols:-${result:-${server_enabled_protocols}}}
client_ciphers=${ZWE_configs_zowe_network_client_tls_ciphers:-${ZWE_components_gateway_zowe_network_client_tls_ciphers:-${ZWE_zowe_network_client_tls_ciphers:-${server_ciphers}}}}

keystore_type="${ZWE_configs_certificate_keystore_type:-${ZWE_zowe_certificate_keystore_type:-PKCS12}}"
keystore_pass="${ZWE_configs_certificate_keystore_password:-${ZWE_zowe_certificate_keystore_password}}"
key_alias="${ZWE_configs_certificate_keystore_alias:-${ZWE_zowe_certificate_keystore_alias}}"
Expand Down Expand Up @@ -231,9 +276,12 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${DISCOVERY_CODE} java \
-Dapiml.security.ssl.verifySslCertificatesOfServices=${verifySslCertificatesOfServices:-false} \
-Dapiml.security.ssl.nonStrictVerifySslCertificatesOfServices=${nonStrictVerifySslCertificatesOfServices:-false} \
-Dapiml.security.auth.cookieProperties.cookieName=${cookieName:-apimlAuthenticationToken} \
-Dapiml.httpclient.ssl.enabled-protocols=${ZWE_components_gateway_apiml_httpclient_ssl_enabled_protocols:-"TLSv1.2"} \
-Dserver.ssl.enabled=${ZWE_configs_server_ssl_enabled:-true} \
-Dserver.ssl.protocol=${ZWE_configs_server_ssl_protocol:-"TLSv1.2"} \
-Dapiml.httpclient.ssl.enabled-protocols=${ZWE_components_gateway_apiml_httpclient_ssl_enabled_protocols:-${client_enabled_protocols}} \
-Djdk.tls.client.cipherSuites=${client_ciphers} \
-Dserver.ssl.ciphers=${server_ciphers} \
-Dserver.ssl.protocol=${ZWE_configs_server_ssl_protocol:-${server_protocol}} \
-Dserver.ssl.enabled-protocols=${server_enabled_protocols} \
-Dserver.ssl.keyStore="${keystore_location}" \
-Dserver.ssl.keyStoreType="${keystore_type}" \
-Dserver.ssl.keyStorePassword="${keystore_pass}" \
Expand Down
Loading
Loading