Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

Commit ba9bcb4

Browse files
committed
fix(ssl-manager): adjust certificate size thresholds for validation
This commit modifies the ssl-manager.sh script to update the size thresholds for certificate and private key validation. The minimum size for certificates is changed from 1000 bytes to 500 bytes, while the threshold for private keys is adjusted to differentiate between RSA and ECDSA keys, setting a lower limit of 100 bytes. Additionally, a new log message is added for typical ECDSA key sizes, enhancing the script's feedback during SSL management.
1 parent 83655da commit ba9bcb4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compose.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ services:
140140
command: >
141141
sh -c "
142142
apk add --no-cache openssl curl &&
143-
chmod +x /scripts/ssl-manager.sh &&
144143
echo 'SSL Monitor started - checking certificates daily' &&
145144
while true; do
146145
echo \"[$$(date)] Checking SSL certificates...\";

scripts/ssl-manager.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,14 +452,17 @@ copy_certificates() {
452452
cert_size=$(stat -f%z "$cert_target" 2>/dev/null || stat -c%s "$cert_target" 2>/dev/null || echo "0")
453453
key_size=$(stat -f%z "$key_target" 2>/dev/null || stat -c%s "$key_target" 2>/dev/null || echo "0")
454454

455-
if [[ "$cert_size" -lt 1000 ]]; then
455+
if [[ "$cert_size" -lt 500 ]]; then
456456
log_warn "Certificate file seems unusually small ($cert_size bytes)"
457457
log_warn "This may indicate a problem with the certificate"
458458
fi
459459

460-
if [[ "$key_size" -lt 500 ]]; then
460+
# ECDSA keys are much smaller than RSA keys, so use lower threshold
461+
if [[ "$key_size" -lt 100 ]]; then
461462
log_warn "Private key file seems unusually small ($key_size bytes)"
462463
log_warn "This may indicate a problem with the private key"
464+
elif [[ "$key_size" -gt 100 && "$key_size" -lt 300 ]]; then
465+
log_verbose "Private key size ($key_size bytes) is typical for ECDSA keys"
463466
fi
464467

465468
log_info "Certificates copied successfully"

0 commit comments

Comments
 (0)