]> git.openstreetmap.org Git - chef.git/commitdiff
Use self signed certificates for exim
authorTom Hughes <tom@compton.nu>
Thu, 17 Oct 2013 17:46:34 +0000 (18:46 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 17 Oct 2013 17:49:54 +0000 (18:49 +0100)
cookbooks/exim/metadata.rb
cookbooks/exim/recipes/default.rb
cookbooks/exim/templates/default/exim4.conf.erb

index 861ce0931684f6ec56ba847adfbd9c3920d579d8..72a7a113fa39a207bf16451f4b30d39aa8b2bb1b 100644 (file)
@@ -5,7 +5,6 @@ description       "Installs and configures exim"
 long_description  IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
 version           "1.0.0"
 depends           "networking"
-depends           "ssl"
 
 attribute "exim",
   :display_name => "Exim",
index b5b15080c0a15c615fc6aba0366389c9480a45ea..25ff1c1b8ad278663bbb8e8f35791154e9793ac8 100644 (file)
@@ -18,9 +18,9 @@
 #
 
 include_recipe "networking"
-include_recipe "ssl"
 
 package "exim4"
+package "openssl"
 
 if File.exist?("/var/run/clamav/clamd.ctl")
   package "exim4-daemon-heavy"
@@ -32,11 +32,19 @@ group "ssl-cert" do
   append true
 end
 
+execute "/etc/ssl/certs/exim.pem" do
+  command "openssl req -x509 -newkey rsa:2048 -keyout /etc/ssl/private/exim.key -out /etc/ssl/certs/exim.pem -days 3650 -nodes -subj='/O=OpenStreetMap/CN=#{node[:name]}'"
+  user "root"
+  group "ssl-cert"
+  not_if do
+    File.exists?("/etc/ssl/certs/exim.pem") && File.exists?("/etc/ssl/private/exim.key")
+  end
+end
+
 service "exim4" do
   action [ :enable, :start ]
   supports :status => true, :restart => true, :reload => true
-  subscribes :restart, resources(:cookbook_file => "/etc/ssl/certs/openstreetmap.pem")
-  subscribes :restart, resources(:file => "/etc/ssl/private/openstreetmap.key")
+  subscribes :restart, "execute[/etc/ssl/certs/exim.pem]"
 end
 
 relay_to_domains = node[:exim][:relay_to_domains]
index c1a842c5b412dc771d32909e33a8eab5ae692145..81639bce49c0d935e8a72157a3453e4275347fcc 100644 (file)
@@ -152,8 +152,8 @@ tls_advertise_hosts = <; !127.0.0.1 ; !::1
 # need the first setting, or in separate files, in which case you need both
 # options.
 
-tls_certificate = /etc/ssl/certs/openstreetmap.pem
-tls_privatekey = /etc/ssl/private/openstreetmap.key
+tls_certificate = /etc/ssl/certs/exim.pem
+tls_privatekey = /etc/ssl/private/exim.key
 
 # In order to support roaming users who wish to send email from anywhere,
 # you may want to make Exim listen on other ports as well as port 25, in