From 488dffd04bfad7b9b8a5cea0565b75a59ec0589c Mon Sep 17 00:00:00 2001 From: Adam Cooke Date: Fri, 28 Apr 2017 15:15:41 +0100 Subject: [PATCH] don't generate self signed smtp certificates --- lib/postal/config.rb | 8 -------- script/generate_initial_config.rb | 19 ------------------- 2 files changed, 27 deletions(-) diff --git a/lib/postal/config.rb b/lib/postal/config.rb index 6d8cb22..098be93 100644 --- a/lib/postal/config.rb +++ b/lib/postal/config.rb @@ -153,14 +153,6 @@ module Postal raise ConfigError, "No config found at #{self.config_file_path}" end - unless File.exist?(self.smtp_private_key_path) - raise ConfigError, "No SMTP private key found at #{self.smtp_private_key_path}" - end - - unless File.exist?(self.smtp_certificate_path) - raise ConfigError, "No SMTP certificate found at #{self.smtp_certificate_path}" - end - unless File.exists?(self.lets_encrypt_private_key_path) raise ConfigError, "No Let's Encrypt private key found at #{self.lets_encrypt_private_key_path}" end diff --git a/script/generate_initial_config.rb b/script/generate_initial_config.rb index 29fae10..56d5154 100755 --- a/script/generate_initial_config.rb +++ b/script/generate_initial_config.rb @@ -15,25 +15,6 @@ unless File.exist?(Postal.config_file_path) puts "Created example config file at #{Postal.config_file_path}" end -unless File.exists?(Postal.smtp_private_key_path) - key = OpenSSL::PKey::RSA.new(2048).to_s - File.open(Postal.smtp_private_key_path, 'w') { |f| f.write(key) } - puts "Created new private key for encrypting SMTP connections" -end - -unless File.exist?(Postal.smtp_certificate_path) - cert = OpenSSL::X509::Certificate.new - cert.subject = cert.issuer = OpenSSL::X509::Name.parse("/C=GB/O=Test/OU=Test/CN=Test") - cert.not_before = Time.now - cert.not_after = Time.now + 365 * 24 * 60 * 60 - cert.public_key = Postal.smtp_private_key.public_key - cert.serial = 0x0 - cert.version = 2 - cert.sign Postal.smtp_private_key, OpenSSL::Digest::SHA256.new - File.open(Postal.smtp_certificate_path, 'w') { |f| f.write(cert.to_pem) } - puts "Created new self signed certificate for encrypting SMTP connections" -end - unless File.exists?(Postal.lets_encrypt_private_key_path) key = OpenSSL::PKey::RSA.new(2048).to_s File.open(Postal.lets_encrypt_private_key_path, 'w') { |f| f.write(key) }