hapi-fhir/vagrant/chef/cookbooks/openssl
Steve Lewis c6a7c52c8c Update old removed Chef syntax in Vagrant provision
The original reported issue was due to the deprecation and removal of
`Chef::Platform.set`. This was fixed by moving to the new provider
syntax.

Other changes in the Chef cookbooks were performed to address similar
changes due to deprecated and removed methods and models as well as to
conform to new enforcements.

One issue not addressed in this change is to make the Oracle JDK
download work, since Java 8u20 is no longer available.

This fix was tested with the following override in the Vagrantfile:

java: {
  install_flavor: 'openjdk',
  jdk_version: 7
}

The above change is NOT included in this patch set. Further work
would be necessary to update the Oracle download before `vagrant up`
will work without this modification.

Fix #1123

Signed-off-by: Steve Lewis <steven.lewis@cambiahealth.com>
2019-01-31 05:17:22 -05:00
..
attributes Moving all Vagrant and Chef files to their own suddirectory as to not pollute the root level. 2014-10-07 11:59:16 -07:00
libraries Moving all Vagrant and Chef files to their own suddirectory as to not pollute the root level. 2014-10-07 11:59:16 -07:00
providers Moving all Vagrant and Chef files to their own suddirectory as to not pollute the root level. 2014-10-07 11:59:16 -07:00
recipes Moving all Vagrant and Chef files to their own suddirectory as to not pollute the root level. 2014-10-07 11:59:16 -07:00
resources Moving all Vagrant and Chef files to their own suddirectory as to not pollute the root level. 2014-10-07 11:59:16 -07:00
CHANGELOG.md Moving all Vagrant and Chef files to their own suddirectory as to not pollute the root level. 2014-10-07 11:59:16 -07:00
README.md Update old removed Chef syntax in Vagrant provision 2019-01-31 05:17:22 -05:00
metadata.json Update old removed Chef syntax in Vagrant provision 2019-01-31 05:17:22 -05:00
metadata.rb Moving all Vagrant and Chef files to their own suddirectory as to not pollute the root level. 2014-10-07 11:59:16 -07:00

README.md

openssl Cookbook

This cookbook provides a library method to generate secure random passwords in recipes using the Ruby OpenSSL library.

It also provides an attribute-driven recipe for upgrading OpenSSL packages.

Requirements

The secure_password works on any platform with OpenSSL Ruby bindings installed, which are a requirement for Chef anyway.

The upgrade recipe works on the following tested platforms:

  • Ubuntu 12.04, 14.04
  • Debian 7.4
  • CentOS 6.5

It may work on other platforms or versions of the above platforms with or without modification.

Chef Sugar was introduced as a dependency to provide helpers that make the default attribute settings (see Attributes) easier to reason about.

Attributes

  • node['openssl']['packages'] - An array of packages of openssl. The default attributes attempt to be smart about which packages are the default, but this may need to be changed by users of the openssl::upgrade recipe.
  • node['openssl']['restart_services'] - An array of service resources that use the node['openssl']['packages']. This is empty by default as Chef has no reliably reasonable way to detect which applications or services are compiled against these packages. Note These each need to be "service" resources specified somewhere in the recipes in the node's run list.

Recipes

upgrade

The upgrade recipe iterates over the list of packages in the node['openssl']['packages'] attribute and manages them with the :upgrade action. Each package will send :restart notification to service resources named by the node['openssl']['restart_services'] attribute.

Usage

Most often this will be used to generate a secure password for an attribute. In a recipe:

::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
node.default_unless[:my_password] = secure_password

To use the openssl::upgrade recipe, set the attributes as mentioned above. For example, we have a "stats_collector" service that uses openssl. It has a recipe that looks like this:

LWRP

This cookbook includes an LWRP for generating Self Signed Certificates

openssl_x509

generate a pem formatted x509 cert + key

Attributes

common_name A String representing the CN ssl field org A String representing the O ssl field org_unit A String representing the OU ssl field country A String representing the C ssl field expire A Fixnum reprenting the number of days from now to expire the cert key_file Optional A string to the key file to use. If no key is present it will generate and store one. key_pass A String that is the key's passphrase key_length A Fixnum reprenting your desired Bit Length Default: 2048 owner The owner of the files Default: "root" group The group of the files Default: "root" mode The mode to store the files in Default: "0400"

Example usage

openssl_x509 "/tmp/mycert.pem" do
  common_name "www.f00bar.com"
  org "Foo Bar"
  org_unit "Lab"
  country "US"
end

License and Author

Author:: Jesse Nelson (spheromak@gmail.com) Author:: Joshua Timberman (joshua@opscode.com)

node.default['openssl']['restart_services'] = ['stats_collector']

# other recipe code here...
service 'stats_collector' do
  action [:enable, :start]
end

include_recipe 'openssl::upgrade'

This will ensure that openssl is upgraded to the latest version so the stats_collector service won't be exploited (hopefully!).

Copyright:: 2009-2011, Opscode, Inc
Copyright:: 2014, Chef Software, Inc <legal@getchef.com>

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.