Skip to content

Commit

Permalink
fix: fallback to old fullchain pem file for checking if a certificate…
Browse files Browse the repository at this point in the history
… is enabled

Refs #224
  • Loading branch information
josegonzalez committed Apr 2, 2021
1 parent 27cd830 commit 4479342
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion functions
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ letsencrypt_is_active() {

# check if certificate is identical to the current let's encrypt certificate by comparing SHA1 hashes
local cert_sha1=$( (cat "$DOKKU_ROOT/$app/tls/server.crt" 2>/dev/null) | sha1sum || echo "not_found")
local le_sha1=$( (cat "$DOKKU_ROOT/$app/letsencrypt/certs/current/certificates/$domain.pem" 2>/dev/null) | sha1sum || echo "not_found")

local le_sha1="not_found"
if [[ -f "$DOKKU_ROOT/$app/letsencrypt/certs/current/certificates/$domain.pem" ]]; then
le_sha1=$( (cat "$DOKKU_ROOT/$app/letsencrypt/certs/current/certificates/$domain.pem" 2>/dev/null) | sha1sum || echo "not_found")
elif [[ -f "$DOKKU_ROOT/$app/letsencrypt/certs/current/fullchain.pem" ]]; then
le_sha1=$( (cat "$DOKKU_ROOT/$app/letsencrypt/certs/current/fullchain.pem" 2>/dev/null) | sha1sum || echo "not_found")
fi

[[ "$cert_sha1" == "$le_sha1" ]] || return 2

echo "$app"
Expand Down

0 comments on commit 4479342

Please sign in to comment.