mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Compare commits
4 commits
860c6d9461
...
c69899f518
Author | SHA1 | Date | |
---|---|---|---|
|
c69899f518 | ||
|
8a432ac937 | ||
|
f65453e50c | ||
|
495bf51ac8 |
2 changed files with 42 additions and 15 deletions
|
@ -156,15 +156,38 @@ class DockerHost {
|
||||||
let certPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameCert);
|
let certPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameCert);
|
||||||
let keyPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameKey);
|
let keyPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameKey);
|
||||||
|
|
||||||
if (dockerType === "tcp" && fs.existsSync(caPath) && fs.existsSync(certPath) && fs.existsSync(keyPath)) {
|
let key;
|
||||||
let ca = fs.readFileSync(caPath);
|
let cert;
|
||||||
let key = fs.readFileSync(keyPath);
|
let ca;
|
||||||
let cert = fs.readFileSync(certPath);
|
|
||||||
|
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 = {
|
certOptions = {
|
||||||
ca,
|
ca,
|
||||||
key,
|
key,
|
||||||
cert
|
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 {
|
return {
|
||||||
|
|
|
@ -220,6 +220,9 @@ module.exports.statusPageSocketHandler = (socket) => {
|
||||||
|
|
||||||
// Delete groups that are not in the list
|
// Delete groups that are not in the list
|
||||||
log.debug("socket", "Delete groups that are not in the list");
|
log.debug("socket", "Delete groups that are not in the list");
|
||||||
|
if (groupIDList.length === 0) {
|
||||||
|
await R.exec("DELETE FROM `group` WHERE status_page_id = ?", [ statusPage.id ]);
|
||||||
|
} else {
|
||||||
const slots = groupIDList.map(() => "?").join(",");
|
const slots = groupIDList.map(() => "?").join(",");
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
|
@ -227,6 +230,7 @@ module.exports.statusPageSocketHandler = (socket) => {
|
||||||
statusPage.id
|
statusPage.id
|
||||||
];
|
];
|
||||||
await R.exec(`DELETE FROM \`group\` WHERE id NOT IN (${slots}) AND status_page_id = ?`, data);
|
await R.exec(`DELETE FROM \`group\` WHERE id NOT IN (${slots}) AND status_page_id = ?`, data);
|
||||||
|
}
|
||||||
|
|
||||||
const server = UptimeKumaServer.getInstance();
|
const server = UptimeKumaServer.getInstance();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue