Ignore TLS/SSL error for Redis

pull/3878/head
HdroguettA 1 year ago
parent a3a81f8059
commit b660f64b91

@ -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;

@ -559,12 +559,16 @@ exports.radius = function (
/**
* Redis server ping
* @param {string} dsn The redis connection string
* @returns {Promise<any>} Response from redis server
* @param {boolean} rejectUnauthorized If false, allows unverified server certificates.
* @returns {Promise<any>}
*/
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) {

@ -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",

@ -429,10 +429,10 @@
</div>
</div>
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query' " class="my-3 form-check">
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query' || monitor.type === 'redis' " class="my-3 form-check">
<input id="ignore-tls" v-model="monitor.ignoreTls" class="form-check-input" type="checkbox" value="">
<label class="form-check-label" for="ignore-tls">
{{ $t("ignoreTLSError") }}
{{ ignoreTlsLabel }}
</label>
</div>
@ -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) {

Loading…
Cancel
Save