Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch-5. Fixed into single commit. #6

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Gemfile.lock
bin/*
.bundle/*

.ruby-version
11 changes: 11 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
LineLength:
Max: 200

HashSyntax:
EnforcedStyle: ruby19

SingleSpaceBeforeFirstArg:
Enabled: false

TrailingComma:
Enabled: false
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: ruby
rvm:
- 2.1
script:
- bundle exec rubocop
- bundle exec foodcritic -f any .
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
source 'https://rubygems.org'

gem 'berkshelf'
gem 'rubocop'
gem 'foodcritic'
2 changes: 1 addition & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
default['openssl_fips']['openssl']['prefix'] = "/opt/openssl-#{openssl_version}"
default['openssl_fips']['openssl']['url'] = "https://www.openssl.org/source/openssl-#{openssl_version}.tar.gz"
default['openssl_fips']['openssl']['checksum'] = 'b28b3bcb1dc3ee7b55024c9f795be60eb3183e3c'
default['openssl_fips']['openssl']['configure_flags'] = %W[ shared ]
default['openssl_fips']['openssl']['configure_flags'] = %w(shared)
1 change: 0 additions & 1 deletion files/openssl.sh

This file was deleted.

2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

depends 'build-essential'

%w{ubuntu debian centos redhat}.each do |os|
%w(ubuntu debian centos redhat).each do |os|
supports os
end
22 changes: 13 additions & 9 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Recipe:: default

src_dirpath = "#{Chef::Config['file_cache_path'] || '/tmp'}/openssl-fips-#{node['openssl_fips']['fips']['version']}"
src_filepath = "#{src_dirpath}.tar.gz"
src_filepath = "#{src_dirpath}.tar.gz"
remote_file node['openssl_fips']['fips']['url'] do
source node['openssl_fips']['fips']['url']
checksum node['openssl_fips']['fips']['checksum']
Expand All @@ -18,18 +18,18 @@
not_if { ::File.directory?(src_dirpath) }
end

fips_dirpath = "#{Chef::Config['file_cache_path'] || '/tmp'}/openssl-fipsmodule-#{node['openssl_fips']['fips']['version']}"
fips_dirpath = "#{Chef::Config['file_cache_path'] || '/tmp'}/openssl-fipsmodule-#{node['openssl_fips']['fips']['version']}"

execute 'compile_fips_source' do
cwd src_dirpath
command <<-EOH
./config --prefix=#{fips_dirpath} && make && make install
./config --prefix=#{fips_dirpath} && make && make install
EOH
not_if { ::File.directory?(fips_dirpath) }
end

src_dirpath = "#{Chef::Config['file_cache_path'] || '/tmp'}/openssl-#{node['openssl_fips']['openssl']['version']}"
src_filepath = "#{src_dirpath}.tar.gz"
src_filepath = "#{src_dirpath}.tar.gz"
remote_file node['openssl_fips']['openssl']['url'] do
source node['openssl_fips']['openssl']['url']
checksum node['openssl_fips']['openssl']['checksum']
Expand All @@ -50,7 +50,7 @@

configure_flags = node['openssl_fips']['openssl']['configure_flags'].map { |x| x }
configure_flags << "--prefix=#{node['openssl_fips']['openssl']['prefix']}"
configure_flags << "fips" << "--with-fipsdir=#{fips_dirpath}"
configure_flags << 'fips' << "--with-fipsdir=#{fips_dirpath}"

execute 'compile_openssl_source' do
cwd src_dirpath
Expand All @@ -63,15 +63,19 @@

# update ld.so.conf
file '/etc/ld.so.conf.d/openssl-fips.conf' do
mode '0444'
mode 00444
owner 'root'
group 'root'
content "#{node['openssl_fips']['openssl']['prefix']}/lib"
notifies :run, 'execute[ldconfig]'
end

execute 'ldconfig'

profile_file = '/etc/profile.d/openssl.sh'
cookbook_file 'openssl.sh' do
mode '0644'
path profile_file
template profile_file do
owner 'root'
group 'root'
mode 00644
source 'openssl.sh.erb'
end
1 change: 1 addition & 0 deletions templates/default/openssl.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export PATH=/opt/openssl-<%= node['openssl_fips']['openssl']['version'] %>/bin:$PATH