Compare commits

...

4 commits

Author SHA1 Message Date
Patrick Wagstrom
d2f193fafa
Merge f65453e50c into 4228dd0a29 2024-11-19 00:29:48 +00:00
Ionys
4228dd0a29
Fix the timeout value (#5352)
Some checks failed
validate / validate (push) Has been cancelled
Auto Test / armv7-simple-test (18, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
validate / json-yaml-validate (push) Has been cancelled
Auto Test / auto-test (18, ARM64) (push) Has been cancelled
Auto Test / auto-test (18, macos-latest) (push) Has been cancelled
Auto Test / auto-test (18, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (18, windows-latest) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
2024-11-19 01:29:35 +01:00
Patrick Wagstrom
f65453e50c
fix: correct linter errors
I missed some of the `let` definitions for the ca, cert, and key when
establishing the docker TLS connection.

DCO-1.1 Signed-off-by: Patrick Wagstrom <160672+pridkett@users.noreply.github.com>
2024-09-21 18:22:37 -04:00
Patrick Wagstrom
495bf51ac8
fix: allow TLS with remote docker when using public CA
This provides a small fix that allows you to define docker hosts that
you can connect with in three different ways:

1. Mutual TLS, docker host uses non-standard CA
2. Mutual TLS, docker host uses standard CA
3. No Authentication, docker host uses non-standard CA
4. No authentication, docker host uses standard CA

In the previous implementation only condition 1 and 4 were allowed. This
makes condition 2 and 3 possible. The logic is a little messy, but it
works.

DCO-1.1 Signed-off-by: Patrick Wagstrom <160672+pridkett@users.noreply.github.com>
2024-09-21 18:01:42 -04:00
2 changed files with 39 additions and 13 deletions

View file

@ -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);
certOptions = { if (dockerType === "tcp") {
ca, if (fs.existsSync(keyPath) && fs.existsSync(certPath)) {
key, // Load the key and cert
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 { return {

View file

@ -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 // snmp is not expected to be executed via the internet => we can choose a lower default timeout
this.monitor.timeout = 5; this.monitor.timeout = 5;
} else { } else {
this.monitor.timeout = 48; this.monitor.timeout = 48;
}
} }
// Set default SNMP version // Set default SNMP version