Module: LogStash::Util::SecretStore

Defined in:
lib/logstash/util/secretstore.rb

Overview

Ruby helper to work with the secret store

Class Method Summary collapse

Class Method Details

.exists?Boolean

Check to see if the secret store exists, return true if exists, false otherwise

Returns:

  • (Boolean)


22
23
24
# File 'lib/logstash/util/secretstore.rb', line 22

def self.exists?
  SecretStoreFactory.exists(get_config)
end

.get_configObject

Return the configuration necessary to work with a secret store



12
13
14
15
16
17
18
19
# File 'lib/logstash/util/secretstore.rb', line 12

def self.get_config
  secure_config = SecureConfig.new
  secure_config.add("keystore.file", LogStash::SETTINGS.get_setting("keystore.file").value.chars)
  pass = ENV["LOGSTASH_KEYSTORE_PASS"]
  secure_config.add("keystore.pass", pass.chars) unless pass.nil?
  secure_config.add("keystore.classname", LogStash::SETTINGS.get_setting("keystore.classname").value.chars)
  secure_config
end

.get_if_existsObject

Returns a org.logstash.secret.store.SecretStore if it exists, nil otherwise



27
28
29
# File 'lib/logstash/util/secretstore.rb', line 27

def self.get_if_exists
  SecretStoreFactory.load(get_config) if exists?
end

.get_store_id(id) ⇒ Object

Returns a org.org.logstash.secret.SecretIdentifier for use with the secret store



32
33
34
# File 'lib/logstash/util/secretstore.rb', line 32

def self.get_store_id(id)
  SecretIdentifier.new(id)
end