configmap-shibboleth.yaml 18 KB
Newer Older
Sandro Mathys's avatar
Sandro Mathys committed
1
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
{{- if not .Values.backend.shibboleth.configMap -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "shibboleth-sp.backend.fullname" . }}-config
  labels:
    {{- include "shibboleth-sp.backend.labels" . | nindent 4 }}
data:
  shibboleth2.xml: |
    <SPConfig xmlns="urn:mace:shibboleth:3.0:native:sp:config"
        xmlns:conf="urn:mace:shibboleth:3.0:native:sp:config"
        xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
        clockSkew="180">

{{ if .Values.backend.shibboleth.memcached.enabled }}
        <OutOfProcess tranLogFormat="%u|%s|%IDP|%i|%ac|%t|%attr|%n|%b|%E|%S|%SS|%L|%UA|%a">
          <Extensions>
            <Library path="memcache-store.so" fatal="true"/>
          </Extensions>
        </OutOfProcess>

        <StorageService type="MEMCACHE" id="mc" prefix="{{ .Values.backend.shibboleth.memcached.prefix }}">
          <Hosts>
            {{ .Values.backend.shibboleth.memcached.hosts }}
          </Hosts>
        </StorageService>

        <StorageService type="MEMCACHE" id="mc-ctx" prefix="{{ .Values.backend.shibboleth.memcached.prefix }}" buildMap="1">
          <Hosts>
            {{ .Values.backend.shibboleth.memcached.hosts }}
          </Hosts>
        </StorageService>

        <SessionCache type="StorageService" StorageService="mc-ctx" StorageServiceLite="mc" />
        <ReplayCache StorageService="mc" />
        <ArtifactMap StorageService="mc" />
{{- else }}
        <OutOfProcess tranLogFormat="%u|%s|%IDP|%i|%ac|%t|%attr|%n|%b|%E|%S|%SS|%L|%UA|%a" />
{{ if .Values.backend.shibboleth.sessionCache.enabled }}
        <DataSealer type="Versioned" path="sealer.keys" />
        <SessionCache type="StorageService" persistedAttributes="{{ .Values.backend.shibboleth.sessionCache.persistedAttributes }}" />
{{- end }}
{{- end }}

        <!-- The ApplicationDefaults element is where most of Shibboleth's SAML bits are defined. -->
        <ApplicationDefaults entityID="{{ tpl .Values.backend.shibboleth.applicationDefaults.entityID . }}"
48
                            homeURL="{{ .Values.backend.shibboleth.applicationDefaults.homeURL | default "/Shibboleth.sso/Session" }}"
Sandro Mathys's avatar
Sandro Mathys committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{{- if .Values.backend.shibboleth.publicAttributes }}
                            metadataAttributePrefix="Meta-"
{{- end }}
                            REMOTE_USER="{{ .Values.backend.shibboleth.applicationDefaults.remoteUser | default "persistent-id uniqueID" }}"
                            cipherSuites="DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1">

            <!--
            Controls session lifetimes, address checks, cookie handling, and the protocol handlers.
            Each Application has an effectively unique handlerURL, which defaults to "/Shibboleth.sso"
            and should be a relative path, with the SP computing the full value based on the virtual
            host. Using handlerSSL="true" will force the protocol to be https. You should also set
            cookieProps to "https" for SSL-only sites. Note that while we default checkAddress to
            "false", this makes an assertion stolen in transit easier for attackers to misuse.
            -->
            <Sessions lifetime="28800"
                      timeout="3600"
{{- if .Values.backend.shibboleth.memcached.enabled }}
                      relayState="ss:mc"
{{- else }}
                      relayState="ss:mem"
{{- end }}
70
71
                      checkAddress="{{ .Values.backend.shibboleth.applicationDefaults.sessions.checkAddress | default "true" }}"
                      consistentAddress="{{ .Values.backend.shibboleth.applicationDefaults.sessions.consistentAddress | default "true" }}"
Sandro Mathys's avatar
Sandro Mathys committed
72
73
                      handlerSSL="{{ .Values.backend.shibboleth.applicationDefaults.sessions.handlerSSL | default "true" }}"
                      redirectLimit="{{ .Values.backend.shibboleth.applicationDefaults.sessions.redirectLimit | default "host" }}"
74
                      cookieProps="{{ tpl .Values.backend.shibboleth.applicationDefaults.sessions.cookieProps . | default "https" }}"
Sandro Mathys's avatar
Sandro Mathys committed
75
{{- if .Values.backend.shibboleth.applicationDefaults.sessions.sameSiteSession }}
76
77
78
                      sameSiteSession="{{ .Values.backend.shibboleth.applicationDefaults.sessions.sameSiteSession }}"
{{- end }}
                      >
Sandro Mathys's avatar
Sandro Mathys committed
79
80
81

{{ if .Values.backend.shibboleth.eduIDOnly }}
                <!-- Send user directly to edu-ID Identity Provider -->
Sandro Mathys's avatar
Sandro Mathys committed
82
83
84
{{- if eq .Values.backend.shibboleth.eduIDVersion "test" }}
                <SSO entityID="https://test.eduid.ch/idp/shibboleth">
{{- else }}
Sandro Mathys's avatar
Sandro Mathys committed
85
                <SSO entityID="https://eduid.ch/idp/shibboleth">
Sandro Mathys's avatar
Sandro Mathys committed
86
{{- end }}
Sandro Mathys's avatar
Sandro Mathys committed
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
                  SAML2
                </SSO>
{{- else }}
                <!--
                Configures SSO for a default IdP. To properly allow for >1 IdP, remove
                entityID property and adjust discoveryURL to point to discovery service.
                You can also override entityID on /Login query string, or in RequestMap/htaccess.
                -->
                <SSO discoveryProtocol="SAMLDS"
                    discoveryURL="https://wayf.switch.ch/SWITCHaai/WAYF">
                  SAML2
                </SSO>
{{- end }}

                <!-- SAML and local-only logout. -->
                <Logout>SAML2 Local</Logout>

                <!-- Administrative logout. -->
                <LogoutInitiator type="Admin"
                                Location="/Logout/Admin"
                                acl="127.0.0.1 ::1" />

                <!-- Extension service that generates "approximate" metadata based on SP configuration. -->
                <Handler type="MetadataGenerator"
                        Location="/Metadata"
                        signing="false"/>

                <!-- Status reporting service.
                    The first IPv4/IPv6 address pair allows access from local host.
                    The remaining addresses are used by the AAI Resource Registry operated by SWITCH -->
                <Handler type="Status"
                        Location="/Status"
                        acl="127.0.0.1/32 ::1/128 130.59.118.224/32 2001:620:0:1006::255/128 130.59.198.12/32 2001:620:0:3006::256/128"/>

                <!-- Session diagnostic service. -->
                <Handler type="Session"
                        Location="/Session"
                        showAttributeValues="false"/>

                <!-- JSON feed of discovery information. -->
                <Handler type="DiscoveryFeed"
                        Location="/DiscoFeed"/>
            </Sessions>

            <!--
            Allows overriding of error template information/filenames. You can
            also add your own attributes with values that can be plugged into the
            templates, e.g., helpLocation below.
            -->
            <Errors access="accessError.html"
                    supportContact="{{ .Values.backend.shibboleth.applicationDefaults.errors.supportContact }}"
                    helpLocation="https://www.switch.ch/aai/help"
                    logoLocation="https://www.switch.ch/aai/design/images/SWITCHaai.gif"
                    styleSheet="https://www.switch.ch/aai/design/shib-error.css"/>

            <!-- Download and verify SWITCHaai metadata -->
            <MetadataProvider type="XML"
                              validate="true"
{{- if .Values.backend.shibboleth.eduIDOnly }}
Sandro Mathys's avatar
Sandro Mathys committed
146
147
148
{{- if eq .Values.backend.shibboleth.eduIDVersion "test" }}
                              url="http://metadata.aai.switch.ch/entities/eduid-test"
{{- else }}
Sandro Mathys's avatar
Sandro Mathys committed
149
                              url="http://metadata.aai.switch.ch/entities/eduid"
Sandro Mathys's avatar
Sandro Mathys committed
150
{{- end }}
Sandro Mathys's avatar
Sandro Mathys committed
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
                              backingFilePath="metadata.eduid.ch.xml"
{{- else }}
                              url="http://metadata.aai.switch.ch/metadata.switchaai+idp.xml"
                              backingFilePath="metadata.switchaai+idp.xml"
{{- end }}
                              reloadInterval="3600">
                <MetadataFilter type="RequireValidUntil"
                                maxValidityInterval="604800"/>
                <MetadataFilter type="Signature" verifyBackup="false">
                    <TrustEngine type="StaticPKIX"
                                certificate="SWITCHaaiRootCA.crt.pem"
                                verifyDepth="2"
                                checkRevocation="fullChain"
                                policyMappingInhibit="true"
                                anyPolicyInhibit="true">
                          <TrustedName>SWITCHaai Metadata Signer</TrustedName>
                          <PolicyOID>2.16.756.1.2.6.7</PolicyOID>
                  </TrustEngine>
                </MetadataFilter>
{{- if eq .Values.backend.shibboleth.version "3.1" }}
                <MetadataFilter type="EntityRoleWhiteList">
{{- else }}
                <MetadataFilter type="EntityRole">
{{- end }}
                    <RetainedRole>md:IDPSSODescriptor</RetainedRole>
                    <RetainedRole>md:AttributeAuthorityDescriptor</RetainedRole>
                </MetadataFilter>
            </MetadataProvider>

