Skip to content

Commit b0fb888

Browse files
committed
Fix CA/CRL refresh retriggering every run on 304
When the server responds with 304 Not Modified, ca_last_update and crl_last_update were not updated. Since these read the mtime of the CA cert / CRL file on disk, the stale timestamp caused needs_refresh? to return true on every subsequent run, ignoring ca_refresh_interval and crl_refresh_interval. Fix by updating the timestamp on 304 so the interval is respected. Signed-off-by: Houssem eXo <hbenali@exoplatform.fr>
1 parent 0ce5271 commit b0fb888

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/puppet/ssl/state_machine.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def refresh_ca(ssl_ctx, last_update)
121121
rescue Puppet::HTTP::ResponseError => e
122122
if e.response.code == 304
123123
Puppet.info(_("CA certificate is unmodified, using existing CA certificate"))
124+
@cert_provider.ca_last_update = Time.now
124125
else
125126
Puppet.info(_("Failed to refresh CA certificate, using existing CA certificate: %{message}") % { message: e.message })
126127
end
@@ -219,6 +220,7 @@ def refresh_crl(ssl_ctx, last_update)
219220
rescue Puppet::HTTP::ResponseError => e
220221
if e.response.code == 304
221222
Puppet.info(_("CRL is unmodified, using existing CRL"))
223+
@cert_provider.crl_last_update = Time.now
222224
else
223225
Puppet.info(_("Failed to refresh CRL, using existing CRL: %{message}") % { message: e.message })
224226
end

0 commit comments

Comments
 (0)