Puppet Class: apereo_cas

Defined in:
modules/apereo_cas/manifests/init.pp

Overview

Parameters:

  • idp_primary (Stdlib::Fqdn)
  • idp_failover (Optional[Stdlib::Fqdn]) (defaults to: undef)
  • tgc_signing_key (Optional[String[1]]) (defaults to: undef)
  • tgc_encryption_key (Optional[String[1]]) (defaults to: undef)
  • webflow_signing_key (Optional[String[1]]) (defaults to: undef)
  • webflow_encryption_key (Optional[String[1]]) (defaults to: undef)
  • enable_u2f (Boolean) (defaults to: true)
  • u2f_signing_key (Optional[String[1]]) (defaults to: undef)
  • u2f_encryption_key (Optional[String[1]]) (defaults to: undef)
  • enable_totp (Boolean) (defaults to: false)
  • totp_signing_key (Optional[String[1]]) (defaults to: undef)
  • totp_encryption_key (Optional[String[1]]) (defaults to: undef)
  • keystore_source (Optional[Stdlib::Filesource]) (defaults to: undef)
  • keystore_content (Optional[String[1]]) (defaults to: undef)
  • max_session_length (Integer[60,604800]) (defaults to: 604800)
  • max_rememberme_session_length (Integer[60,604800]) (defaults to: $max_session_length)
  • session_inactivity_timeout (Integer[60,86400]) (defaults to: 3600)
  • groovy_source (Optional[Stdlib::Filesource]) (defaults to: undef)
  • prometheus_nodes (Optional[Array[Stdlib::Host]]) (defaults to: [])
  • actuators (Optional[Array[String]]) (defaults to: [])
  • devices_dir (Stdlib::Unixpath) (defaults to: '/srv/cas/devices')
  • base_dir (Stdlib::Unixpath) (defaults to: '/etc/cas')
  • log_dir (Stdlib::Unixpath) (defaults to: '/var/log/cas')
  • tomcat_basedir (Stdlib::Unixpath) (defaults to: "${log_dir}/tomcat")
  • u2f_devices_path (Stdlib::Unixpath) (defaults to: "${devices_dir}/u2fdevices.json")
  • totp_devices_path (Stdlib::Unixpath) (defaults to: "${devices_dir}/totpdevices.json")
  • keystore_path (Stdlib::Unixpath) (defaults to: "${base_dir}/thekeystore")
  • keystore_password (String[1]) (defaults to: 'changeit')
  • key_password (String[1]) (defaults to: 'changeit')
  • server_name (Stdlib::HTTPSUrl) (defaults to: "https://${facts['fqdn']}:8443")
  • server_port (Stdlib::Port) (defaults to: 8443)
  • server_prefix (Stdlib::Unixpath) (defaults to: '/cas')
  • server_enable_ssl (Boolean) (defaults to: true)
  • tomcat_proxy (Boolean) (defaults to: false)
  • ldap_attribute_list (Array[String[1]]) (defaults to: ['cn', 'memberOf', 'mail'])
  • ldap_uris (Array[Apereo_cas::LDAPUri]) (defaults to: [])
  • ldap_auth (Apereo_cas::Ldapauth) (defaults to: 'AUTHENTICATED')
  • ldap_connection (Apereo_cas::Ldapconnection) (defaults to: 'ACTIVE_PASSIVE')
  • ldap_start_tls (Boolean) (defaults to: true)
  • ldap_base_dn (String) (defaults to: 'dc=example,dc=org')
  • ldap_search_filter (String) (defaults to: 'cn={user}')
  • ldap_bind_dn (String) (defaults to: 'cn=user,dc=example,dc=org')
  • ldap_bind_pass (String) (defaults to: 'changeme')
  • log_level (Apereo_cas::LogLevel) (defaults to: 'WARN')
  • mfa_attribute_trigger (String) (defaults to: 'memberOf')
  • mfa_attribut_value (Array[String[1]]) (defaults to: ['mfa'])
  • daemon_user (String) (defaults to: 'cas')
  • services (Hash[String, Hash]) (defaults to: {})
  • manage_user (Boolean) (defaults to: true)
  • java_opts (Optional[String[1]]) (defaults to: undef)
  • memcached_enable (Boolean) (defaults to: false)
  • memcached_port (Stdlib::Port) (defaults to: 11211)
  • memcached_server (Stdlib::Host) (defaults to: 'localhost')
  • memcached_transcoder (Apereo_cas::Memcached::Transcoder) (defaults to: 'KRYO')


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'modules/apereo_cas/manifests/init.pp', line 2

