Skip to content

Commit

Permalink
Make the TLS certificate management optional
Browse files Browse the repository at this point in the history
The prescription by this cookbook to manage the TLS certificate, using
chef-vault, is overly strong, and, while it is an excellent practice,
may not jibe with some potential users’ workflows.
  • Loading branch information
zarry authored and jeffbyrnes committed Aug 19, 2015
1 parent 810c60b commit 9fe9c2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions attributes/default.rb
Expand Up @@ -8,6 +8,8 @@
default['vault']['service_user'] = 'vault'
default['vault']['service_group'] = 'vault'

# Chef-vault required for certificate management
default['vault']['manage_certificate'] = true
default['vault']['bag_name'] = 'secrets'
default['vault']['bag_item'] = 'vault'

Expand Down
9 changes: 7 additions & 2 deletions libraries/vault_config.rb
Expand Up @@ -40,7 +40,9 @@ class VaultConfig < Chef::Resource
attribute(:backend_options, option_collector: true)

def tls?
tls_disable.match(/^$/)
return true if tls_disable.match(/^$/) && node['vault']['manage_certificate']

false
end

# Transforms the resource into a JSON format which matches the
Expand Down Expand Up @@ -71,7 +73,10 @@ def to_json
mode '0755'
end

item = chef_vault_item(new_resource.bag_name, new_resource.bag_item)
item = chef_vault_item(
new_resource.bag_name,
new_resource.bag_item
)
file new_resource.tls_cert_file do
content item['certificate']
mode '0644'
Expand Down

0 comments on commit 9fe9c2d

Please sign in to comment.