forked from SUNET/soc-ops
Updating sso class to enable custom 401 for apache env as well
This commit is contained in:
parent
f8c1cc16f5
commit
9642eb3d23
3 changed files with 42 additions and 19 deletions
|
@ -0,0 +1,8 @@
|
||||||
|
Alias /.ssoerror /opt/sso/apache
|
||||||
|
<Directory /opt/sso/apache>
|
||||||
|
Satisfy any
|
||||||
|
Allow from all
|
||||||
|
AuthType None
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
ErrorDocument 401 /.ssoerror/401.html
|
|
@ -29,7 +29,6 @@
|
||||||
# @param entityID
|
# @param entityID
|
||||||
# EntityID of the satosa proxy, must not be the same as the proxy hostname.
|
# EntityID of the satosa proxy, must not be the same as the proxy hostname.
|
||||||
# Default set to value of proxy.
|
# Default set to value of proxy.
|
||||||
|
|
||||||
class soc::sso(
|
class soc::sso(
|
||||||
String $ssotype = 'docker',
|
String $ssotype = 'docker',
|
||||||
String $hostname = $facts['networking']['fqdn'],
|
String $hostname = $facts['networking']['fqdn'],
|
||||||
|
@ -50,19 +49,22 @@ class soc::sso(
|
||||||
Optional[String] $extra_proxy_conf = undef,
|
Optional[String] $extra_proxy_conf = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
file { '/opt/sso':
|
||||||
|
ensure => directory,
|
||||||
|
}
|
||||||
|
file { '/opt/sso/apache':
|
||||||
|
ensure => directory,
|
||||||
|
}
|
||||||
|
file { '/opt/sso/apache/ssoerror':
|
||||||
|
ensure => directory,
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/opt/sso/apache/ssoerror/401.html':
|
||||||
|
ensure => file,
|
||||||
|
content => file('soc/sso/401.html'),
|
||||||
|
}
|
||||||
|
|
||||||
if $ssotype == 'docker' {
|
if $ssotype == 'docker' {
|
||||||
file { '/opt/sso':
|
|
||||||
ensure => directory,
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Apache files
|
|
||||||
#
|
|
||||||
|
|
||||||
file { '/opt/sso/apache':
|
|
||||||
ensure => directory,
|
|
||||||
}
|
|
||||||
|
|
||||||
file { '/opt/sso/apache/site.conf':
|
file { '/opt/sso/apache/site.conf':
|
||||||
ensure => file,
|
ensure => file,
|
||||||
content => template('soc/sso/apache-site.conf.erb'),
|
content => template('soc/sso/apache-site.conf.erb'),
|
||||||
|
@ -76,6 +78,9 @@ class soc::sso(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $ssotype == 'apache' {
|
||||||
|
}
|
||||||
|
|
||||||
file { '/opt/sso/apache/401.html':
|
file { '/opt/sso/apache/401.html':
|
||||||
ensure => file,
|
ensure => file,
|
||||||
content => file('soc/sso/401.html'),
|
content => file('soc/sso/401.html'),
|
||||||
|
@ -99,22 +104,32 @@ class soc::sso(
|
||||||
#
|
#
|
||||||
|
|
||||||
if $ssotype == 'apache' {
|
if $ssotype == 'apache' {
|
||||||
|
$shibbase = '/etc/shibboleth'
|
||||||
|
service { 'apache2':
|
||||||
|
ensure => 'running',
|
||||||
|
enable => true,
|
||||||
|
require => Package['apache2'],
|
||||||
|
}
|
||||||
package { ['libapache2-mod-shib', 'shibboleth-sp-utils']:
|
package { ['libapache2-mod-shib', 'shibboleth-sp-utils']:
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { 'Make sure mod_shib is loaded':
|
exec { 'Make sure mod_shib is loaded':
|
||||||
command => 'a2enmod shib',
|
command => 'a2enmod shib',
|
||||||
creates => '/etc/apache2/mods-enabled/shib.load',
|
creates => '/etc/apache2/mods-enabled/shib.load',
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { 'Make sure authz_groupfile is loaded':
|
exec { 'Make sure authz_groupfile is loaded':
|
||||||
command => 'a2enmod authz_groupfile',
|
command => 'a2enmod authz_groupfile',
|
||||||
creates => '/etc/apache2/mods-enabled/authz_groupfile.load',
|
creates => '/etc/apache2/mods-enabled/authz_groupfile.load',
|
||||||
}
|
}
|
||||||
|
file { '/etc/apache2/conf-available/apache-errors.conf':
|
||||||
$shibbase = '/etc/shibboleth'
|
ensure => file,
|
||||||
|
content => file('soc/sso/apache-errors.conf'),
|
||||||
|
}
|
||||||
|
exec { 'Enable custom 401 error document':
|
||||||
|
command => 'a2enconf apache-errors',
|
||||||
|
creates => '/etc/apache2/conf-enabled/apache-errors.conf',
|
||||||
|
notify => Service['apache2'],
|
||||||
|
}
|
||||||
} elsif $ssotype == 'docker' {
|
} elsif $ssotype == 'docker' {
|
||||||
$shibbase = '/opt/sso/shibboleth'
|
$shibbase = '/opt/sso/shibboleth'
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ services:
|
||||||
<% end -%>
|
<% end -%>
|
||||||
- ./shibboleth/sp-cert.pem:/etc/shibboleth/sp-cert.pem
|
- ./shibboleth/sp-cert.pem:/etc/shibboleth/sp-cert.pem
|
||||||
- ./shibboleth/sp-key.pem:/etc/shibboleth/sp-key.pem
|
- ./shibboleth/sp-key.pem:/etc/shibboleth/sp-key.pem
|
||||||
- ./apache/401.html:/var/www/ssoerror/401.html:ro
|
- ./apache/ssoerror/401.html:/var/www/ssoerror/401.html:ro
|
||||||
<% if @extra_proxy_conf -%>
|
<% if @extra_proxy_conf -%>
|
||||||
- <%= @extra_proxy_conf %>:<%= @extra_proxy_conf %>
|
- <%= @extra_proxy_conf %>:<%= @extra_proxy_conf %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
Loading…
Add table
Reference in a new issue