From 3884bd10c04127697bb0c792c3b89653978b35a9 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Sun, 9 Oct 2016 01:23:34 +0000 Subject: [PATCH] Add Rake task to re-generate SSL/TLS certificate --- Rakefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Rakefile b/Rakefile index 120401203..8e1b6f328 100644 --- a/Rakefile +++ b/Rakefile @@ -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