Add Rake task to re-generate SSL/TLS certificate

This commit is contained in:
Brendan Coles
2016-10-09 01:23:34 +00:00
parent 0238134048
commit 3884bd10c0

View File

@@ -79,6 +79,24 @@ task :bundle_audit do
Rake::Task['bundle_audit:run'].invoke
end
################################
# SSL/TLS certificate
namespace :ssl do
desc 'Re-generate SSL certificate'
task :create do
if File.file?('/usr/local/bin/openssl')
path = '/usr/local/bin/openssl'
elsif File.file?('/usr/bin/openssl')
path = '/usr/bin/openssl'
else
puts "[-] Error: could not find openssl"
exit 1
end
IO.popen([path, 'req', '-new', '-newkey', 'rsa:4096', '-sha256', '-x509', '-days', '3650', '-nodes', '-out', 'beef_cert.pem', '-keyout', 'beef_key.pem', '-subj', '/CN=localhost'], 'r+').read.to_s
end
end
################################
# rdoc