Skip to content

Commit d960340

Browse files
committed
Resign modified client cert
These tests modify the not_before & not_after times for the client cert and verify the cert is rejected because the cert is "not yet valid" and "expired" respectively. It just so happened openssl < 3.2, checks the times before checking the signature. But openssl 3.2, checks the signature first. So regenerate the signature using the intermediate CA's private key.
1 parent 8761042 commit d960340

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec/unit/ssl/ssl_provider_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@
391391

392392
it 'raises if cert is not valid yet', unless: Puppet::Util::Platform.jruby? do
393393
client_cert.not_before = Time.now + (5 * 60 * 60)
394+
int_key = key_fixture('intermediate-key.pem')
395+
client_cert.sign(int_key, OpenSSL::Digest::SHA256.new)
396+
394397
expect {
395398
subject.create_context(**config.merge(client_cert: client_cert))
396399
}.to raise_error(Puppet::SSL::CertVerifyError,
@@ -399,6 +402,9 @@
399402

400403
it 'raises if cert is expired', unless: Puppet::Util::Platform.jruby? do
401404
client_cert.not_after = Time.at(0)
405+
int_key = key_fixture('intermediate-key.pem')
406+
client_cert.sign(int_key, OpenSSL::Digest::SHA256.new)
407+
402408
expect {
403409
subject.create_context(**config.merge(client_cert: client_cert))
404410
}.to raise_error(Puppet::SSL::CertVerifyError,

0 commit comments

Comments
 (0)