mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 14:54:05 +00:00
Compare commits
4 commits
c69899f518
...
d2f193fafa
Author | SHA1 | Date | |
---|---|---|---|
|
d2f193fafa | ||
|
4228dd0a29 | ||
|
f65453e50c | ||
|
495bf51ac8 |
2 changed files with 39 additions and 13 deletions
|
@ -156,15 +156,38 @@ class DockerHost {
|
|||
let certPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameCert);
|
||||
let keyPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameKey);
|
||||
|
||||
if (dockerType === "tcp" && fs.existsSync(caPath) && fs.existsSync(certPath) && fs.existsSync(keyPath)) {
|
||||
let ca = fs.readFileSync(caPath);
|
||||
let key = fs.readFileSync(keyPath);
|
||||
let cert = fs.readFileSync(certPath);
|
||||
certOptions = {
|
||||
ca,
|
||||
key,
|
||||
cert
|
||||
};
|
||||
let key;
|
||||
let cert;
|
||||
let ca;
|
||||
|
||||
if (dockerType === "tcp") {
|
||||
if (fs.existsSync(keyPath) && fs.existsSync(certPath)) {
|
||||
// Load the key and cert
|
||||
key = fs.readFileSync(keyPath);
|
||||
cert = fs.readFileSync(certPath);
|
||||
|
||||
if (fs.existsSync(caPath)) {
|
||||
// Condition 1: Mutual TLS with self-signed certificate
|
||||
ca = fs.readFileSync(caPath);
|
||||
certOptions = {
|
||||
ca,
|
||||
key,
|
||||
cert
|
||||
};
|
||||
} else {
|
||||
// Condition 2: Mutual TLS with certificate in the standard trust store
|
||||
certOptions = {
|
||||
key,
|
||||
cert
|
||||
};
|
||||
}
|
||||
} else if (fs.existsSync(caPath)) {
|
||||
// Condition 3: TLS using self-signed certificate (without mutual TLS)
|
||||
ca = fs.readFileSync(caPath);
|
||||
certOptions = {
|
||||
ca
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -1443,11 +1443,14 @@ message HealthCheckResponse {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.monitor.type === "snmp") {
|
||||
// Set a default timeout if the monitor type has changed or if it's a new monitor
|
||||
if (oldType || this.isAdd) {
|
||||
if (this.monitor.type === "snmp") {
|
||||
// snmp is not expected to be executed via the internet => we can choose a lower default timeout
|
||||
this.monitor.timeout = 5;
|
||||
} else {
|
||||
this.monitor.timeout = 48;
|
||||
this.monitor.timeout = 5;
|
||||
} else {
|
||||
this.monitor.timeout = 48;
|
||||
}
|
||||
}
|
||||
|
||||
// Set default SNMP version
|
||||
|
|
Loading…
Reference in a new issue