-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1508 from johndixon/mod_authn_dbd
MODULES-3682 - config of auth_dbd, include dbd, allow AuthnProviderAlias
- Loading branch information
Showing
5 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class apache::mod::authn_dbd ( | ||
$authn_dbd_params, | ||
$authn_dbd_dbdriver = 'mysql', | ||
$authn_dbd_query = undef, | ||
$authn_dbd_min = '4', | ||
$authn_dbd_max = '20', | ||
$authn_dbd_keep = '8', | ||
$authn_dbd_exptime = '300', | ||
$authn_dbd_alias = undef, | ||
) inherits ::apache::params { | ||
include ::apache | ||
include ::apache::mod::dbd | ||
::apache::mod { 'authn_dbd': } | ||
|
||
if $authn_dbd_alias { | ||
include ::apache::mod::authn_core | ||
} | ||
|
||
# Template uses | ||
# - All variables beginning with authn_dbd | ||
file { 'authn_dbd.conf': | ||
ensure => file, | ||
path => "${::apache::mod_dir}/authn_dbd.conf", | ||
mode => $::apache::file_mode, | ||
content => template('apache/mod/authn_dbd.conf.erb'), | ||
require => [ Exec["mkdir ${::apache::mod_dir}"], ], | ||
before => File[$::apache::mod_dir], | ||
notify => Class['Apache::Service'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class apache::mod::dbd { | ||
::apache::mod { 'dbd': } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
require 'spec_helper' | ||
|
||
describe 'apache::mod::authn_dbd', :type => :class do | ||
context "default params" do | ||
let :params do | ||
{ | ||
:authn_dbd_params => 'host=db_host port=3306 user=apache password=###### dbname=apache_auth', | ||
} | ||
end | ||
|
||
it_behaves_like "a mod class, without including apache" | ||
end | ||
|
||
context "default configuration with parameters" do | ||
let :params do | ||
{ | ||
:authn_dbd_params => 'host=db_host port=3306 user=apache password=###### dbname=apache_auth', | ||
:authn_dbd_alias => 'db_authn', | ||
:authn_dbd_query => 'SELECT password FROM authn WHERE username = %s' | ||
} | ||
end | ||
|
||
context "on a Debian OS", :compile do | ||
let :facts do | ||
{ | ||
:id => 'root', | ||
:kernel => 'Linux', | ||
:lsbdistcodename => 'squeeze', | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
:operatingsystemrelease => '6', | ||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', | ||
:concat_basedir => '/dne', | ||
:is_pe => false, | ||
} | ||
end | ||
it { is_expected.to contain_class("apache::params") } | ||
it { is_expected.to contain_apache__mod("authn_dbd") } | ||
it { is_expected.to contain_apache__mod("dbd") } | ||
it { is_expected.to contain_file("authn_dbd.conf").with_path('/etc/apache2/mods-available/authn_dbd.conf') } | ||
end | ||
|
||
context "on a RedHat OS", :compile do | ||
let :facts do | ||
{ | ||
:id => 'root', | ||
:kernel => 'Linux', | ||
:osfamily => 'RedHat', | ||
:operatingsystem => 'RedHat', | ||
:operatingsystemrelease => '6', | ||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', | ||
:concat_basedir => '/dne', | ||
:is_pe => false, | ||
} | ||
end | ||
it { is_expected.to contain_class("apache::params") } | ||
it { is_expected.to contain_apache__mod("authn_dbd") } | ||
it { is_expected.to contain_apache__mod("dbd") } | ||
it { is_expected.to contain_file("authn_dbd.conf").with_path('/etc/httpd/conf.d/authn_dbd.conf') } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#Database Management | ||
DBDriver <%= @authn_dbd_dbdriver %> | ||
|
||
#Connection string: database name and login credentials | ||
DBDParams "<%= @authn_dbd_params %>" | ||
|
||
#Parameters for Connection Pool Management | ||
DBDMin <%= @authn_dbd_min %> | ||
DBDMax <%= @authn_dbd_max %> | ||
DBDKeep <%= @authn_dbd_keep %> | ||
DBDExptime <%= @authn_dbd_exptime %> | ||
|
||
<%- if @authn_dbd_alias -%> | ||
<AuthnProviderAlias dbd <%= @authn_dbd_alias %>> | ||
AuthDBDUserPWQuery "<%= @authn_dbd_query %>" | ||
</AuthnProviderAlias> | ||
<%- end -%> |