diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f15bf7..6fdd2fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zlux App Server package will be documented in this file. +## v2.7.0 + +- Bugfix: Explicitly prefer ipv4 dns results to be compatible with node 18 since it switched to prefer ipv6 without configuration. This behavior can be cusomized via components.app-server.dns.lookupOrder='ipv4' or 'ipv6'. It defaults to 'ipv4'. + ## v2.4.0 - Bugfix: Plugin register/deregister would not consider app2app actions and recgonizers. Now, they are added on registration and removed on deregistration. diff --git a/bin/app-server.sh b/bin/app-server.sh index 7677de2..eccb81f 100755 --- a/bin/app-server.sh +++ b/bin/app-server.sh @@ -91,10 +91,34 @@ else ZLUX_SERVER_FILE=zluxServer.js fi +# Tells node whether to prefer ipv4 or ipv6 results to DNS lookups +ZLUX_DNS_ORDER="--dns-result-order=ipv4first" +if [ "$ZWE_components_app_server_dns_lookupOrder" = "ipv6" ]; then + ZLUX_DNS_ORDER="--dns-result-order=verbatim" +fi + +# not all versions of node support the above (14.18+ generally) so we can just try it to see what happens. +v4_check=$(${NODE_BIN} ${ZLUX_DNS_ORDER} -e "console.log('success');") +if [ "${v4_check}" != "success" ]; then + ZLUX_DNS_ORDER= +fi + if [ -z "$ZLUX_NO_LOGFILE" ]; then - __UNTAGGED_READ_MODE=V6 _BPX_JOBNAME=${ZOWE_PREFIX}DS ${NODE_BIN} --harmony ${ZOWE_LIB_DIR}/${ZLUX_SERVER_FILE} --config="${CONFIG_FILE}" "$@" 2>&1 | tee $ZWED_NODE_LOG_FILE + __UNTAGGED_READ_MODE=V6 \ + _BPX_JOBNAME=${ZOWE_PREFIX}DS \ + ${NODE_BIN} \ + --harmony \ + ${ZLUX_DNS_ORDER} \ + ${ZOWE_LIB_DIR}/${ZLUX_SERVER_FILE} \ + --config="${CONFIG_FILE}" "$@" 2>&1 | tee $ZWED_NODE_LOG_FILE else - __UNTAGGED_READ_MODE=V6 _BPX_JOBNAME=${ZOWE_PREFIX}DS ${NODE_BIN} --harmony ${ZOWE_LIB_DIR}/${ZLUX_SERVER_FILE} --config="${CONFIG_FILE}" "$@" + __UNTAGGED_READ_MODE=V6 \ + _BPX_JOBNAME=${ZOWE_PREFIX}DS \ + ${NODE_BIN} \ + --harmony \ + ${ZLUX_DNS_ORDER} \ + ${ZOWE_LIB_DIR}/${ZLUX_SERVER_FILE} \ + --config="${CONFIG_FILE}" "$@" echo "Ended with rc=$?" fi diff --git a/bin/zssServer.sh b/bin/zssServer.sh deleted file mode 100755 index 28a3c55..0000000 --- a/bin/zssServer.sh +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/sh -# This program and the accompanying materials are -# made available under the terms of the Eclipse Public License v2.0 which accompanies -# this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html -# -# SPDX-License-Identifier: EPL-2.0 -# -# Copyright Contributors to the Zowe Project. -## launch the Zowe Secure Services Server - -export _BPXK_AUTOCVT=ON - -if [ `uname` != "OS/390" ]; then - exit 0 -fi - -if [ -e "../bin/app-server.sh" ] -then - in_app_server=true -else - in_app_server=false -fi -if $in_app_server -then - ZSS_FILE=../bin/zssServer - ZSS_COMPONENT=${ZWE_zowe_runtimeDirectory}/components/zss/bin - if test -f "$ZSS_FILE"; then - ZSS_SCRIPT_DIR=$(cd `dirname $0`/../bin && pwd) - elif [ -d "$ZSS_COMPONENT" ]; then - ZSS_SCRIPT_DIR=$ZSS_COMPONENT - fi - ../bin/utils/convert-env.sh -else - ZSS_SCRIPT_DIR=$(cd `dirname $0` && pwd) - . ${ZSS_SCRIPT_DIR}/../../app-server/share/zlux-app-server/bin/utils/convert-env.sh -fi -if [ -e "$ZSS_CONFIG_FILE" ] -then - CONFIG_FILE=$ZSS_CONFIG_FILE -elif [ -e "$ZLUX_CONFIG_FILE" ] -then - CONFIG_FILE=$ZLUX_CONFIG_FILE -elif [ -d "$ZWE_zowe_workspaceDirectory" ] -then - CONFIG_FILE="${ZWE_zowe_workspaceDirectory}/app-server/serverConfig/server.json" -elif $in_app_server -then - CONFIG_FILE="../defaults/serverConfig/server.json" -elif [ -d "$ZWE_zowe_runtimeDirectory" ] -then -# This conditional and the else conditional are here for backup purposes, ZWE_zowe_workspaceDirectory is defined -# in the initialization of the app-server if they are not defined but in the case of zss development they might not be defined -# and will use the default server configuration - CONFIG_FILE="${ZWE_zowe_runtimeDirectory}/components/app-server/share/zlux-app-server/defaults/serverConfig/server.json" -else - echo "No config file specified, using default" - CONFIG_FILE="${ZSS_SCRIPT_DIR}/../../app-server/share/zlux-app-server/defaults/serverConfig/server.json" -fi -if [ -n "$ZWES_LOG_FILE" ] -then - if [[ $ZWES_LOG_FILE == /* ]] - then - echo "Absolute log location given." - else - ZWES_LOG_FILE="${ZSS_SCRIPT_DIR}/${ZWES_LOG_FILE}" - echo "Relative log location given, set to absolute path=$ZWES_LOG_FILE" - fi - if [ -n "$ZWES_LOG_DIR" ] - then - echo "ZWES_LOG_FILE set (value $ZWES_LOG_FILE). Ignoring ZWES_LOG_DIR." - fi -else -# _FILE was not specified; default filename, and check and maybe default _DIR - if [ -z "$ZWES_LOG_DIR" ] - then - if [ -d "$ZWE_zowe_logDirectory" ] - then - ZWES_LOG_DIR=${ZWE_zowe_logDirectory} - else - ZWES_LOG_DIR="../log" - fi - fi - if [ -f "$ZWES_LOG_DIR" ] - then - ZWES_LOG_FILE=$ZWES_LOG_DIR - elif [ ! -d "$ZWES_LOG_DIR" ] - then - echo "Will make log directory $ZWES_LOG_DIR" - mkdir -p $ZWES_LOG_DIR - if [ $? -ne 0 ] - then - echo "Cannot make log directory. Logging disabled." - ZWES_LOG_FILE=/dev/null - fi - fi - ZLUX_ROTATE_LOGS=0 - if [ -d "$ZWES_LOG_DIR" ] && [ -z "$ZWES_LOG_FILE" ] - then - ZWES_LOG_FILE="$ZWES_LOG_DIR/zssServer-`date +%Y-%m-%d-%H-%M`.log" - if [ -z "$ZWES_LOGS_TO_KEEP" ] - then - ZWES_LOGS_TO_KEEP=5 - fi - echo $ZWES_LOGS_TO_KEEP|egrep '^\-?[0-9]+$' >/dev/null - if [ $? -ne 0 ] - then - echo "ZWES_LOGS_TO_KEEP not a number. Defaulting to 5." - ZWES_LOGS_TO_KEEP=5 - fi - if [ $ZWES_LOGS_TO_KEEP -ge 0 ] - then - ZLUX_ROTATE_LOGS=1 - fi - fi - #Clean up excess logs, if appropriate. - if [ $ZLUX_ROTATE_LOGS -ne 0 ] - then - for f in `ls -r -1 $ZWES_LOG_DIR/zssServer-*.log 2>/dev/null | tail +$ZWES_LOGS_TO_KEEP` - do - echo zssServer.sh removing $f - rm -f $f - done - fi -fi -ZSS_CHECK_DIR="$(dirname "$ZWES_LOG_FILE")" -if [ ! -d "$ZSS_CHECK_DIR" ] -then - echo "ZWES_LOG_FILE contains nonexistent directories. Creating $ZSS_CHECK_DIR" - mkdir -p $ZSS_CHECK_DIR - if [ $? -ne 0 ] - then - echo "Cannot make log directory. Logging disabled." - ZWES_LOG_FILE=/dev/null - fi -fi -#Now sanitize final log filename: if it is relative, make it absolute before cd to js -if [ "$ZWES_LOG_FILE" != "/dev/null" ] -then - ZSS_CHECK_DIR=$(cd "$(dirname "$ZWES_LOG_FILE")"; pwd) - ZWES_LOG_FILE=$ZSS_CHECK_DIR/$(basename "$ZWES_LOG_FILE") -fi -echo ZWES_LOG_FILE=${ZWES_LOG_FILE} -export ZWES_LOG_FILE=$ZWES_LOG_FILE -if [ ! -e $ZWES_LOG_FILE ] -then - touch $ZWES_LOG_FILE - if [ $? -ne 0 ] - then - echo "Cannot make log file. Logging disabled." - ZWES_LOG_FILE=/dev/null - fi -else - if [ -d $ZWES_LOG_FILE ] - then - echo "ZWES_LOG_FILE is a directory. Must be a file. Logging disabled." - ZWES_LOG_FILE=/dev/null - fi -fi -if [ ! -w "$ZWES_LOG_FILE" ] -then - echo file "$ZWES_LOG_FILE" is not writable. Logging disabled. - ZWES_LOG_FILE=/dev/null -fi -#Determined log file. Run zssServer. -export dir=`dirname "$0"` -cd $ZSS_SCRIPT_DIR -_BPX_SHAREAS=NO _BPX_JOBNAME=${ZOWE_PREFIX}SZ ./zssServer "${CONFIG_FILE}" 2>&1 | tee $ZWES_LOG_FILE -# This program and the accompanying materials are -# made available under the terms of the Eclipse Public License v2.0 which accompanies -# this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html -# -# SPDX-License-Identifier: EPL-2.0 -# -# Copyright Contributors to the Zowe Project. diff --git a/schemas/app-server-config.json b/schemas/app-server-config.json index fb64eb9..186b1d6 100644 --- a/schemas/app-server-config.json +++ b/schemas/app-server-config.json @@ -556,6 +556,18 @@ "privilegedServerName": { "type": "string", "description": "The nickname of the ZIS server to be used" + }, + "dns": { + "type": "object", + "description": "Parameters used to customize DNS query behavior", + "properties": { + "lookupOrder": { + "type": "string", + "enum": [ "ipv4", "ipv6" ], + "default": "ipv4", + "description": "Used to specify to nodejs whether DNS lookups should return ipv4 or ipv6 IPs" + } + } } }, "$defs": {