class apereo_cas (
    Stdlib::Fqdn                      $idp_primary,
    Optional[Stdlib::Fqdn]            $idp_failover                  = undef,
    Optional[String[1]]               $tgc_signing_key               = undef,
    Optional[String[1]]               $tgc_encryption_key            = undef,
    Optional[String[1]]               $webflow_signing_key           = undef,
    Optional[String[1]]               $webflow_encryption_key        = undef,
    Boolean                           $enable_u2f                    = true,
    Optional[String[1]]               $u2f_signing_key               = undef,
    Optional[String[1]]               $u2f_encryption_key            = undef,
    Boolean                           $enable_totp                   = false,
    Optional[String[1]]               $totp_signing_key              = undef,
    Optional[String[1]]               $totp_encryption_key           = undef,
    Optional[Stdlib::Filesource]      $keystore_source               = undef,
    Optional[String[1]]               $keystore_content              = undef,
    Integer[60,604800]                $max_session_length            = 604800,
    Integer[60,604800]                $max_rememberme_session_length = $max_session_length,
    Integer[60,86400]                 $session_inactivity_timeout    = 3600,
    Optional[Stdlib::Filesource]      $groovy_source                 = undef,
    Optional[Array[Stdlib::Host]]     $prometheus_nodes              = [],
    Optional[Array[String]]           $actuators                     = [],
    Stdlib::Unixpath                  $devices_dir                   = '/srv/cas/devices',
    Stdlib::Unixpath                  $base_dir                      = '/etc/cas',
    Stdlib::Unixpath                  $log_dir                       = '/var/log/cas',
    Stdlib::Unixpath                  $tomcat_basedir                = "${log_dir}/tomcat",
    Stdlib::Unixpath                  $u2f_devices_path              = "${devices_dir}/u2fdevices.json",
    Stdlib::Unixpath                  $totp_devices_path             = "${devices_dir}/totpdevices.json",
    Stdlib::Unixpath                  $keystore_path                 = "${base_dir}/thekeystore",
    String[1]                         $keystore_password             = 'changeit',
    String[1]                         $key_password                  = 'changeit',
    Stdlib::HTTPSUrl                  $server_name                   = "https://${facts['fqdn']}:8443",
    Stdlib::Port                      $server_port                   = 8443,
    Stdlib::Unixpath                  $server_prefix                 = '/cas',
    Boolean                           $server_enable_ssl             = true,
    Boolean                           $tomcat_proxy                  = false,
    Array[String[1]]                  $ldap_attribute_list           = ['cn', 'memberOf', 'mail'],
    Array[Apereo_cas::LDAPUri]        $ldap_uris                     = [],
    Apereo_cas::Ldapauth              $ldap_auth                     = 'AUTHENTICATED',
    Apereo_cas::Ldapconnection        $ldap_connection               = 'ACTIVE_PASSIVE',
    Boolean                           $ldap_start_tls                = true,
    String                            $ldap_base_dn                  = 'dc=example,dc=org',
    String                            $ldap_search_filter            = 'cn={user}',
    String                            $ldap_bind_dn                  = 'cn=user,dc=example,dc=org',
    String                            $ldap_bind_pass                = 'changeme',
    Apereo_cas::LogLevel              $log_level                     = 'WARN',
    String                            $mfa_attribute_trigger         = 'memberOf',
    Array[String[1]]                  $mfa_attribut_value            = ['mfa'],
    String                            $daemon_user                   = 'cas',
    Hash[String, Hash]                $services                      = {},
    Boolean                           $manage_user                   = true,
    Optional[String[1]]               $java_opts                     = undef,
    Boolean                           $memcached_enable              = false,
    Stdlib::Port                      $memcached_port                = 11211,
    Stdlib::Host                      $memcached_server              = 'localhost',
    Apereo_cas::Memcached::Transcoder $memcached_transcoder          = 'KRYO',
) {
    if $keystore_source == undef and $keystore_content == undef and $server_enable_ssl {
        error('you must provide either $keystore_source or $keystore_content')
    }
    if $keystore_source and $keystore_content {
        error('you cannot provide $keystore_source and $keystore_content')
    }
    $config_dir = "${base_dir}/config"
    $services_dir = "${base_dir}/services"

    $is_idp_primary = $facts['fqdn'] == $idp_primary

    systemd::unit{'tomcat9':
        override => true,
        restart  => true,
        content  => "[Service]\nReadWritePaths=${devices_dir}\nReadWritePaths=${log_dir}\n",
    }

    if $is_idp_primary {
        $ensure_rsync = 'present'
        $ensure_sync_timer = 'absent'
    } else {
        $ensure_rsync = 'absent'
        $ensure_sync_timer = 'present'
        base::service_auto_restart { 'cas': }
    }

    $idp_nodes = [$idp_primary, $idp_failover].delete_undef_values
    if $manage_user {
        user{$daemon_user:
            ensure   => 'present',
            comment  => 'apereo cas user',
            home     => $tomcat_basedir,
            shell    => '/usr/sbin/nologin',
            password => '!',
            system   => true,
        }
    }
    systemd::timer::job { 'idp-u2f-sync':
        ensure             => $ensure_sync_timer,
        description        => 'Mirror U2F device data from failover host to active IDP server',
        command            => "/usr/bin/rsync --delete --delete-after -aSOrd rsync://${idp_primary}/u2f_devices/* ${devices_dir}",
        interval           => {
            'start'    => 'OnCalendar',
            'interval' => '*-*-* *:00:00', # Each hour
        },
        logging_enabled    => false,
        monitoring_enabled => true,
        user               => $daemon_user,
    }

    if $idp_primary and $idp_failover {
        rsync::server::module { 'u2f_devices':
            ensure         => $ensure_rsync,
            path           => $devices_dir,
            read_only      => 'yes',
            hosts_allow    => [$idp_failover],
            auto_ferm      => true,
            auto_ferm_ipv6 => true,
        }
    }

    $groovy_file = '/etc/cas/global_principal_attribute_predicate.groovy'
    if $groovy_source {
        file{$groovy_file:
            source => $groovy_source,
        }
    }
    file{[$services_dir, $config_dir]:
        ensure => directory,
    }
    file{[$devices_dir, $base_dir, $log_dir]:
        ensure  => directory,
        owner   => $daemon_user,
        mode    => '0600',
        recurse => true,
    }
    file {"${config_dir}/cas.properties":
        ensure  => file,
        owner   => $daemon_user,
        group   => 'root',
        mode    => '0400',
        content => template('apereo_cas/cas.properties.erb'),
    }
    file {"${config_dir}/log4j2.xml":
        ensure  => file,
        owner   => $daemon_user,
        group   => 'root',
        mode    => '0400',
        content => template('apereo_cas/log4j2.xml.erb'),
    }
    $keystore_ensure = $server_enable_ssl ? {
        true    => file,
        default => absent,
    }
    file {$keystore_path:
        ensure  => $keystore_ensure,
        owner   => $daemon_user,
        group   => 'root',
        mode    => '0400',
        content => $keystore_content,
        source  => $keystore_source,
    }

    ensure_packages(['cas'])

    File["${config_dir}/log4j2.xml", $keystore_path, "${config_dir}/cas.properties"] {
        notify => Service['tomcat9'],
    }

    $services.each |String $service, Hash $config| {
        apereo_cas::service {$service:
            notify => Service['tomcat9'],
            *      => $config
        }
    }
}