From b660f64b916d24a746af465235a45119f66ebb6f Mon Sep 17 00:00:00 2001 From: HdroguettA Date: Thu, 12 Oct 2023 09:48:47 +1100 Subject: [PATCH 1/5] Ignore TLS/SSL error for Redis --- server/model/monitor.js | 2 +- server/util-server.js | 10 +++++++--- src/lang/en.json | 1 + src/pages/EditMonitor.vue | 20 ++++++++++++++++---- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 3e595f92..980fd304 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -815,7 +815,7 @@ class Monitor extends BeanModel { } else if (this.type === "redis") { let startTime = dayjs().valueOf(); - bean.msg = await redisPingAsync(this.databaseConnectionString); + bean.msg = await redisPingAsync(this.databaseConnectionString, !this.ignoreTls); bean.status = UP; bean.ping = dayjs().valueOf() - startTime; diff --git a/server/util-server.js b/server/util-server.js index 5f47561c..fa635d65 100644 --- a/server/util-server.js +++ b/server/util-server.js @@ -559,12 +559,16 @@ exports.radius = function ( /** * Redis server ping * @param {string} dsn The redis connection string - * @returns {Promise} Response from redis server + * @param {boolean} rejectUnauthorized If false, allows unverified server certificates. + * @returns {Promise} */ -exports.redisPingAsync = function (dsn) { +exports.redisPingAsync = function (dsn, rejectUnauthorized) { return new Promise((resolve, reject) => { const client = redis.createClient({ - url: dsn + url: dsn, + socket: { + rejectUnauthorized + } }); client.on("error", (err) => { if (client.isOpen) { diff --git a/src/lang/en.json b/src/lang/en.json index f5ebea2a..c1649a07 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -76,6 +76,7 @@ "resendDisabled": "Resend disabled", "retriesDescription": "Maximum retries before the service is marked as down and a notification is sent", "ignoreTLSError": "Ignore TLS/SSL error for HTTPS websites", + "ignoreTLSErrorGeneral": "Ignore TLS/SSL error for connection", "upsideDownModeDescription": "Flip the status upside down. If the service is reachable, it is DOWN.", "maxRedirectDescription": "Maximum number of redirects to follow. Set to 0 to disable redirects.", "Upside Down Mode": "Upside Down Mode", diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index cab85fe9..dc25d2d9 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -429,10 +429,10 @@ -
+
@@ -1113,9 +1113,21 @@ message HealthCheckResponse { } return list; - }, + }, - }, + /** + * Retrieves the appropriate ignore TLS error label based on the monitor type. + * + * @return {string} Returns the non specific label if the monitor type is 'redis', + * otherwise, returns the default. + */ + ignoreTlsLabel() { + return this.monitor.type === "redis" + ? this.$t("ignoreTLSErrorGeneral") + : this.$t("ignoreTLSError"); + } + }, + watch: { "$root.proxyList"() { if (this.isAdd) { From 7a0e11d53578ab0d0fb59dd62c5244e56779dc05 Mon Sep 17 00:00:00 2001 From: HdroguettA Date: Thu, 12 Oct 2023 10:06:49 +1100 Subject: [PATCH 2/5] fix: lint errors --- server/util-server.js | 2 +- src/pages/EditMonitor.vue | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/server/util-server.js b/server/util-server.js index fa635d65..146bfbfc 100644 --- a/server/util-server.js +++ b/server/util-server.js @@ -560,7 +560,7 @@ exports.radius = function ( * Redis server ping * @param {string} dsn The redis connection string * @param {boolean} rejectUnauthorized If false, allows unverified server certificates. - * @returns {Promise} + * @returns {Promise} Response from server */ exports.redisPingAsync = function (dsn, rejectUnauthorized) { return new Promise((resolve, reject) => { diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index dc25d2d9..a31ecddf 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -1118,10 +1118,9 @@ message HealthCheckResponse { /** * Retrieves the appropriate ignore TLS error label based on the monitor type. * - * @return {string} Returns the non specific label if the monitor type is 'redis', - * otherwise, returns the default. + * @returns {string} Returns the non specific label if the monitor type is 'redis', otherwise, returns the default. */ - ignoreTlsLabel() { + ignoreTlsLabel() { return this.monitor.type === "redis" ? this.$t("ignoreTLSErrorGeneral") : this.$t("ignoreTLSError"); From f07053a90e0ce81c76b52d6082d2a307dd34f129 Mon Sep 17 00:00:00 2001 From: HdroguettA Date: Thu, 12 Oct 2023 10:17:14 +1100 Subject: [PATCH 3/5] fix: run lint-fix --- src/pages/EditMonitor.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index a31ecddf..75585d7e 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -1113,11 +1113,10 @@ message HealthCheckResponse { } return list; - }, + }, - /** + /** * Retrieves the appropriate ignore TLS error label based on the monitor type. - * * @returns {string} Returns the non specific label if the monitor type is 'redis', otherwise, returns the default. */ ignoreTlsLabel() { @@ -1125,8 +1124,8 @@ message HealthCheckResponse { ? this.$t("ignoreTLSErrorGeneral") : this.$t("ignoreTLSError"); } - }, - + }, + watch: { "$root.proxyList"() { if (this.isAdd) { From 2318aa70493366097ab6c1e2684d0d4e234553d0 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sun, 10 Dec 2023 21:04:24 +0100 Subject: [PATCH 4/5] tested liniting fix --- src/pages/EditMonitor.vue | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index d75d5534..9917e085 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -484,7 +484,7 @@
@@ -1201,16 +1201,6 @@ message HealthCheckResponse { return list; }, - /** - * Retrieves the appropriate ignore TLS error label based on the monitor type. - * @returns {string} Returns the non specific label if the monitor type is 'redis', otherwise, returns the default. - */ - ignoreTlsLabel() { - return this.monitor.type === "redis" - ? this.$t("ignoreTLSErrorGeneral") - : this.$t("ignoreTLSError"); - } - dockerHostOptionsList() { if (this.$root.dockerHostList && this.$root.dockerHostList.length > 0) { return this.$root.dockerHostList.map((host) => { @@ -1227,7 +1217,6 @@ message HealthCheckResponse { } } }, - watch: { "$root.proxyList"() { if (this.isAdd) { From f66df7b59968c1699e9e89d303c1d71fda8ddd28 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Tue, 2 Apr 2024 03:58:05 +0200 Subject: [PATCH 5/5] fixed another linting issue --- src/pages/EditMonitor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 49158cfb..245bd786 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -485,7 +485,7 @@