From adacceed5a495272f19ab9062b7521d310095c65 Mon Sep 17 00:00:00 2001 From: Dave Eargle Date: Sat, 20 Oct 2018 01:51:32 -0600 Subject: [PATCH] remove carriage returns from service config files --- chef/cookbooks/metasploitable/recipes/knockd.rb | 4 ++++ chef/cookbooks/metasploitable/recipes/proftpd.rb | 6 ++++++ chef/cookbooks/metasploitable/recipes/unrealircd.rb | 7 +++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/chef/cookbooks/metasploitable/recipes/knockd.rb b/chef/cookbooks/metasploitable/recipes/knockd.rb index 40d10e4..854c169 100644 --- a/chef/cookbooks/metasploitable/recipes/knockd.rb +++ b/chef/cookbooks/metasploitable/recipes/knockd.rb @@ -18,6 +18,10 @@ cookbook_file '/etc/default/knockd' do mode '0600' end +execute 'remove_carriage_returns' do + command "sed -i -e 's/\r//g' /etc/default/knockd" +end + service 'knockd' do action [:enable, :start] end diff --git a/chef/cookbooks/metasploitable/recipes/proftpd.rb b/chef/cookbooks/metasploitable/recipes/proftpd.rb index b25e238..866198a 100644 --- a/chef/cookbooks/metasploitable/recipes/proftpd.rb +++ b/chef/cookbooks/metasploitable/recipes/proftpd.rb @@ -40,6 +40,11 @@ cookbook_file '/etc/init.d/proftpd' do mode '760' end +execute 'remove_carriage_returns' do + command "sed -i -e 's/\r//g' /etc/init.d/proftpd" +end + + # Setup the IP Renewer cookbook_file '/opt/proftpd/proftpd_ip_renewer.rb' do source 'proftpd/proftpd_ip_renewer.rb' @@ -48,6 +53,7 @@ cookbook_file '/opt/proftpd/proftpd_ip_renewer.rb' do group 'root' end + cookbook_file '/etc/init/proftpd_ip_renewer.conf' do source 'proftpd/proftpd_ip_renewer.conf' mode '0644' diff --git a/chef/cookbooks/metasploitable/recipes/unrealircd.rb b/chef/cookbooks/metasploitable/recipes/unrealircd.rb index 92041d5..9224aac 100644 --- a/chef/cookbooks/metasploitable/recipes/unrealircd.rb +++ b/chef/cookbooks/metasploitable/recipes/unrealircd.rb @@ -67,11 +67,10 @@ cookbook_file '/etc/init.d/unrealircd' do mode '760' end -execute 'start unrealircd service' do - # This should ideally be a service resource but for some reason chef doesn't start the service properly when it is. - command '/etc/init.d/unrealircd start' +execute 'remove_carriage_returns' do + command "sed -i -e 's/\r//g' /etc/init.d/unrealircd" end service 'unrealircd' do - action :enable + action [:enable, :start] end