Securden Chef Plugin
The Securden Chef plugin enables seamless integration with Securden Secrets Manager, making it easy to fetch and utilize account details within your Chef recipes. This guide provides a detailed overview of the plugin's features and usage.
Installation
Add the Securden Chef plugin gem to your Chef environment. Ensure all required dependencies, including Ruby and the Chef client, are properly installed and configured.
Initialization
The Securden plugin is initialized with the following parameters:
server_url: The URL of your Securden Secrets Manager server.authtoken: The authentication token required for API access.certificate: (Optional) Path to the certificate file. If omitted, the plugin automatically fetches the certificate.
Usage Example
require 'Securden'
securden = nil
ruby_block 'Plugin Initialize Block' do
block do
securden = Securden::Account.new(
server_url: node['securden']['server_url'],
authtoken: node['securden']['authtoken'],
certificate: node['securden']['certificate'] # Certificate is optional
)
end
end
ruby_block 'Get Account Block' do
block do
if securden
account = securden.get(account_id: node['securden']['account_id'])
if account
puts "\nPassword: #{account['password']}"
end
end
end
end
Access
Once the account data is fetched, you can access its attributes directly, such as password, or any additional fields created in the account.
Example Workflow
- Define necessary
nodeattributes, such asserver_url,authtoken, and optionally,certificate. - Initialize the Securden plugin using the
Securden::Account.newmethod. - Use the
getmethod to fetch account details. - Access and utilize the required attributes in your Chef recipes.
Key Features
Plugin Initialization:
- Simplifies the initialization process with essential parameters (
server_url,authtoken,certificate).
- Simplifies the initialization process with essential parameters (
Fetching Account Data:
- Retrieve account details using the
getmethod by providing any of the following:account_idaccount_titleaccount_name- Combination of
account_nameandaccount_title
- Retrieve account details using the
Accessing Account Attributes:
- Access the fetched account's attributes, such as
password, or additional fields created in the account.
- Access the fetched account's attributes, such as
Additional Notes
- Ensure that
server_urlandauthtokenvalues are securely stored and not hardcoded in your recipes. - The
certificateparameter is optional; the plugin will automatically fetch it if not provided. - Additional fields in the account can be accessed using their respective names.
For further details and support, refer to the official Securden documentation.