{{ if .Values.backend.shibboleth.interfederation }}
            <!-- Download and verify Interfederation metadata -->
            <MetadataProvider type="XML"
                              validate="true"
                              url="http://metadata.aai.switch.ch/entities/interfederation+idp"
                              backingFilePath="metadata.interfederation-idps.xml"
                              reloadInterval="3600">
                <MetadataFilter type="RequireValidUntil"
                                maxValidityInterval="604800"/>
                <MetadataFilter type="Signature">
                    <TrustEngine type="StaticPKIX"
                                certificate="SWITCHaaiRootCA.crt.pem"
                                verifyDepth="2"
                                checkRevocation="fullChain"
                                policyMappingInhibit="true"
                                anyPolicyInhibit="true">
                          <TrustedName>SWITCHaai Interfederation Metadata Signer</TrustedName>
                          <PolicyOID>2.16.756.1.2.6.8</PolicyOID>
                  </TrustEngine>
                </MetadataFilter>
                <MetadataFilter type="EntityRole">
                    <RetainedRole>md:IDPSSODescriptor</RetainedRole>
                    <RetainedRole>md:AttributeAuthorityDescriptor</RetainedRole>
                </MetadataFilter>
            </MetadataProvider>
{{- end }}

            <!-- Map to extract attributes from SAML assertions. -->
            <AttributeExtractor type="XML"
                                validate="true"
                                reloadChanges="false"
                                path="attribute-map.xml"/>

