diff --git a/manifests/params.pp b/manifests/params.pp index 1f9f60a806..a16b7ef08a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -489,20 +489,34 @@ $lib_path = '/usr/lib64/apache2-prefork' $suse_lib_path = '/usr/lib64/apache2' $mpm_module = 'prefork' - $default_ssl_cert = '/etc/ssl/servercerts/servercert.pem' - $default_ssl_key = '/etc/ssl/servercerts/serverkey.pem' + if $::operatingsystemrelease < '11' { + $default_ssl_cert = '/etc/apache2/ssl.crt/snakeoil-rsa.crt' + $default_ssl_key = '/etc/apache2/ssl.key/snakeoil-rsa.key' + } else { + $default_ssl_cert = '/etc/ssl/servercerts/servercert.pem' + $default_ssl_key = '/etc/ssl/servercerts/serverkey.pem' + } $ssl_certs_dir = '/etc/ssl/certs' $suphp_addhandler = 'x-httpd-php' $suphp_engine = 'off' $suphp_configpath = '/etc/php5/apache2' $php_version = '5' - $mod_packages = { - 'auth_kerb' => 'apache2-mod_auth_kerb', - 'perl' => 'apache2-mod_perl', - 'php5' => 'apache2-mod_php53', - 'python' => 'apache2-mod_python', - 'security' => 'apache2-mod_security2', - } + if $::operatingsystemrelease < '11' { + $mod_packages = { + 'auth_kerb' => 'apache2-mod_auth_kerb', + 'perl' => 'apache2-mod_perl', + 'php5' => 'apache2-mod_php5', + 'python' => 'apache2-mod_python', + } + } else { + $mod_packages = { + 'auth_kerb' => 'apache2-mod_auth_kerb', + 'perl' => 'apache2-mod_perl', + 'php5' => 'apache2-mod_php53', + 'python' => 'apache2-mod_python', + 'security' => 'apache2-mod_security2', + } + } $mod_libs = { 'security' => '/usr/lib64/apache2/mod_security2.so', 'php53' => '/usr/lib64/apache2/mod_php5.so', diff --git a/spec/acceptance/mod_dav_svn_spec.rb b/spec/acceptance/mod_dav_svn_spec.rb index 8b26a6b99f..2b15225094 100644 --- a/spec/acceptance/mod_dav_svn_spec.rb +++ b/spec/acceptance/mod_dav_svn_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper_acceptance' require_relative './version.rb' -describe 'apache::mod::dav_svn class', :unless => (fact('operatingsystem') == 'OracleLinux' and fact('operatingsystemmajrelease') == '7') do +describe 'apache::mod::dav_svn class', :unless => (fact('operatingsystem') == 'OracleLinux' and fact('operatingsystemmajrelease') == '7') || (fact('operatingsystem') == 'SLES' and fact('operatingsystemmajorrelease') < '11') do case fact('osfamily') when 'Debian' if fact('operatingsystemmajrelease') == '6' or fact('operatingsystemmajrelease') == '10.04' or fact('operatingsystemrelease') == '10.04' or fact('operatingsystemmajrelease') == '16.04' diff --git a/spec/acceptance/mod_security_spec.rb b/spec/acceptance/mod_security_spec.rb index c6fa220898..095cce9da0 100644 --- a/spec/acceptance/mod_security_spec.rb +++ b/spec/acceptance/mod_security_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper_acceptance' require_relative './version.rb' -describe 'apache::mod::security class', :unless => (fact('osfamily') == 'Debian' and (fact('lsbdistcodename') == 'squeeze' or fact('lsbdistcodename') == 'lucid' or fact('lsbdistcodename') == 'precise' or fact('lsbdistcodename') == 'wheezy')) do +describe 'apache::mod::security class', :unless => (fact('osfamily') == 'Debian' and (fact('lsbdistcodename') == 'squeeze' or fact('lsbdistcodename') == 'lucid' or fact('lsbdistcodename') == 'precise' or fact('lsbdistcodename') == 'wheezy')) || (fact('operatingsystem') == 'SLES' and fact('operatingsystemrelease') < '11') do context "default mod_security config" do if fact('osfamily') == 'RedHat' and fact('operatingsystemmajrelease') =~ /(5|6)/ it 'adds epel' do diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index 8adbde53bf..89f1af27d8 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -120,31 +120,33 @@ class { 'apache': } end end - context 'new proxy vhost on port 80' do - it 'should configure an apache proxy vhost' do - pp = <<-EOS - class { 'apache': } - apache::vhost { 'proxy.example.com': - port => '80', - docroot => '/var/www/proxy', - proxy_pass_match => [ - { 'path' => '/foo', 'url' => 'http://backend-foo/'}, - ], - proxy_preserve_host => true, - proxy_error_override => true, - } - EOS - apply_manifest(pp, :catch_failures => true) - end + unless (fact('operatingsystem') == 'SLES' and fact('operatingsystemmajorrelease') <= '10') + context 'new proxy vhost on port 80' do + it 'should configure an apache proxy vhost' do + pp = <<-EOS + class { 'apache': } + apache::vhost { 'proxy.example.com': + port => '80', + docroot => '#{$docroot}/proxy', + proxy_pass_match => [ + { 'path' => '/foo', 'url' => 'http://backend-foo/'}, + ], + proxy_preserve_host => true, + proxy_error_override => true, + } + EOS + apply_manifest(pp, :catch_failures => true) + end - describe file("#{$vhost_dir}/25-proxy.example.com.conf") do - it { is_expected.to contain '' } - it { is_expected.to contain "ServerName proxy.example.com" } - it { is_expected.to contain "ProxyPassMatch /foo http://backend-foo/" } - it { is_expected.to contain "ProxyPreserveHost On" } - it { is_expected.to contain "ProxyErrorOverride On" } - it { is_expected.not_to contain "ProxyAddHeaders" } - it { is_expected.not_to contain "" } + describe file("#{$vhost_dir}/25-proxy.example.com.conf") do + it { is_expected.to contain '' } + it { is_expected.to contain "ServerName proxy.example.com" } + it { is_expected.to contain "ProxyPassMatch /foo http://backend-foo/" } + it { is_expected.to contain "ProxyPreserveHost On" } + it { is_expected.to contain "ProxyErrorOverride On" } + it { is_expected.not_to contain "ProxyAddHeaders" } + it { is_expected.not_to contain "" } + end end end @@ -664,47 +666,49 @@ class { 'apache': default_vhost => false, } end end - context 'proxy_pass_match for alternative vhost' do - it 'should configure a local vhost and a proxy vhost' do - apply_manifest(%{ - class { 'apache': default_vhost => false, } - apache::vhost { 'localhost': - docroot => '/var/www/local', - ip => '127.0.0.1', - port => '8888', - } - apache::listen { '*:80': } - apache::vhost { 'proxy.example.com': - docroot => '/var/www', - port => '80', - add_listen => false, - proxy_pass_match => { - 'path' => '/', - 'url' => 'http://localhost:8888/subdir/', - }, - } - host { 'proxy.example.com': ip => '127.0.0.1', } - file { ['/var/www/local', '/var/www/local/subdir']: ensure => directory, } - file { '/var/www/local/subdir/index.html': - ensure => file, - content => "Hello from localhost\\n", - } - }, :catch_failures => true) - end + unless (fact('operatingsystem') == 'SLES' and fact('operatingsystemmajorrelease') <= '10') + context 'proxy_pass_match for alternative vhost' do + it 'should configure a local vhost and a proxy vhost' do + apply_manifest(%{ + class { 'apache': default_vhost => false, } + apache::vhost { 'localhost': + docroot => '/var/www/local', + ip => '127.0.0.1', + port => '8888', + } + apache::listen { '*:80': } + apache::vhost { 'proxy.example.com': + docroot => '/var/www', + port => '80', + add_listen => false, + proxy_pass_match => { + 'path' => '/', + 'url' => 'http://localhost:8888/subdir/', + }, + } + host { 'proxy.example.com': ip => '127.0.0.1', } + file { ['/var/www/local', '/var/www/local/subdir']: ensure => directory, } + file { '/var/www/local/subdir/index.html': + ensure => file, + content => "Hello from localhost\\n", + } + }, :catch_failures => true) + end - describe service($service_name) do - if (fact('operatingsystem') == 'Debian' && fact('operatingsystemmajrelease') == '8') - pending 'Should be enabled - Bug 760616 on Debian 8' - else - it { should be_enabled } + describe service($service_name) do + if (fact('operatingsystem') == 'Debian' && fact('operatingsystemmajrelease') == '8') + pending 'Should be enabled - Bug 760616 on Debian 8' + else + it { should be_enabled } + end + it { is_expected.to be_running } end - it { is_expected.to be_running } - end - it 'should get a response from the back end' do - shell("/usr/bin/curl --max-redirs 0 proxy.example.com:80") do |r| - expect(r.stdout).to eq("Hello from localhost\n") - expect(r.exit_code).to eq(0) + it 'should get a response from the back end' do + shell("/usr/bin/curl --max-redirs 0 proxy.example.com:80") do |r| + expect(r.stdout).to eq("Hello from localhost\n") + expect(r.exit_code).to eq(0) + end end end end @@ -1348,7 +1352,7 @@ class { 'apache::mod::wsgi': } end end - context 'on everything but lucid', :unless => (fact('lsbdistcodename') == 'lucid' or (fact('operatingsystem') == 'SLES' && fact('operatingsystemmajrelease') < '12')) do + context 'on everything but lucid', :unless => (fact('lsbdistcodename') == 'lucid' or fact('operatingsystem') == 'SLES') do it 'import_script applies cleanly' do pp = <<-EOS class { 'apache': }