Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(maint) ruby-openssl now sets store_context.error #8829

Merged
merged 1 commit into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/puppet/ssl/verifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ def call(preverify_ok, store_context)
return false
end

# ruby-openssl#74ef8c0cc56b840b772240f2ee2b0fc0aafa2743 now sets the
# store_context error when the cert is mismatched
when OpenSSL::X509::V_ERR_HOSTNAME_MISMATCH
@last_error = Puppet::SSL::CertMismatchError.new(peer_cert, @hostname)
return false

when OpenSSL::X509::V_ERR_CRL_NOT_YET_VALID
crl = store_context.current_crl
if crl && crl.last_update && crl.last_update < Time.now + FIVE_MINUTES_AS_SECONDS
Expand Down
6 changes: 6 additions & 0 deletions lib/puppet/util/monkey_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ module OpenSSL::SSL
end
end

unless defined?(OpenSSL::X509::V_ERR_HOSTNAME_MISMATCH)
module OpenSSL::X509
OpenSSL::X509::V_ERR_HOSTNAME_MISMATCH = 0x3E
end
end

class OpenSSL::SSL::SSLContext
if DEFAULT_PARAMS[:options]
DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv2 | OpenSSL::SSL::OP_NO_SSLv3
Expand Down