{{- if .Values.backend.shibboleth.publicAttributes }}
            <!-- Extract further attributes about Identity Providers from metadata -->
            <AttributeExtractor  type="Metadata"
                                errorURL="errorURL"
                                DisplayName="displayName"
                                InformationURL="informationURL"
                                PrivacyStatementURL="privacyStatementURL"
                                OrganizationURL="organizationURL">
                <ContactPerson
                        id="technicalContactDisplayName"
                        contactType="technical"
                        formatter="$GivenName $SurName" />
                <ContactPerson
                        id="technicalContactMailtoURI"
                        contactType="technical"
                        formatter="$EmailAddress" />
                <ContactPerson
                        id="supportContactDisplayName"
                        contactType="support"
                        formatter="$GivenName $SurName" />
                <ContactPerson
                        id="supportContactMailtoURI"
                        contactType="support"
                        formatter="$EmailAddress" />
                <ContactPerson
                        id="administrativeContactDisplayName"
                        contactType="administrative"
                        formatter="$GivenName $SurName" />
                <ContactPerson
                        id="administrativeContactMailtoURI"
                        contactType="administrative"
                        formatter="$EmailAddress" />
                <Logo
                      id="smallLogo"
                      height="16"
                      width="16"
                      formatter="&lt;img src='$_string' height='$height' width='$width'/&gt;"/>
                <Logo
                        id="largeLogo"
                        height="60"
                        width="80"
                        formatter="&lt;img src='$_string' height='$height' width='$width'/&gt;"/>
            </AttributeExtractor>
{{- end }}

            <!-- Use a SAML query if no attributes are supplied during SSO. -->
            <AttributeResolver type="Query"
                              subjectMatch="true"/>

            <!-- Default filtering policy for recognized attributes, lets other data pass -->
            <AttributeFilter type="XML"
                            validate="true"
                            reloadChanges="false"
                            path="attribute-policy.xml"/>

            <!--
            Certificate/Private key pairs are read in sequence.
            Unless specificially defined only the first
            CredentialResolver is used for attribute requests.
            -->
            <CredentialResolver type="Chaining">
                <!-- Active certificate -->
                <CredentialResolver type="File"
                                    key="/etc/shibboleth/sp-key-active.pem"
                                    certificate="/etc/shibboleth/sp-cert-active.pem"/>
{{- if .Values.backend.shibboleth.applicationDefaults.credentialResolver.additionalSecretName }}
                <!-- Additional certificate -->
                <CredentialResolver type="File"
                                    key="/etc/shibboleth/sp-key-additional.pem"
                                    certificate="/etc/shibboleth/sp-cert-additional.pem"/>
{{- end }}
            </CredentialResolver>

            <!--
            The default settings can be overridden by creating ApplicationOverride elements.
            -->
        </ApplicationDefaults>

        <!-- Policies that determine how to process and authenticate runtime messages. -->
        <SecurityPolicyProvider type="XML"
                                validate="true"
                                reloadChanges="false"
                                path="security-policy.xml"/>

        <!-- Low-level configuration about protocols and bindings available for use. -->
        <ProtocolProvider type="XML"
                          validate="true"
                          reloadChanges="false"
                          path="protocols.xml"/>

    </SPConfig>
  shibd.logger: |
    # set overall behavior
    log4j.rootCategory={{ .Values.backend.shibboleth.rootLogLevel }}, shibd_log, console

    # fairly verbose for DEBUG, so generally leave at INFO
    log4j.category.XMLTooling.XMLObject=INFO
    log4j.category.XMLTooling.XMLObjectBuilder=INFO
    log4j.category.XMLTooling.KeyInfoResolver=INFO
    log4j.category.Shibboleth.IPRange=INFO
    log4j.category.Shibboleth.PropertySet=INFO

    # raise for low-level tracing of SOAP client HTTP/SSL behavior
    log4j.category.XMLTooling.libcurl=INFO

    # useful categories to tune independently:
    #
    # tracing of SAML messages and security policies
    #log4j.category.OpenSAML.MessageDecoder=DEBUG
    #log4j.category.OpenSAML.MessageEncoder=DEBUG
    #log4j.category.OpenSAML.SecurityPolicyRule=DEBUG
    #log4j.category.XMLTooling.SOAPClient=DEBUG
    # interprocess message remoting
    # log4j.category.Shibboleth.Listener=DEBUG
    # mapping of requests to applicationId
    #log4j.category.Shibboleth.RequestMapper=DEBUG
    # high level session cache operations
    #log4j.category.Shibboleth.SessionCache=DEBUG
    # persistent storage and caching
    #log4j.category.XMLTooling.StorageService=DEBUG

    # logs XML being signed or verified if set to DEBUG
    log4j.category.XMLTooling.Signature.Debugger=INFO, sig_log
    log4j.additivity.XMLTooling.Signature.Debugger=false
    log4j.ownAppenders.XMLTooling.Signature.Debugger=true

    # the tran log blocks the "default" appender(s) at runtime
    # Level should be left at INFO for this category
    log4j.category.Shibboleth-TRANSACTION=INFO, tran_log
    log4j.additivity.Shibboleth-TRANSACTION=false
    log4j.ownAppenders.Shibboleth-TRANSACTION=true

    # uncomment to suppress particular event types
    #log4j.category.Shibboleth-TRANSACTION.AuthnRequest=WARN
    #log4j.category.Shibboleth-TRANSACTION.Login=WARN
    #log4j.category.Shibboleth-TRANSACTION.Logout=WARN

    # define the appenders

    log4j.appender.console=org.apache.log4j.ConsoleAppender
    log4j.appender.console.layout=org.apache.log4j.PatternLayout
    log4j.appender.console.layout.ConversionPattern={{ .Values.backend.shibboleth.consoleLogFormat }} 

    # log4j.appender.shibd_log=org.apache.log4j.RollingFileAppender
    # log4j.appender.shibd_log.fileName=/dev/shm/shibd.log    
    # log4j.appender.shibd_log.maxFileSize=1000000
    # log4j.appender.shibd_log.maxBackupIndex=10
    # log4j.appender.shibd_log.layout=org.apache.log4j.PatternLayout
    # log4j.appender.shibd_log.layout.ConversionPattern=%d{%Y-%m-%d %H:%M:%S} %p %c %x: %m%n

    # log4j.appender.tran_log=org.apache.log4j.RollingFileAppender
    # log4j.appender.tran_log.fileName=/dev/shm/transaction.log
    # log4j.appender.tran_log.maxFileSize=1000000
    # log4j.appender.tran_log.maxBackupIndex=20
    # log4j.appender.tran_log.layout=org.apache.log4j.PatternLayout
    # log4j.appender.tran_log.layout.ConversionPattern=%d{%Y-%m-%d %H:%M:%S}|%c|%m%n

    # log4j.appender.sig_log=org.apache.log4j.FileAppender
    # log4j.appender.sig_log.fileName=/dev/shm/signature.log
    # log4j.appender.sig_log.layout=org.apache.log4j.PatternLayout
    # log4j.appender.sig_log.layout.ConversionPattern=%m
{{- end -}}