ssl sites bundler

This commit is contained in:
Kyle Drake 2014-09-03 11:52:14 -07:00
parent 3d32e616da
commit 8cd61a06f2
3 changed files with 27 additions and 2 deletions

1
.gitignore vendored
View file

@ -28,3 +28,4 @@ public/site_thumbnails_test
files/map.txt
.sass-cache
.sass-cache/*
files/sslsites.zip

View file

@ -88,3 +88,27 @@ desc 'Compile domain map for nginx'
task :compile_domain_map => [:environment] do
File.open('./files/map.txt', 'w'){|f| Site.exclude(domain: nil).exclude(domain: '').select(:username,:domain).all.collect {|s| f.write "#{s.domain} #{s.username};\n" }}
end
desc 'Produce SSL config package for proxy'
task :buildssl => [:environment] do
sites = Site.select(:id, :username, :domain, :ssl_key, :ssl_cert, :ssl_cert_intermediate).
exclude(domain: nil).
exclude(ssl_key: nil).
exclude(ssl_cert: nil).
exclude(ssl_cert_intermediate: nil).
all
payload = []
Zip::Archive.open('./files/sslsites.zip', Zip::CREATE) do |ar|
ar.add_dir 'ssl'
sites.each do |site|
ar.add_buffer "ssl/#{site.username}.key", site.ssl_key
ar.add_buffer "ssl/#{site.username}.crt", "#{site.ssl_cert_intermediate}\n\n#{site.ssl_cert}"
payload << {username: site.username, domain: site.domain}
end
ar.add_buffer 'sslsites.json', payload.to_json
end
end

View file

@ -46,7 +46,7 @@
<article>
<h2>Add SSL Certificate</h2>
<p>
This allows you to add an SSL private key and certificate for your domain, enabling encryption for your site (https). It can take up to 5-30 minutes for the changes to go live, so please be patient.
This allows you to add an SSL key and certificate for your domain, enabling encryption for your site (https). It can take up to 5-30 minutes for the changes to go live, so please be patient.
</p>
<% if current_site.domain.nil? || current_site.domain.empty? %>
@ -63,7 +63,7 @@
</p>
<p>
Private key (yourdomain.com.key):
SSL Key (yourdomain.com.key):
<input name="key" type="file">
</p>