forked from redhat-openstack/openstack-puppet-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #923 from pcfens/add_auth_cas
Add support for mod_auth_cas module configuration
- Loading branch information
Showing
5 changed files
with
155 additions
and
2 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,48 @@ | ||
class apache::mod::auth_cas ( | ||
$cas_login_url, | ||
$cas_validate_url, | ||
$cas_cookie_path = $::apache::params::cas_cookie_path, | ||
$cas_version = 2, | ||
$cas_debug = 'Off', | ||
$cas_validate_depth = undef, | ||
$cas_certificate_path = undef, | ||
$cas_proxy_validate_url = undef, | ||
$cas_root_proxied_as = undef, | ||
$cas_cookie_entropy = undef, | ||
$cas_timeout = undef, | ||
$cas_idle_timeout = undef, | ||
$cas_cache_clean_interval = undef, | ||
$cas_cookie_domain = undef, | ||
$cas_cookie_http_only = undef, | ||
$cas_authoritative = undef, | ||
$suppress_warning = false, | ||
) { | ||
|
||
validate_string($cas_login_url, $cas_validate_url, $cas_cookie_path) | ||
|
||
if $::osfamily == 'RedHat' and ! $suppress_warning { | ||
warning('RedHat distributions do not have Apache mod_auth_cas in their default package repositories.') | ||
} | ||
|
||
::apache::mod { 'auth_cas': } | ||
|
||
file { $cas_cookie_path: | ||
ensure => directory, | ||
before => File['auth_cas.conf'], | ||
mode => '0750', | ||
owner => $apache::user, | ||
group => $apache::group, | ||
} | ||
|
||
# Template uses | ||
# - All variables beginning with cas_ | ||
file { 'auth_cas.conf': | ||
ensure => file, | ||
path => "${::apache::mod_dir}/auth_cas.conf", | ||
content => template('apache/mod/auth_cas.conf.erb'), | ||
require => [ Exec["mkdir ${::apache::mod_dir}"], ], | ||
before => File[$::apache::mod_dir], | ||
notify => Service['httpd'], | ||
} | ||
|
||
} |
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,54 @@ | ||
require 'spec_helper' | ||
|
||
describe 'apache::mod::auth_cas', :type => :class do | ||
let :params do | ||
{ | ||
:cas_login_url => 'https://cas.example.com/login', | ||
:cas_validate_url => 'https://cas.example.com/validate', | ||
} | ||
end | ||
|
||
let :pre_condition do | ||
'include ::apache' | ||
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("auth_cas") } | ||
it { is_expected.to contain_package("libapache2-mod-auth-cas") } | ||
it { is_expected.to contain_file("auth_cas.conf").with_path('/etc/apache2/mods-available/auth_cas.conf') } | ||
it { is_expected.to contain_file("/var/cache/apache2/mod_auth_cas/").with_owner('www-data') } | ||
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("auth_cas") } | ||
it { is_expected.to contain_package("mod_auth_cas") } | ||
it { is_expected.to contain_file("auth_cas.conf").with_path('/etc/httpd/conf.d/auth_cas.conf') } | ||
it { is_expected.to contain_file("/var/cache/mod_auth_cas/").with_owner('apache') } | ||
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,40 @@ | ||
CASCookiePath <%= @cas_cookie_path %> | ||
CASLoginURL <%= @cas_login_url %> | ||
CASValidateURL <%= @cas_validate_url %> | ||
|
||
CASVersion <%= @cas_version %> | ||
CASDebug <%= @cas_debug %> | ||
|
||
<% if @cas_certificate_path -%> | ||
CASCertificatePath <%= @cas_certificate_path %> | ||
<% end -%> | ||
<% if @cas_proxy_validate_url -%> | ||
CASProxyValidateURL <%= @cas_proxy_validate_url %> | ||
<% end -%> | ||
<% if @cas_validate_depth -%> | ||
CASValidateDepth <%= @cas_validate_depth %> | ||
<% end -%> | ||
<% if @cas_root_proxied_as -%> | ||
CASRootProxiedAs <%= @cas_root_proxied_as %> | ||
<% end -%> | ||
<% if @cas_cookie_entropy -%> | ||
CASCookieEntropy <%= @cas_cookie_entropy %> | ||
<% end -%> | ||
<% if @cas_timeout -%> | ||
CASTimeout <%= @cas_timeout %> | ||
<% end -%> | ||
<% if @cas_idle_timeout -%> | ||
CASIdleTimeout <%= @cas_idle_timeout %> | ||
<% end -%> | ||
<% if @cas_cache_clean_interval -%> | ||
CASCacheCleanInterval <%= @cas_cache_clean_interval %> | ||
<% end -%> | ||
<% if @cas_cookie_domain -%> | ||
CASCookieDomain <%= @cas_cookie_domain %> | ||
<% end -%> | ||
<% if @cas_cookie_http_only -%> | ||
CASCookieHttpOnly <%= @cas_cookie_http_only %> | ||
<% end -%> | ||
<% if @cas_authoritative -%> | ||
CASAuthoritative <%= @cas_authoritative %> | ||
<% end -%> |