Skip to content
This repository was archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #169 from Alfresco/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Enzo Rivello authored Nov 17, 2016
2 parents af49111 + 098ad71 commit 312645f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions recipes/db-ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@
csplit -sz rds-combined-ca-bundle.pem '/-BEGIN CERTIFICATE-/' '{*}'
EOF
only_if { ::File.exists?("#{Chef::Config[:file_cache_path]}/rds-combined-ca-bundle.pem") }
not_if "ls -l #{Chef::Config[:file_cache_path]}/xx*"
end

truststore = node['alfresco']['truststore_file']
truststore_pass = node['alfresco']['truststore_password']
truststore_type = node['alfresco']['truststore_type']

Dir.glob("#{Chef::Config[:file_cache_path]}/xx*").each do |cert|
execute "import #{cert} to RDS keystore" do
command "keytool -import -keystore #{truststore} -storepass #{truststore_pass} -storetype #{truststore_type} -noprompt \
-alias \"$(openssl x509 -noout -text -in #{cert} | perl -ne 'next unless /Subject:/; s/.*CN=//; print')\" -file #{cert}"
not_if "keytool -list -keystore #{truststore} -storepass #{truststore_pass} -storetype #{truststore_type} -noprompt \
-alias \"$(openssl x509 -noout -text -in #{cert} | perl -ne 'next unless /Subject:/; s/.*CN=//; print')\" -file #{cert}"
ruby_block "Import AWS RDS Certs" do
block do
Dir.glob("#{Chef::Config[:file_cache_path]}/xx*").each do |cert|
cmd = Chef::ShellOut.new(
%Q[ keytool -import -keystore #{truststore} -storepass #{truststore_pass} -storetype #{truststore_type} -noprompt \
-alias \"$(openssl x509 -noout -text -in #{cert} | perl -ne 'next unless /Subject:/; s/.*CN=//; print')\" -file #{cert} ]
).run_command
end
end
action :run
end

ssl_db_conf = " -Djavax.net.ssl.keyStore=#{node['alfresco']['keystore_file']} -Djavax.net.ssl.keyStorePassword=#{node['alfresco']['keystore_password']}"
Expand Down

0 comments on commit 312645f

Please sign in to comment.