Sha256: d5b4b4cc748647c04d12349d920855ee8822c6ae1eec022cbed4fb1b071cd660
Contents?: true
Size: 1.89 KB
Versions: 7
Compression:
Stored size: 1.89 KB
Contents
require 'base64' module LogStash::Outputs::ElasticSearch::Shield def self.included(base) base.extend(ClassMethods) base.create_options base.branch_ssl_setup base.branch_auth_setup end def self.create_client_config(arg); {}; end module ClassMethods def create_options # Use the specified JKS keystore config :keystore, :validate => :path # Set the keystore password config :keystore_password, :validate => :password end def branch_ssl_setup alias_method :setup_http_ssl, :setup_ssl define_method(:setup_ssl) do @protocol =~ /http/ ? setup_http_ssl : _setup_transport_ssl end end def branch_auth_setup alias_method :setup_http_auth, :setup_basic_auth define_method(:setup_basic_auth) do @protocol =~ /http/ ? setup_http_auth : _setup_nothing end end end def _setup_nothing; {}; end def _setup_transport_ssl settings = {} if @protocol == "node" && (@ssl || @user || @password) then @logger.warn "Shield is not supported on \"node\" protocol: switching to \"transport\".." @protocol = "transport" end require 'logstash-output-elasticsearch-shield_jars' if @ssl settings['shield.transport.ssl'] = @ssl settings['shield.ssl.keystore.path'] = @keystore if @keystore settings['shield.ssl.keystore.password'] = @keystore_password.value if @keystore_password settings['shield.transport.ssl.truststore.path'] = @truststore if @truststore settings['shield.transport.ssl.truststore.password'] = @truststore_password.value if @truststore_password end if @user && @password settings['request.headers.Authorization'] = 'Basic ' + Base64.strict_encode64(@user + ':' + @password.value) end settings end end LogStash::Outputs::ElasticSearch.instance_eval{ include LogStash::Outputs::ElasticSearch::Shield }
Version data entries
7 entries across 7 versions & 1 rubygems