@@ -5,30 +5,33 @@ This document describes how to install and configure the SATOSA proxy.
5
5
# Installation
6
6
7
7
## <a name =" docker " style =" color :#000000 " >Docker</a >
8
+
8
9
A pre-built Docker image is accessible at the [ Docker Hub] ( https://hub.docker.com/r/satosa/ ) , and is the
9
10
recommended ways of running the proxy.
10
11
11
12
## <a name =" manual_installation " style =" color :#000000 " >Manual installation</a >
12
13
13
14
### <a name =" dependencies " style =" color :#000000 " >Dependencies</a >
15
+
14
16
SATOSA requires Python 3.4 (or above), and the following packages on Ubuntu:
15
- ```
17
+
18
+ ``` bash
16
19
apt-get install libffi-dev libssl-dev xmlsec1
17
20
````
18
21
19
22
# ## <a name="install_instructions" style="color:#000000">Instructions</a>
23
+
20
24
1. Download the SATOSA proxy project as a [compressed archive](https://github.com/IdentityPython/SATOSA/releases)
21
25
and unpack it to ` < satosa_path> ` .
22
26
23
- 1 . Install the application:
27
+ 2 . Install the application:
24
28
25
29
` ` ` bash
26
30
pip install < satosa_path>
27
31
` ` `
28
32
29
33
Alternatively the application can be installed directly from PyPI (` pip install satosa` ), or the [Docker image](https://hub.docker.com/r/satosa/) can be used.
30
34
31
-
32
35
# ## <a name="install_external" style="color:#000000">External micro-services</a>
33
36
34
37
Micro-services act like plugins and can be developed by anyone. Other people
@@ -53,8 +56,8 @@ The extentions include:
53
56
54
57
and more.
55
58
56
-
57
59
# Configuration
60
+
58
61
SATOSA is configured using YAML.
59
62
60
63
All default configuration files, as well as an example WSGI application for the proxy, can be found
@@ -74,7 +77,7 @@ the value from the process environment variable of the same name. If the
74
77
process environment has been set with ` LDAP_BIND_PASSWORD=secret_password` then
75
78
the configuration value for ` bind_password` will be ` secret_password` .
76
79
77
- ```
80
+ ` ` ` yaml
78
81
bind_password: ! ENV LDAP_BIND_PASSWORD
79
82
` ` `
80
83
@@ -90,12 +93,12 @@ process environment has been set with
90
93
` LDAP_BIND_PASSWORD_FILE=/etc/satosa/secrets/ldap.txt` then the configuration
91
94
value for ` bind_password` will be ` secret_password` .
92
95
93
- ```
96
+ ` ` ` yaml
94
97
bind_password: ! ENVFILE LDAP_BIND_PASSWORD_FILE
95
98
` ` `
96
99
97
-
98
100
# # <a name="proxy_conf" style="color:#000000">SATOSA proxy configuration</a>: `proxy_conf.yaml.example`
101
+
99
102
| Parameter name | Data type | Example value | Description |
100
103
| -------------- | --------- | ------------- | ----------- |
101
104
| ` BASE` | string | ` https://proxy.example.com` | base url of the proxy |
@@ -109,10 +112,10 @@ bind_password: !ENVFILE LDAP_BIND_PASSWORD_FILE
109
112
| ` MICRO_SERVICES` | string[] | ` [statistics_service.yaml]` | list of plugin configuration file paths, describing enabled microservices |
110
113
| ` LOGGING` | dict | see [Python logging.conf](https://docs.python.org/3/library/logging.config.html) | optional configuration of application logging |
111
114
112
-
113
115
# # <a name="attr_map" style="color:#000000">Attribute mapping configuration:</a> `internal_attributes.yaml`
114
116
115
117
# ## attributes
118
+
116
119
The values directly under the ` attributes` key are the internal attribute names.
117
120
Every internal attribute has a map of profiles, which in turn has a list of
118
121
external attributes names which should be mapped to the internal attributes.
@@ -124,14 +127,15 @@ internal attribute.
124
127
Sometimes the external attributes are nested/complex structures. One example is
125
128
the [address claim in OpenID connect](http://openid.net/specs/openid-connect-core-1_0.html#AddressClaim)
126
129
which consists of multiple sub-fields, e.g.:
130
+
127
131
` ` ` json
128
132
" address" : {
129
133
" formatted" : " 100 Universal City Plaza, Hollywood CA 91608, USA" ,
130
134
" street_address" : " 100 Universal City Plaza" ,
131
135
" locality" : " Hollywood" ,
132
136
" region" : " CA" ,
133
137
" postal_code" : " 91608" ,
134
- "country" : " USA" ,
138
+ " country" : " USA"
135
139
}
136
140
` ` `
137
141
@@ -166,28 +170,29 @@ attributes (in the proxy backend) <-> internal <-> returned attributes (from the
166
170
* Any plugin using the ` saml` profile will use the attribute value from ` postaladdress`
167
171
delivered from the target provider as the value for ` address` .
168
172
169
-
170
173
# ## user_id_from_attrs
174
+
171
175
The subject identifier generated by the backend module can be overridden by
172
176
specifying a list of internal attribute names under the ` user_id_from_attrs` key.
173
177
The attribute values of the attributes specified in this list will be
174
178
concatenated and used as the subject identifier.
175
179
176
-
177
180
# ## user_id_to_attr
181
+
178
182
To store the subject identifier in a specific internal attribute, the internal
179
183
attribute name can be specified in ` user_id_to_attr` .
180
184
When the [ALService](https://github.com/its-dirg/ALservice) is used for account
181
185
linking, the ` user_id_to_attr` configuration parameter should be set, since that
182
186
service will overwrite the subject identifier generated by the proxy.
183
187
184
-
185
188
# # Plugins
189
+
186
190
The authentication protocol specific communication is handled by different plugins,
187
191
divided into frontends (receiving requests from clients) and backends (sending requests
188
192
to target providers).
189
193
190
194
# ## Common plugin configuration parameters
195
+
191
196
Both ` name` and ` module` must be specified in all plugin configurations (frontends, backends, and micro services).
192
197
The ` name` must be unique to ensure correct functionality, and the ` module` must be the fully qualified name of an
193
198
importable Python module.
@@ -230,7 +235,6 @@ For more detailed information on how you could customize the SAML entities,
230
235
see the
231
236
[documentation of the underlying library pysaml2](https://github.com/rohe/pysaml2/blob/master/docs/howto/config.rst).
232
237
233
-
234
238
# ### Providing `AuthnContextClassRef`
235
239
236
240
SAML2 frontends and backends can provide a custom (configurable) * Authentication Context Class Reference* .
@@ -252,12 +256,13 @@ provider will be preserved, and when using a OAuth or OpenID Connect backend, th
252
256
253
257
** Example**
254
258
255
- config :
256
- [...]
257
- acr_mapping :
258
- " " : default-LoA
259
- " https://accounts.google.com " : LoA1
260
-
259
+ ` ` ` yaml
260
+ config:
261
+ [...]
262
+ acr_mapping:
263
+ " " : default-LoA
264
+ " https://accounts.google.com" : LoA1
265
+ ` ` `
261
266
262
267
# ### <a name="saml_frontend" style="color:#000000">Frontend</a>
263
268
@@ -296,8 +301,8 @@ An example configuration can be found [here](../example/plugins/frontends/saml2_
296
301
297
302
`SP -> Virtual CO SAMLFrontend -> SAMLBackend -> optional discovery service -> target IdP`
298
303
299
-
300
304
##### Custom attribute release
305
+
301
306
In addition to respecting for example entity categories from the SAML metadata, the SAML frontend can also further
302
307
restrict the attribute release with the `custom_attribute_release` configuration parameter based on the SP entity id.
303
308
@@ -349,13 +354,14 @@ Overrides per SP entityID is possible by using the entityID as a key instead of
349
354
in the yaml structure. The most specific key takes presedence. If no policy overrides are provided
350
355
the defaults above are used.
351
356
352
-
353
357
#### <a name="saml_backend" style="color:#000000">Backend</a>
358
+
354
359
The SAML2 backend act as a SAML Service Provider (SP), making authentication
355
360
requests to SAML Identity Providers (IdP). The default configuration file can be
356
361
found [here](../example/plugins/backends/saml2_backend.yaml.example).
357
362
358
363
##### <a name="name_id" style="color:#000000">Name ID Format</a>
364
+
359
365
The SAML backend can indicate which *Name ID* format it wants by specifying the key
360
366
`name_id_format` in the SP entity configuration in the backend plugin configuration:
361
367
@@ -368,6 +374,7 @@ The SAML backend can indicate which *Name ID* format it wants by specifying the
368
374
```
369
375
370
376
##### Use a discovery service
377
+
371
378
To allow the user to choose which target provider they want to authenticate with, the configuration
372
379
parameter `disco_srv`, must be specified if the metadata given to the backend module contains more than one IdP:
373
380
@@ -433,6 +440,7 @@ config:
433
440
# ## <a name="openid_plugin" style="color:#000000">OpenID Connect plugins</a>
434
441
435
442
# ### <a name="openid_backend" style="color:#000000">Backend</a>
443
+
436
444
The OpenID Connect backend acts as an OpenID Connect Relying Party (RP), making
437
445
authentication requests to OpenID Connect Provider (OP). The default
438
446
configuration file can be found [here](../example/plugins/backends/openid_backend.yaml.example).
@@ -444,8 +452,8 @@ When using an OP that only supports statically registered clients, see the
444
452
and make sure to provide the redirect URI, constructed as described in the
445
453
section about Google configuration below, in the static registration.
446
454
447
-
448
455
# ### <a name="openid_frontend" style="color:#000000">Frontend</a>
456
+
449
457
The OpenID Connect frontend acts as and OpenID Connect Provider (OP), accepting requests from OpenID
450
458
Connect Relying Parties (RPs). The default configuration file can be found
451
459
[here](../example/plugins/frontends/openid_connect_frontend.yaml.example).
@@ -477,10 +485,12 @@ The configuration parameters available:
477
485
The other parameters should be left with their default values.
478
486
479
487
# ## <a name="social_plugins" style="color:#000000">Social login plugins</a>
488
+
480
489
The social login plugins can be used as backends for the proxy, allowing the
481
490
proxy to act as a client to the social login services.
482
491
483
492
# ### Google
493
+
484
494
The default configuration file can be
485
495
found [here](../example/plugins/backends/google_backend.yaml.example).
486
496
@@ -495,7 +505,7 @@ It should use the available variables, `<base_url>` and `<name>`, where:
495
505
496
506
1. ` < base_url> ` is the base url of the proxy as specified in the ` BASE` configuration parameter
497
507
in ` proxy_conf.yaml` , e.g. " https://proxy.example.com" .
498
- 1 . `<name>` is the plugin name specified in the `name` configuration parameter defined in the plugin configuration file.
508
+ 2 . ` < name> ` is the plugin name specified in the ` name` configuration parameter defined in the plugin configuration file.
499
509
500
510
The example config in ` google_backend.yaml.example` :
501
511
@@ -507,14 +517,15 @@ config:
507
517
redirect_uris: [< base_url> /< name> ]
508
518
[...]
509
519
` ` `
520
+
510
521
together with ` BASE: " https://proxy.example.com" ` in ` proxy_conf.yaml` would
511
522
yield the redirect URI ` https://proxy.example.com/google` to register with Google.
512
523
513
524
A list of all claims possibly released by Google can be found [here](https://developers.google.com/identity/protocols/OpenIDConnect#obtainuserinfo),
514
525
which should be used when configuring the attribute mapping (see above).
515
526
516
-
517
527
# ### Facebook
528
+
518
529
The default configuration file can be
519
530
found [here](../example/plugins/backends/facebook_backend.yaml.example).
520
531
@@ -549,7 +560,7 @@ pre-configured (static) attributes, see the
549
560
550
561
The static attributes are described as key-value pairs in the YAML file, e.g:
551
562
552
- ` ` `
563
+ ` ` ` yaml
553
564
organisation: Example Org.
554
565
country: Sweden
555
566
` ` `
@@ -574,15 +585,18 @@ The filters are applied such that all attribute values matched by the regular ex
574
585
non-matching attribute values will be discarded.
575
586
576
587
# #### Examples
588
+
577
589
Filter attributes from the target provider ` https://provider.example.com` , to only preserve values starting with the
578
590
string ` " foo:bar" ` :
591
+
579
592
` ` ` yaml
580
593
" https://provider.example.com" :
581
594
" " :
582
595
" " : " ^foo:bar"
583
596
` ` `
584
597
585
598
Filter the attribute ` attr1` to only preserve values ending with the string ` " foo:bar" ` :
599
+
586
600
` ` ` yaml
587
601
" " :
588
602
" " :
@@ -591,6 +605,7 @@ Filter the attribute `attr1` to only preserve values ending with the string `"fo
591
605
592
606
Filter the attribute ` attr1` to the requester ` https://provider.example.com` , to only preserver values containing
593
607
the string ` " foo:bar" ` :
608
+
594
609
` ` ` yaml
595
610
" " :
596
611
" https://client.example.com" :
@@ -601,6 +616,7 @@ the string `"foo:bar"`:
601
616
602
617
Attributes delivered from the target provider can be filtered based on a list of allowed attributes per requester
603
618
using the ` AttributePolicy` class:
619
+
604
620
` ` ` yaml
605
621
attribute_policy:
606
622
< requester> :
@@ -610,11 +626,25 @@ attribute_policy:
610
626
` ` `
611
627
612
628
# ### Route to a specific backend based on the requester
629
+
613
630
To choose which backend (essentially choosing target provider) to use based on the requester, use the
614
631
` DecideBackendByRequester` class which implements that special routing behavior. See the
615
632
[example configuration](../example/plugins/microservices/requester_based_routing.yaml.example).
616
633
634
+ # ### Route to a specific backend based on the target entity id
635
+
636
+ Use the ` DecideBackendByTargetIssuer` class which implements that special routing behavior. See the
637
+ [example configuration](../example/plugins/microservices/target_based_routing.yaml.example).
638
+
639
+ # ### Route to a specific backend based on the discovery service response
640
+
641
+ If a Discovery Service is in use and a target entity id is selected by users, you may want to use the
642
+ ` DiscoToTargetIssuer` class together with ` DecideBackendByTargetIssuer` to be able to select a
643
+ backend (essentially choosing target provider) based on the response from the discovery service.
644
+ See the [example configuration](../example/plugins/microservices/disco_to_target_issuer.yaml.example).
645
+
617
646
# ### Filter authentication requests to target SAML entities
647
+
618
648
If using the ` SAMLMirrorFrontend` module and some of the target providers should support some additional SP' s, the
619
649
`DecideIfRequesterIsAllowed` micro service can be used. It provides a rules mechanism to describe which SP' s are
620
650
allowed to send requests to which IdP' s. See the [example configuration](../example/plugins/microservices/allowed_requesters.yaml.example).
@@ -625,6 +655,7 @@ Metadata containing all SP's (any SP that might be allowed by a target IdP) must
625
655
The rules are described using ` allow` and ` deny` directives under the ` rules` configuration parameter.
626
656
627
657
In the following example, the target IdP ` target_entity_id1` only allows requests from ` requester1` and ` requester2` .
658
+
628
659
` ` ` yaml
629
660
rules:
630
661
target_entity_id1:
@@ -635,6 +666,7 @@ SP's are by default denied if the IdP has any rules associated with it (i.e, the
635
666
However, if the IdP does not have any rules associated with its entity id, all SP' s are by default allowed.
636
667
637
668
Deny all but one SP:
669
+
638
670
```yaml
639
671
rules:
640
672
target_entity_id1:
@@ -643,6 +675,7 @@ rules:
643
675
```
644
676
645
677
Allow all but one SP:
678
+
646
679
```yaml
647
680
rules:
648
681
target_entity_id1:
@@ -679,6 +712,16 @@ persistent NameID may also be obtained from attributes returned from the LDAP di
679
712
LDAP microservice install the extra necessary dependencies with `pip install satosa[ldap]` and then see the
680
713
[example config](../example/plugins/microservices/ldap_attribute_store.yaml.example).
681
714
715
+ #### Support for IdP Hinting
716
+
717
+ It' s possible to hint an IdP to SaToSa using the ` IdpHinting` micro-service.
718
+
719
+ With this feature an SP can send a hint about the IdP that should be used, in order to skip the discovery service.
720
+ The hint as a parameter in the query string of the request.
721
+ The hint query parameter value must be the entityID of the IdP.
722
+ The hint query parameter name is specified in the micro-service configuation.
723
+ See the [example configuration](../example/plugins/microservices/idp_hinting.yaml.example).
724
+
682
725
# ## Custom plugins
683
726
684
727
It' s possible to write custom plugins which can be loaded by SATOSA. They have to be contained in a Python module,
@@ -716,9 +759,11 @@ full featured general purpose web server (in a reverse proxy architecture) such
716
759
Apache HTTP Server to help buffer slow clients and enable more sophisticated error page rendering.
717
760
718
761
Start the proxy server with the following command:
762
+
719
763
```bash
720
764
gunicorn -b<socket address> satosa.wsgi:app --keyfile=<https key> --certfile=<https cert>
721
765
```
766
+
722
767
where
723
768
* `socket address` is the socket address that `gunicorn` should bind to for incoming requests, e.g. `0.0.0.0:8080`
724
769
* `https key` is the path to the private key to use for HTTPS, e.g. `pki/key.pem`
@@ -734,4 +779,3 @@ set SATOSA_CONFIG=/home/user/proxy_conf.yaml
734
779
## Using Apache HTTP Server and mod\_wsgi
735
780
736
781
See the [auxiliary documentation for running using mod\_wsgi](mod_wsgi.md).
737
-
0 commit comments