summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc A. Paradise <marc.paradise@gmail.com>2021-09-08 17:20:15 -0400
committerMarc A. Paradise <marc.paradise@gmail.com>2021-09-08 17:22:07 -0400
commit58d8401a96ffdbc06f6e0fe0711122aa699f1007 (patch)
tree83492b5c5bed6a6f47baaef2f82bb1ad36a9d3f1
parentc81c085f6f6d3fc058d71c8295d0b5620709198b (diff)
downloadchef-58d8401a96ffdbc06f6e0fe0711122aa699f1007.tar.gz
Add akeyless vault fetcher
Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
-rw-r--r--lib/chef/secret_fetcher.rb7
-rw-r--r--lib/chef/secret_fetcher/akeyless_vault.rb34
2 files changed, 39 insertions, 2 deletions
diff --git a/lib/chef/secret_fetcher.rb b/lib/chef/secret_fetcher.rb
index e8e4602bb2..af3e1d5cbb 100644
--- a/lib/chef/secret_fetcher.rb
+++ b/lib/chef/secret_fetcher.rb
@@ -21,7 +21,7 @@ require_relative "exceptions"
class Chef
class SecretFetcher
- SECRET_FETCHERS = %i{example aws_secrets_manager azure_key_vault hashi_vault}.freeze
+ SECRET_FETCHERS = %i{example aws_secrets_manager azure_key_vault hashi_vault akeyless_vault}.freeze
# Returns a configured and validated instance
# of a [Chef::SecretFetcher::Base] for the given
@@ -45,10 +45,13 @@ class Chef
when :hashi_vault
require_relative "secret_fetcher/hashi_vault"
Chef::SecretFetcher::HashiVault.new(config, run_context)
+ when :akeyless_vault
+ require_relative "secret_fetcher/akeyless_vault"
+ Chef::SecretFetcher::AKeylessVault.new(config, run_context)
when nil, ""
raise Chef::Exceptions::Secret::MissingFetcher.new(SECRET_FETCHERS)
else
- raise Chef::Exceptions::Secret::InvalidFetcherService.new("Unsupported secret service: #{service}", SECRET_FETCHERS)
+ raise Chef::Exceptions::Secret::InvalidFetcherService.new("Unsupported secret service: '#{service}'", SECRET_FETCHERS)
end
fetcher.validate!
fetcher
diff --git a/lib/chef/secret_fetcher/akeyless_vault.rb b/lib/chef/secret_fetcher/akeyless_vault.rb
new file mode 100644
index 0000000000..d8a81b60cc
--- /dev/null
+++ b/lib/chef/secret_fetcher/akeyless_vault.rb
@@ -0,0 +1,34 @@
+#
+# Author:: Marc Paradise (<marc@chef.io>)
+# Copyright:: Copyright (c) Chef Software Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require_relative "base"
+require "aws-sdk-core" # Support for aws instance profile auth
+require_relative "hashi_vault"
+
+class Chef
+ class SecretFetcher
+ # == Chef::SecretFetcher::AKeylessVault
+ # A fetcher that fetches a secret from AKeyless Vault. Initial implementation is
+ # based on HashiVault , because AKeyless provides a compatibility layer that makes this possible.
+ # Future revisions will use native akeyless authentication.
+ class AKeylessVault < HashiVault
+
+ end
+ end
+end
+