Skip to content

Commit

Permalink
Fixes #2889 by supporting CRLF and LF certificates and adding logging…
Browse files Browse the repository at this point in the history
… when parsing certificates
  • Loading branch information
pbudner committed Mar 16, 2020
1 parent 84c93e9 commit 1e98037
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/fluent/plugin_helper/cert_option.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,12 @@ def cert_option_generate_server_pair_self_signed(generate_opts)

def cert_option_certificates_from_file(path)
data = File.read(path)
pattern = Regexp.compile('-+BEGIN CERTIFICATE-+\n(?:[^-]*\n)+-+END CERTIFICATE-+\n?', Regexp::MULTILINE)
pattern = Regexp.compile('-+BEGIN CERTIFICATE-+\r?\n(?:[^-]*\r?\n)+-+END CERTIFICATE-+\r?\n?', Regexp::MULTILINE)
list = []
data.scan(pattern){|match| list << OpenSSL::X509::Certificate.new(match) }
if list.length() == 0
log.warn “cert_path does contain a valid certificate”
end
list
end
end
Expand Down

0 comments on commit 1e98037

Please sign in to comment.