Module: Fluent::Plugin::OpenSearchTLS

Included in:
OpenSearchOutput
Defined in:
lib/fluent/plugin/opensearch_tls.rb

Defined Under Namespace

Modules: OpenSearchTLSParams

Constant Summary collapse

SUPPORTED_TLS_VERSIONS =
if defined?(OpenSSL::SSL::TLS1_3_VERSION)
  [:TLSv1, :TLSv1_1, :TLSv1_2, :TLSv1_3].freeze
else
  [:SSLv23, :TLSv1, :TLSv1_1, :TLSv1_2].freeze
end
DEFAULT_VERSION =
:TLSv1_2

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



69
70
71
# File 'lib/fluent/plugin/opensearch_tls.rb', line 69

def self.included(mod)
  mod.include OpenSearchTLSParams
end

Instance Method Details

#set_tls_minmax_version_config(ssl_version, ssl_max_version, ssl_min_version) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/fluent/plugin/opensearch_tls.rb', line 73

def set_tls_minmax_version_config(ssl_version, ssl_max_version, ssl_min_version)
  if USE_TLS_MINMAX_VERSION
    case
    when ssl_min_version.nil? && ssl_max_version.nil?
      ssl_min_version = METHODS_MAP[:TLSv1_2]
      ssl_max_version = METHODS_MAP[:TLSv1_3]
    when ssl_min_version && ssl_max_version.nil?
      raise Fluent::ConfigError, "When you set 'ssl_min_version', must set 'ssl_max_version' together."
    when ssl_min_version.nil? && ssl_max_version
      raise Fluent::ConfigError, "When you set 'ssl_max_version', must set 'ssl_min_version' together."
    else
      ssl_min_version = METHODS_MAP[ssl_min_version]
      ssl_max_version = METHODS_MAP[ssl_max_version]
    end

    {max_version: ssl_max_version, min_version: ssl_min_version}
  else
    log.warn "'ssl_min_version' does not have any effect in this environment. Use 'ssl_version' instead." unless ssl_min_version.nil?
    log.warn "'ssl_max_version' does not have any effect in this environment. Use 'ssl_version' instead." unless ssl_max_version.nil?
    {version: ssl_version}
  end
end