diff --git a/cmd/fluentd/fluent-plugin-grafana-loki.gemspec b/cmd/fluentd/fluent-plugin-grafana-loki.gemspec index 7c6cfb0bb5a43..fbcdf842a6976 100644 --- a/cmd/fluentd/fluent-plugin-grafana-loki.gemspec +++ b/cmd/fluentd/fluent-plugin-grafana-loki.gemspec @@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path('lib', __dir__) Gem::Specification.new do |spec| spec.name = 'fluent-plugin-grafana-loki' - spec.version = '1.2.12' + spec.version = '1.2.13' spec.authors = %w[woodsaj briangann cyriltovena] spec.email = ['awoods@grafana.com', 'brian@grafana.com', 'cyril.tovena@grafana.com'] diff --git a/cmd/fluentd/lib/fluent/plugin/out_loki.rb b/cmd/fluentd/lib/fluent/plugin/out_loki.rb index 9b4e0d951535e..99d6f001c4b0a 100644 --- a/cmd/fluentd/lib/fluent/plugin/out_loki.rb +++ b/cmd/fluentd/lib/fluent/plugin/out_loki.rb @@ -49,6 +49,9 @@ class LogPostError < StandardError; end desc 'TLS' config_param :ca_cert, :string, default: nil + desc 'Disable server certificate verification' + config_param :insecure_tls, :bool, default: false + desc 'Loki tenant id' config_param :tenant, :string, default: nil @@ -153,14 +156,22 @@ def ssl_opts(uri) use_ssl: uri.scheme == 'https' } + # Disable server TLS certificate verification + if @insecure_tls + opts = opts.merge( + verify_mode: OpenSSL::SSL::VERIFY_NONE + ) + end + + # Verify client TLS certificate if !@cert.nil? && !@key.nil? opts = opts.merge( - verify_mode: OpenSSL::SSL::VERIFY_PEER, cert: @cert, key: @key ) end + # Specify custom certificate authority unless @ca_cert.nil? opts = opts.merge( ca_file: @ca_cert diff --git a/cmd/fluentd/spec/gems/fluent/plugin/loki_output_spec.rb b/cmd/fluentd/spec/gems/fluent/plugin/loki_output_spec.rb index 80caad045f3b0..819ffd8ce6a31 100644 --- a/cmd/fluentd/spec/gems/fluent/plugin/loki_output_spec.rb +++ b/cmd/fluentd/spec/gems/fluent/plugin/loki_output_spec.rb @@ -24,6 +24,7 @@ line_format key_value drop_single_key true remove_keys a, b + insecure_tls true