From fb81366dd5294e1d070dc1eedb921da0b88942e4 Mon Sep 17 00:00:00 2001 From: Jonathan Hartman Date: Tue, 2 Feb 2016 15:55:38 -0800 Subject: [PATCH] Ensure rsyslog is running in build environments --- test/cookbooks/clamav_test/recipes/default.rb | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/test/cookbooks/clamav_test/recipes/default.rb b/test/cookbooks/clamav_test/recipes/default.rb index 49dd594..18b8fcf 100644 --- a/test/cookbooks/clamav_test/recipes/default.rb +++ b/test/cookbooks/clamav_test/recipes/default.rb @@ -21,4 +21,32 @@ # Compiler is needed to install Cucumber for the acceptance tests include_recipe 'apt' if node['platform_family'] == 'debian' include_recipe 'build-essential' -include_recipe 'clamav::default' + +# Ensure rsyslog is installed and running, regardless of whether the build +# environment is a Vagrant box or a Docker container with no init system. +package 'rsyslog' +file '/etc/rsyslog.conf' do + content <<-EOH.gsub(/^ {4}/, '') + $ModLoad imuxsock + $WorkDirectory /var/lib/rsyslog + $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + $OmitLocalLogging off + *.info;mail.none;authpriv.none;cron.none /var/log/messages + authpriv.* /var/log/secure + mail.* -/var/log/maillog + cron.* /var/log/cron + *.emerg :omusrmsg:* + uucp,news.crit /var/log/spooler + local7.* /var/log/boot.log + EOH + only_if do + node['platform_family'] == 'rhel' && \ + node['platform_version'].to_i >= 7 && \ + File.open('/proc/1/cmdline').read.start_with?('/usr/sbin/sshd') + end +end +execute 'rsyslogd' do + ignore_failure true +end + +include_recipe 'clamav'