From 40c0facd3dc515880b010374bc3f1dc80210e938 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Fri, 20 Dec 2024 14:21:28 +0100 Subject: [PATCH 1/3] Update apiml.js for attls Signed-off-by: 1000TurquoisePogs --- lib/apiml.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/apiml.js b/lib/apiml.js index afd21566..0ffe62c2 100644 --- a/lib/apiml.js +++ b/lib/apiml.js @@ -171,7 +171,7 @@ ApimlConnector.prototype = { httpEnabled: false, httpsEnabled: true }; - const proto = 'https'; + const proto = this.isClientAttls ? 'http' : 'https'; log.debug("ZWED0141I", proto, this.port); //"Protocol:", proto, "Port", port); log.debug("ZWED0142I", JSON.stringify(protocolObject)); //"Protocol Object:", JSON.stringify(protocolObject)); @@ -228,7 +228,7 @@ ApimlConnector.prototype = { },*/ registerMainServerInstance() { - const overrideOptions = Object.assign({},this.tlsOptions); + const overrideOptions = this.isClientAttls ? {} : Object.assign({},this.tlsOptions) if (!this.tlsOptions.rejectUnauthorized) { //Keeping these certs causes an openssl error 46, unknown cert error in a dev environment delete overrideOptions.cert; @@ -240,7 +240,8 @@ ApimlConnector.prototype = { eureka: Object.assign({}, MEDIATION_LAYER_EUREKA_DEFAULTS, this.eurekaOverrides), requestMiddleware: function (requestOpts, done) { done(Object.assign(requestOpts, overrideOptions)); - } + }, + ssl: !this.isClientAttls } log.debug("ZWED0144I", JSON.stringify(zluxProxyServerInstanceConfig, null, 2)); //log.debug("zluxProxyServerInstanceConfig: " //+ JSON.stringify(zluxProxyServerInstanceConfig, null, 2)) @@ -280,7 +281,12 @@ ApimlConnector.prototype = { }, getServiceUrls() { - return this.discoveryUrls.map(url => url + (url.endsWith('/') ? '' : '/') + 'apps'); + let urls = this.discoveryUrls.map(url => url + (url.endsWith('/') ? '' : '/') + 'apps'); + if (this.isClientAttls) { + return urls.map(url => url.replaceAll('https', 'http')); + } else { + return urls; + } }, getRequestOptionsArray(method, path) { From 6a6f37d7c69e72f990d55c1ec3eb674b8ef6d4e7 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Fri, 20 Dec 2024 14:22:29 +0100 Subject: [PATCH 2/3] Update CHANGELOG.md Signed-off-by: 1000TurquoisePogs --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cf8ac82..56badb7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to the Zlux Server Framework package will be documented in this file. This repo is part of the app-server Zowe Component, and the change logs here may appear on Zowe.org in that section. +## 3.1.0 +- Bugfix: App-server could not register with discovery server when AT-TLS was enabled for app-server. (#580) + ## 3.0.0 - Enhancement: Add ability for server to dynamically load plugin web content based on `entryPoint` specification in the `pluginDefinition.json` From 5f84184058540da40c7d6f6f1985e82f147dae7e Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Thu, 26 Dec 2024 10:12:46 +0100 Subject: [PATCH 3/3] Remove conditional of HTTPS in metadata Signed-off-by: 1000TurquoisePogs --- lib/apiml.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/apiml.js b/lib/apiml.js index 0ffe62c2..6c02a188 100644 --- a/lib/apiml.js +++ b/lib/apiml.js @@ -171,9 +171,8 @@ ApimlConnector.prototype = { httpEnabled: false, httpsEnabled: true }; - const proto = this.isClientAttls ? 'http' : 'https'; - log.debug("ZWED0141I", proto, this.port); //"Protocol:", proto, "Port", port); + log.debug("ZWED0141I", 'https', this.port); //"Protocol:", proto, "Port", port); log.debug("ZWED0142I", JSON.stringify(protocolObject)); //"Protocol Object:", JSON.stringify(protocolObject)); const instance = Object.assign({}, MEDIATION_LAYER_INSTANCE_DEFAULTS(proto, this.hostName, this.port)); @@ -183,9 +182,9 @@ ApimlConnector.prototype = { hostName: this.hostName, ipAddr: this.ipAddr, vipAddress: "zlux",//this.vipAddress, - statusPageUrl: `${proto}://${this.hostName}:${this.port}/server/eureka/info`, - healthCheckUrl: `${proto}://${this.hostName}:${this.port}/server/eureka/health`, - homePageUrl: `${proto}://${this.hostName}:${this.port}/`, + statusPageUrl: `https://${this.hostName}:${this.port}/server/eureka/info`, + healthCheckUrl: `https://${this.hostName}:${this.port}/server/eureka/health`, + homePageUrl: `https://${this.hostName}:${this.port}/`, port: { "$": protocolObject.httpPort, // This is a workaround for the mediation layer "@enabled": ''+protocolObject.httpEnabled