Sha256: e1e9ec9c6c7d1199c5f23cd3d34b4c04a9921cee678ca0f25c9d087892f03c50

Contents?: true

Size: 802 Bytes

Versions: 12

Compression:

Stored size: 802 Bytes

Contents

def server_key(file='/etc/rmails.key')
  pass = SecureRandom.base64(56)
  edit :file => pass_file = mktemp do
    append pass
  end
  puts pass+' '+pass_file
  sh "openssl genrsa -des3 -rand /etc/hosts -out #{file} 4096 -passout file:#{pass_file}"
  rm pass_file
  chperm file, :user => "root", :group => 'rmails', :mode => 400
  pass
end

def nginx_key
  sh "openssl req -new -newkey rsa:4096 -x509 -days 3650 -nodes -out /etc/ssl/certs/https.pem -keyout /etc/ssl/private/https.pem -subj /C=/ST=/L=/O=/OU=/CN=#{lookup('postfix#mydomain')}/emailAddress=#{lookup('dovecot#postmaster')}"
  chperm '/etc/ssl/certs/https.pem',
      :user => "root",
      :group => 'rmails',
      :mode => 400
  chperm '/etc/ssl/private/https.pem',
      :user => "root",
      :group => 'rmails',
      :mode => 400
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rmails-0.2.5 system/lib/ssl.rb
rmails-0.2.4 system/lib/ssl.rb
rmails-0.2.3 system/lib/ssl.rb
rmails-0.2.2 system/lib/ssl.rb
rmails-0.2.1 system/lib/ssl.rb
rmails-0.2.0 system/lib/ssl.rb
rmails-0.1.6 system/lib/ssl.rb
rmails-0.1.5 system/lib/ssl.rb
rmails-0.1.4 system/lib/ssl.rb
rmails-0.1.3 system/lib/ssl.rb
rmails-0.1.2 system/lib/ssl.rb
rmails-0.1.1 system/lib/ssl.rb