Skip to content
Permalink
Browse files

[COOK-3603] Add recipe for using custom OpenSSL source when compiling…

… nginx

Signed-off-by: Seth Vargo <sethvargo@gmail.com>
  • Loading branch information...
dwradcliffe authored and Seth Vargo committed Sep 12, 2013
1 parent 1be198a commit 869962e5d034ad5755094143dadf16ef64b0e0e3
Showing with 78 additions and 0 deletions.
  1. +10 −0 README.md
  2. +23 −0 attributes/openssl_source.rb
  3. +45 −0 recipes/openssl_source.rb
@@ -285,6 +285,14 @@ These attributes are used in the `nginx::http_stub_status_module` recipe.
* `node['nginx']['status']['port']` - The port on which nginx will
serve the status info (default: 8090)

## openssl_source.rb

These attributes are used in the `nginx::openssl_source` recipe.

* `node['nginx']['openssl_source']['version']` - The version of OpenSSL
you want to download and use (default: 1.0.1e)
* `node['nginx']['openssl_source']['url']` - The url for the OpenSSL source

Recipes
=======

@@ -369,6 +377,8 @@ attribute `node['nginx']['source']['modules']`.
"`mod_passenger`".
* `upload_progress_module.rb` - builds the `upload_progress` module
and enables it as a module when compiling nginx.
* `openssl_source.rb` - downloads and uses custom OpenSSL source
when compiling nginx
Adding New Modules
------------------
@@ -0,0 +1,23 @@
#
# Cookbook Name:: nginx
# Attributes:: openssl_source
#
# Author:: David Radcliffe (<radcliffe.david@gmail.com>)
#
# Copyright 2013, David Radcliffe
#
# 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.
#

default['nginx']['openssl_source']['version'] = "1.0.1e"
default['nginx']['openssl_source']['url'] = "http://www.openssl.org/source/openssl-#{node['nginx']['openssl_source']['version']}.tar.gz"
@@ -0,0 +1,45 @@
#
# Cookbook Name:: nginx
# Recipe:: openssl_source
#
# Author:: David Radcliffe (<radcliffe.david@gmail.com>)
#
# Copyright 2013, David Radcliffe
#
# 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.
#

src_filename = ::File.basename(node['nginx']['openssl_source']['url'])
src_filepath = "#{Chef::Config['file_cache_path']}/#{src_filename}"
extract_path = "#{Chef::Config['file_cache_path']}/openssl-#{node['nginx']['openssl_source']['version']}"

remote_file src_filepath do
source node['nginx']['openssl_source']['url']
owner "root"
group "root"
mode 00644
not_if { ::File.exists?(src_filepath) }
end

bash "extract_openssl" do
cwd ::File.dirname(src_filepath)
code <<-EOH
mkdir -p #{extract_path}
tar xzf #{src_filename} -C #{extract_path}
mv #{extract_path}/*/* #{extract_path}/
EOH
not_if { ::File.exists?(extract_path) }
end

node.run_state['nginx_configure_flags'] =
node.run_state['nginx_configure_flags'] | ["--with-openssl=#{extract_path}"]

0 comments on commit 869962e

Please sign in to comment.
You can’t perform that action at this time.