]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/oxidized/recipes/default.rb
supybot: update switch2osm url
[chef.git] / cookbooks / oxidized / recipes / default.rb
index d9689d714dd2626004713f4e1fb7338433ebf4e5..66c919908c8b01bf04341256621b5078747f3fec 100644 (file)
@@ -29,6 +29,7 @@ package %w[
   libssh2-1-dev
   zlib1g-dev
   pkg-config
   libssh2-1-dev
   zlib1g-dev
   pkg-config
+  libyaml-dev
 ]
 
 keys = data_bag_item("oxidized", "keys")
 ]
 
 keys = data_bag_item("oxidized", "keys")
@@ -75,7 +76,7 @@ git "/opt/oxidized/daemon" do
   depth 1
   user "oxidized"
   group "oxidized"
   depth 1
   user "oxidized"
   group "oxidized"
-  notifies :run, "bundle_install[/opt/oxidized/daemon]"
+  notifies :run, "bundle_install[/opt/oxidized/daemon]", :immediately
 end
 
 directory "/opt/oxidized/.ssh" do
 end
 
 directory "/opt/oxidized/.ssh" do
@@ -85,33 +86,41 @@ directory "/opt/oxidized/.ssh" do
 end
 
 # Key is set as a deployment key in github repo
 end
 
 # Key is set as a deployment key in github repo
-file "/opt/oxidized/.ssh/id_rsa" do
+file "/opt/oxidized/.ssh/id_ed25519" do
   content keys["git"].join("\n")
   owner "oxidized"
   group "oxidized"
   mode "400"
   content keys["git"].join("\n")
   owner "oxidized"
   group "oxidized"
   mode "400"
-  notifies :delete, "file[/opt/oxidized/.ssh/id_rsa.pub]", :immediately
+  notifies :delete, "file[/opt/oxidized/.ssh/id_ed25519.pub]", :immediately
   notifies :restart, "service[oxidized]"
 end
 
 # Ensure public key is deleted if private key is changed. Trigged by notify
   notifies :restart, "service[oxidized]"
 end
 
 # Ensure public key is deleted if private key is changed. Trigged by notify
-file "/opt/oxidized/.ssh/id_rsa.pub" do
+file "/opt/oxidized/.ssh/id_ed25519.pub" do
   action :nothing
 end
 
   action :nothing
 end
 
-execute "/opt/oxidized/.ssh/id_rsa.pub" do
-  command "ssh-keygen -f /opt/oxidized/.ssh/id_rsa -y > /opt/oxidized/.ssh/id_rsa.pub"
+execute "/opt/oxidized/.ssh/id_ed25519.pub" do
+  command "ssh-keygen -f /opt/oxidized/.ssh/id_ed25519 -y > /opt/oxidized/.ssh/id_ed25519.pub"
   user "oxidized"
   group "oxidized"
   user "oxidized"
   group "oxidized"
-  creates "/opt/oxidized/.ssh/id_rsa.pub"
+  creates "/opt/oxidized/.ssh/id_ed25519.pub"
   notifies :restart, "service[oxidized]"
 end
 
   notifies :restart, "service[oxidized]"
 end
 
-ssh_known_hosts_entry 'github.com' do
+ssh_known_hosts_entry "github.com" do
+  action [:create, :flush]
+  file_location "/opt/oxidized/.ssh/known_hosts"
   owner "oxidized"
   group "oxidized"
 end
 
   owner "oxidized"
   group "oxidized"
 end
 
+directory "/var/lib/oxidized" do
+  owner "oxidized"
+  group "oxidized"
+  mode "750"
+end
+
 git "/var/lib/oxidized/configs.git" do
   action :sync
   repository "git@github.com:openstreetmap/oxidized-configs.git" # Uses oxidized ssh key
 git "/var/lib/oxidized/configs.git" do
   action :sync
   repository "git@github.com:openstreetmap/oxidized-configs.git" # Uses oxidized ssh key
@@ -134,15 +143,13 @@ systemd_service "oxidized" do
   after "network.target"
   user "oxidized"
   working_directory "/opt/oxidized/daemon"
   after "network.target"
   user "oxidized"
   working_directory "/opt/oxidized/daemon"
+  runtime_directory "oxidized"
   exec_start "#{node[:ruby][:bundle]} exec oxidized"
   environment "OXIDIZED_HOME" => "/etc/oxidized",
               "OXIDIZED_LOGS" => "/var/log/oxidized"
   nice 10
   exec_start "#{node[:ruby][:bundle]} exec oxidized"
   environment "OXIDIZED_HOME" => "/etc/oxidized",
               "OXIDIZED_LOGS" => "/var/log/oxidized"
   nice 10
-  private_tmp true
-  private_devices true
-  protect_system "full"
-  protect_home true
-  no_new_privileges true
+  sandbox :enable_network => true
+  read_write_paths ["/run/oxidized", "/var/lib/oxidized", "/var/log/oxidized"]
   restart "on-failure"
   notifies :restart, "service[oxidized]"
 end
   restart "on-failure"
   notifies :restart, "service[oxidized]"
 end