-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and expand spec tests, including code fixes to match expected…
… behaviour.
- Loading branch information
Showing
11 changed files
with
822 additions
and
174 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 |
---|---|---|
@@ -1,60 +1,86 @@ | ||
class apache::mod::shib( | ||
$shib_admin = $apache::serveradmin, | ||
$shib_hostname = $fqdn, | ||
$logoLocation = "/shibboleth-sp/logo.jpg", | ||
$styleSheet = "/shibboleth-sp/main.css", | ||
$shib_conf_dir = '/etc/shibboleth', | ||
$shib_conf_file = 'shibboleth2.xml', | ||
$shib_sp_cert = 'sp-cert.pem', | ||
$shib_bin_dir = '/usr/sbin', | ||
$handlerSSL = 'true' | ||
$shib_admin = $apache::serveradmin, | ||
$shib_hostname = $::fqdn, | ||
$logoLocation = '/shibboleth-sp/logo.jpg', | ||
$styleSheet = '/shibboleth-sp/main.css', | ||
$shib_conf_dir = '/etc/shibboleth', | ||
$shib_conf_file = 'shibboleth2.xml', | ||
$shib_sp_cert = 'sp-cert.pem', | ||
$shib_bin_dir = '/usr/sbin', | ||
$handlerSSL = true, | ||
$consistent_address = true | ||
){ | ||
|
||
$shib_conf = "${shib_conf_dir}/${shib_conf_file}" | ||
$mod_shib = 'shib2' | ||
|
||
apache::mod {$mod_shib: } | ||
|
||
file{$shib_conf_dir: | ||
ensure => directory, | ||
require => Apache::Mod[$mod_shib] | ||
} | ||
|
||
file{$shib_conf: | ||
ensure => file, | ||
replace => false, | ||
require => [Apache::Mod[$mod_shib],File[$shib_conf_dir]], | ||
} | ||
|
||
augeas{"shib_SPconfig_errors": | ||
lens => 'Xml.lns', | ||
incl => $shib_conf, | ||
context => "/files${shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
"set Errors/#attribute/supportContact ${shib_admin}", | ||
"set Errors/#attribute/logoLocation ${logoLocation}", | ||
"set Errors/#attribute/styleSheet ${styleSheet}", | ||
], | ||
notify => Service['httpd'], | ||
} | ||
|
||
augeas{"shib_SPconfig_hostname": | ||
lens => 'Xml.lns', | ||
incl => $shib_conf, | ||
context => "/files${shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
"set #attribute/entityID https://${shib_hostname}/shibboleth", | ||
"set Sessions/#attribute/handlerURL https://${shib_hostname}/Shibboleth.sso", | ||
], | ||
notify => Service['httpd'], | ||
} | ||
|
||
augeas{"shib_SPconfig_handlerSSL": | ||
lens => 'Xml.lns', | ||
incl => $shib_conf, | ||
context => "/files${shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => ["set Sessions/#attribute/handlerSSL ${handlerSSL}",], | ||
notify => Service['httpd'], | ||
} | ||
$shib_conf = "${shib_conf_dir}/${shib_conf_file}" | ||
$mod_shib = 'shib2' | ||
|
||
apache::mod {$mod_shib: | ||
id => 'mod_shib', | ||
} | ||
|
||
# by requiring the Apache::Mod, this should wait for the package | ||
# to create the directory and not need to manage it | ||
file{$shib_conf_dir: | ||
ensure => 'directory', | ||
require => Apache::Mod[$mod_shib] | ||
} | ||
|
||
# by requiring the Apache::Mod, this will just define the file | ||
# created when installing the package. | ||
file{$shib_conf: | ||
ensure => 'file', | ||
replace => false, | ||
require => [Apache::Mod[$mod_shib],File[$shib_conf_dir]], | ||
} | ||
|
||
# augeas should auto-require the file $shib_conf | ||
augeas{'shib_SPconfig_errors': | ||
lens => 'Xml.lns', | ||
incl => $shib_conf, | ||
context => "/files${shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
"set Errors/#attribute/supportContact ${shib_admin}", | ||
"set Errors/#attribute/logoLocation ${logoLocation}", | ||
"set Errors/#attribute/styleSheet ${styleSheet}", | ||
], | ||
notify => Service['httpd','shibd'], | ||
} | ||
|
||
augeas{'shib_SPconfig_consistent_address': | ||
lens => 'Xml.lns', | ||
incl => $shib_conf, | ||
context => "/files${shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
"set Sessions/#attribute/consistentAddress ${consistent_address}", | ||
], | ||
notify => Service['httpd','shibd'], | ||
} | ||
|
||
augeas{'shib_SPconfig_hostname': | ||
lens => 'Xml.lns', | ||
incl => $shib_conf, | ||
context => "/files${shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
"set #attribute/entityID https://${shib_hostname}/shibboleth", | ||
"set Sessions/#attribute/handlerURL https://${shib_hostname}/Shibboleth.sso", | ||
], | ||
notify => Service['httpd','shibd'], | ||
} | ||
|
||
augeas{'shib_SPconfig_handlerSSL': | ||
lens => 'Xml.lns', | ||
incl => $shib_conf, | ||
context => "/files${shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => ["set Sessions/#attribute/handlerSSL ${handlerSSL}",], | ||
notify => Service['httpd','shibd'], | ||
} | ||
|
||
service{'shibd': | ||
ensure => 'running', | ||
enable => true, | ||
hasrestart => true, | ||
hasstatus => true, | ||
require => Apache::Mod[$mod_shib], | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,32 +1,32 @@ | ||
# parameter setup allows an attribute_map to bedownloaded with one name | ||
# and saved locally by another. | ||
define apache::mod::shib::attribute_map( | ||
$attribute_map_uri, | ||
$attribute_map_dir = $apache::mod::shib::shib_conf_dir, | ||
$attribute_map_name = inline_template("<%= attribute_map_uri.split('/').last %>"), | ||
$max_age = '21' | ||
$attribute_map_uri, | ||
$attribute_map_dir = $::apache::mod::shib::shib_conf_dir, | ||
$attribute_map_name = inline_template("<%= attribute_map_uri.split('/').last %>"), | ||
$max_age = '21' | ||
){ | ||
|
||
require apache::mod::shib | ||
$attribute_map = "${attribute_map_dir}/${attribute_map_name}" | ||
|
||
$attribute_map = "${attribute_map_dir}/${attribute_map_name}" | ||
# Download the attribute map, refresh after $max_age days | ||
exec{"get_${name}_attribute_map": | ||
path => ['/usr/bin'], | ||
command => "wget ${attribute_map_uri} -O ${attribute_map}", | ||
unless => "test `find ${attribute_map} -mtime +${max_age}`", | ||
notify => Service['httpd','shibd'], | ||
} | ||
|
||
# Download the attribute map, refresh after $max_age days | ||
exec{"get_${name}_attribute_map": | ||
path => ['/usr/bin'], | ||
command => "wget ${attribute_map_uri} -O ${attribute_map}", | ||
unless => "test `find ${attribute_map} -mtime +${max_age}`", | ||
notify => Service['httpd'], | ||
} | ||
|
||
# Make sure the shibboleth config is pointing at the attribute map | ||
augeas{"shib_${name}_attribute_map": | ||
lens => 'Xml.lns', | ||
incl => $apache::mod::shib::shib_conf, | ||
context => "/files${apache::mod::shib::shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
"set AttributeExtractor/#attribute/path ${attribute_map_name}", | ||
], | ||
notify => Service['httpd'], | ||
require => Exec["get_${name}_attribute_map"], | ||
} | ||
# Make sure the shibboleth config is pointing at the attribute map | ||
augeas{"shib_${name}_attribute_map": | ||
lens => 'Xml.lns', | ||
incl => $::apache::mod::shib::shib_conf, | ||
context => "/files${::apache::mod::shib::shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
"set AttributeExtractor/#attribute/path ${attribute_map_name}", | ||
], | ||
notify => Service['httpd','shibd'], | ||
require => Exec["get_${name}_attribute_map"], | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
# This generates a self signed x509 certificate used to secure connections | ||
# with a Shibboleth Federation registry. If the key is ever lost or overwritten | ||
# the certificate will have to be re-registered. | ||
# Alternativly, the certificate could be deployed from the puppetmaster | ||
class apache::mod::shib::backend_cert( | ||
$sp_hostname = $apache::mod::shib::shib_hostname | ||
){ | ||
$sp_hostname = $apache::mod::shib::shib_hostname | ||
) { | ||
|
||
require apache::mod::shib | ||
require apache::mod::shib | ||
|
||
$sp_cert = "${apache::mod::shib::shib_conf_dir}/${apache::mod::shib::shib_sp_cert}" | ||
$sp_cert = "${::apache::mod::shib::shib_conf_dir}/${::apache::mod::shib::shib_sp_cert}" | ||
|
||
exec{"shib_keygen_${sp_hostname}": | ||
path => [$apache::mod::shib::shib_bin_dir,'/usr/bin','/bin'], | ||
command => "shib-keygen -h ${sp_hostname} -e https://${sp_hostname}/shibbloeth", | ||
unless => "openssl x509 -noout -in ${sp_cert} -issuer|grep ${sp_hostname}", | ||
} | ||
exec{"shib_keygen_${sp_hostname}": | ||
path => [$::apache::mod::shib::shib_bin_dir,'/usr/bin','/bin'], | ||
command => "shib-keygen -f -h ${sp_hostname} -e https://${sp_hostname}/shibbloeth", | ||
unless => "openssl x509 -noout -in ${sp_cert} -issuer|grep ${sp_hostname}", | ||
} | ||
} |
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 |
---|---|---|
@@ -1,60 +1,58 @@ | ||
# Currently this can only create a _single_ metadata provider | ||
# it will need to be modified to permit multiple metadata providers | ||
define apache::mod::shib::metadata( | ||
$provider_uri, | ||
$cert_uri, | ||
$backing_file_dir = $apache::mod::shib::shib_conf_dir, | ||
$backing_file_name = inline_template("<%= provider_uri.split('/').last %>"), | ||
$cert_dir = $apache::mod::shib::shib_conf_dir, | ||
$cert_file_name = inline_template("<%= cert_uri.split('/').last %>"), | ||
$provider_type = 'XML', | ||
$provider_reload_interval = "7200", | ||
$metadata_filter_max_validity_interval = "2419200" | ||
$provider_uri, | ||
$cert_uri, | ||
$backing_file_dir = $::apache::mod::shib::shib_conf_dir, | ||
$backing_file_name = inline_template("<%= provider_uri.split('/').last %>"), | ||
$cert_dir = $::apache::mod::shib::shib_conf_dir, | ||
$cert_file_name = inline_template("<%= cert_uri.split('/').last %>"), | ||
$provider_type = 'XML', | ||
$provider_reload_interval = '7200', | ||
$metadata_filter_max_validity_interval = '2419200' | ||
){ | ||
|
||
require apache::mod::shib | ||
$backing_file = "${backing_file_dir}/${backing_file_name}" | ||
$cert_file = "${cert_dir}/${cert_file_name}" | ||
|
||
$backing_file = "${backing_file_dir}/${backing_file_name}" | ||
$cert_file = "${cert_dir}/${cert_file_name}" | ||
# Get the Metadata signing certificate | ||
exec{"get_${name}_metadata_cert": | ||
path => ['/usr/bin'], | ||
command => "wget ${cert_uri} -O ${cert_file}", | ||
creates => $cert_file, | ||
notify => Service['httpd','shibd'], | ||
} | ||
|
||
# Get the Metadata signing certificate | ||
exec{"get_${name}_metadata_cert": | ||
path => ['/usr/bin'], | ||
command => "wget ${cert_uri} -O ${cert_file}", | ||
creates => $cert_file, | ||
notify => Service['httpd'], | ||
} | ||
# This puts the MetadataProvider entry in the 'right' place | ||
augeas{"shib_${name}_create_metadata_provider": | ||
lens => 'Xml.lns', | ||
incl => $::apache::mod::shib::shib_conf, | ||
context => "/files${::apache::mod::shib::shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
'ins MetadataProvider after Errors', | ||
], | ||
onlyif => 'match MetadataProvider/#attribute/uri size == 0', | ||
notify => Service['httpd','shibd'], | ||
require => Exec["get_${name}_metadata_cert"], | ||
} | ||
|
||
# This puts the MetadataProvider entry in the 'right' place | ||
augeas{"shib_${name}_create_metadata_provider": | ||
lens => 'Xml.lns', | ||
incl => $apache::mod::shib::shib_conf, | ||
context => "/files${apache::mod::shib::shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
"ins MetadataProvider after Errors", | ||
], | ||
onlyif => 'match MetadataProvider/#attribute/uri size == 0', | ||
notify => Service['httpd'], | ||
require => Exec["get_${name}_metadata_cert"], | ||
} | ||
|
||
# This will update the attributes and child nodes if they change | ||
augeas{"shib_${name}_metadata_provider": | ||
lens => 'Xml.lns', | ||
incl => $apache::mod::shib::shib_conf, | ||
context => "/files${apache::mod::shib::shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
"set MetadataProvider/#attribute/type ${provider_type}", | ||
"set MetadataProvider/#attribute/uri ${provider_uri}", | ||
"set MetadataProvider/#attribute/backingFilePath ${backing_file}", | ||
"set MetadataProvider/#attribute/reloadInterva ${provider_reload_interval}", | ||
"set MetadataProvider/MetadataFilter[1]/#attribute/type RequireValidUntil", | ||
"set MetadataProvider/MetadataFilter[1]/#attribute/maxValidityInterval ${metadata_filter_max_validity_interval}", | ||
"set MetadataProvider/MetadataFilter[2]/#attribute/type Signature", | ||
"set MetadataProvider/MetadataFilter[2]/#attribute/certificate ${cert_file}", | ||
], | ||
notify => Service['httpd'], | ||
require => [Exec["get_${name}_metadata_cert"],Augeas["shib_${name}_create_metadata_provider"]], | ||
} | ||
# This will update the attributes and child nodes if they change | ||
augeas{"shib_${name}_metadata_provider": | ||
lens => 'Xml.lns', | ||
incl => $::apache::mod::shib::shib_conf, | ||
context => "/files${::apache::mod::shib::shib_conf}/SPConfig/ApplicationDefaults", | ||
changes => [ | ||
"set MetadataProvider/#attribute/type ${provider_type}", | ||
"set MetadataProvider/#attribute/uri ${provider_uri}", | ||
"set MetadataProvider/#attribute/backingFilePath ${backing_file}", | ||
"set MetadataProvider/#attribute/reloadInterval ${provider_reload_interval}", | ||
'set MetadataProvider/MetadataFilter[1]/#attribute/type RequireValidUntil', | ||
"set MetadataProvider/MetadataFilter[1]/#attribute/maxValidityInterval ${metadata_filter_max_validity_interval}", | ||
'set MetadataProvider/MetadataFilter[2]/#attribute/type Signature', | ||
"set MetadataProvider/MetadataFilter[2]/#attribute/certificate ${cert_file}", | ||
], | ||
notify => Service['httpd','shibd'], | ||
require => [Exec["get_${name}_metadata_cert"],Augeas["shib_${name}_create_metadata_provider"]], | ||
} | ||
|
||
} |
Oops, something went wrong.