Skip to content

Commit

Permalink
fix for expired order/cert renewal
Browse files Browse the repository at this point in the history
  • Loading branch information
geemus committed Apr 11, 2024
1 parent 83962f1 commit 3ffc9da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/puma/acme/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def provision(cert, poll_interval:)
@manager.account!
end

if cert.order.nil?
if cert.order.nil? || cert.order.expired?
@logger.debug 'Acme: creating order'
@manager.order!(cert)
else
Expand Down
10 changes: 9 additions & 1 deletion lib/puma/acme/structs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ def names
identifiers&.map(&:value)
end

def expired?(now: Time.now.utc)
x509.not_after > now
end

def usable?(now: Time.now.utc)
!cert_pem.nil? && !key_pem.nil? && x509.not_after > now
!cert_pem.nil? && !key_pem.nil? && !expired?(now: now)
end

def renewable?(renew_in, now: Time.now.utc)
Expand Down Expand Up @@ -129,6 +133,10 @@ def self.from(acme_order)

new(acme_order.to_h.slice(*members).merge(identifiers: identifiers, authorizations: authorizations))
end

def expired?(now: Time.now.utc)
not_after > now
end
end
end
end

0 comments on commit 3ffc9da

Please sign in to comment.