@@ -5,30 +5,33 @@ This document describes how to install and configure the SATOSA proxy.
55# Installation
66
77## <a name =" docker " style =" color :#000000 " >Docker</a >
8+
89A pre-built Docker image is accessible at the [ Docker Hub] ( https://hub.docker.com/r/satosa/ ) , and is the
910recommended ways of running the proxy.
1011
1112## <a name =" manual_installation " style =" color :#000000 " >Manual installation</a >
1213
1314### <a name =" dependencies " style =" color :#000000 " >Dependencies</a >
15+
1416SATOSA requires Python 3.4 (or above), and the following packages on Ubuntu:
15- ```
17+
18+ ``` bash
1619apt-get install libffi-dev libssl-dev xmlsec1
1720````
1821
1922# ## <a name="install_instructions" style="color:#000000">Instructions</a>
23+
20241. Download the SATOSA proxy project as a [compressed archive](https://github.com/IdentityPython/SATOSA/releases)
2125 and unpack it to ` < satosa_path> ` .
2226
23- 1 . Install the application:
27+ 2 . Install the application:
2428
2529 ` ` ` bash
2630 pip install < satosa_path>
2731 ` ` `
2832
2933Alternatively the application can be installed directly from PyPI (` pip install satosa` ), or the [Docker image](https://hub.docker.com/r/satosa/) can be used.
3034
31-
3235# ## <a name="install_external" style="color:#000000">External micro-services</a>
3336
3437Micro-services act like plugins and can be developed by anyone. Other people
@@ -53,8 +56,8 @@ The extentions include:
5356
5457and more.
5558
56-
5759# Configuration
60+
5861SATOSA is configured using YAML.
5962
6063All 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
7477process environment has been set with ` LDAP_BIND_PASSWORD=secret_password` then
7578the configuration value for ` bind_password` will be ` secret_password` .
7679
77- ```
80+ ` ` ` yaml
7881bind_password: ! ENV LDAP_BIND_PASSWORD
7982` ` `
8083
@@ -90,12 +93,12 @@ process environment has been set with
9093` LDAP_BIND_PASSWORD_FILE=/etc/satosa/secrets/ldap.txt` then the configuration
9194value for ` bind_password` will be ` secret_password` .
9295
93- ```
96+ ` ` ` yaml
9497bind_password: ! ENVFILE LDAP_BIND_PASSWORD_FILE
9598` ` `
9699
97-
98100# # <a name="proxy_conf" style="color:#000000">SATOSA proxy configuration</a>: `proxy_conf.yaml.example`
101+
99102| Parameter name | Data type | Example value | Description |
100103| -------------- | --------- | ------------- | ----------- |
101104| ` BASE` | string | ` https://proxy.example.com` | base url of the proxy |
@@ -109,10 +112,10 @@ bind_password: !ENVFILE LDAP_BIND_PASSWORD_FILE
109112| ` MICRO_SERVICES` | string[] | ` [statistics_service.yaml]` | list of plugin configuration file paths, describing enabled microservices |
110113| ` LOGGING` | dict | see [Python logging.conf](https://docs.python.org/3/library/logging.config.html) | optional configuration of application logging |
111114
112-
113115# # <a name="attr_map" style="color:#000000">Attribute mapping configuration:</a> `internal_attributes.yaml`
114116
115117# ## attributes
118+
116119The values directly under the ` attributes` key are the internal attribute names.
117120Every internal attribute has a map of profiles, which in turn has a list of
118121external attributes names which should be mapped to the internal attributes.
@@ -124,14 +127,15 @@ internal attribute.
124127Sometimes the external attributes are nested/complex structures. One example is
125128the [address claim in OpenID connect](http://openid.net/specs/openid-connect-core-1_0.html#AddressClaim)
126129which consists of multiple sub-fields, e.g.:
130+
127131` ` ` json
128132" address" : {
129133 " formatted" : " 100 Universal City Plaza, Hollywood CA 91608, USA" ,
130134 " street_address" : " 100 Universal City Plaza" ,
131135 " locality" : " Hollywood" ,
132136 " region" : " CA" ,
133137 " postal_code" : " 91608" ,
134- "country" : " USA" ,
138+ " country" : " USA"
135139}
136140` ` `
137141
@@ -166,28 +170,29 @@ attributes (in the proxy backend) <-> internal <-> returned attributes (from the
166170* Any plugin using the ` saml` profile will use the attribute value from ` postaladdress`
167171 delivered from the target provider as the value for ` address` .
168172
169-
170173# ## user_id_from_attrs
174+
171175The subject identifier generated by the backend module can be overridden by
172176specifying a list of internal attribute names under the ` user_id_from_attrs` key.
173177The attribute values of the attributes specified in this list will be
174178concatenated and used as the subject identifier.
175179
176-
177180# ## user_id_to_attr
181+
178182To store the subject identifier in a specific internal attribute, the internal
179183attribute name can be specified in ` user_id_to_attr` .
180184When the [ALService](https://github.com/its-dirg/ALservice) is used for account
181185linking, the ` user_id_to_attr` configuration parameter should be set, since that
182186service will overwrite the subject identifier generated by the proxy.
183187
184-
185188# # Plugins
189+
186190The authentication protocol specific communication is handled by different plugins,
187191divided into frontends (receiving requests from clients) and backends (sending requests
188192to target providers).
189193
190194# ## Common plugin configuration parameters
195+
191196Both ` name` and ` module` must be specified in all plugin configurations (frontends, backends, and micro services).
192197The ` name` must be unique to ensure correct functionality, and the ` module` must be the fully qualified name of an
193198importable Python module.
@@ -230,7 +235,6 @@ For more detailed information on how you could customize the SAML entities,
230235see the
231236[documentation of the underlying library pysaml2](https://github.com/rohe/pysaml2/blob/master/docs/howto/config.rst).
232237
233-
234238# ### Providing `AuthnContextClassRef`
235239
236240SAML2 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
252256
253257** Example**
254258
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+ ` ` `
261266
262267# ### <a name="saml_frontend" style="color:#000000">Frontend</a>
263268
@@ -296,8 +301,8 @@ An example configuration can be found [here](../example/plugins/frontends/saml2_
296301
297302 `SP -> Virtual CO SAMLFrontend -> SAMLBackend -> optional discovery service -> target IdP`
298303
299-
300304##### Custom attribute release
305+
301306In addition to respecting for example entity categories from the SAML metadata, the SAML frontend can also further
302307restrict the attribute release with the `custom_attribute_release` configuration parameter based on the SP entity id.
303308
@@ -349,13 +354,14 @@ Overrides per SP entityID is possible by using the entityID as a key instead of
349354in the yaml structure. The most specific key takes presedence. If no policy overrides are provided
350355the defaults above are used.
351356
352-
353357#### <a name="saml_backend" style="color:#000000">Backend</a>
358+
354359The SAML2 backend act as a SAML Service Provider (SP), making authentication
355360requests to SAML Identity Providers (IdP). The default configuration file can be
356361found [here](../example/plugins/backends/saml2_backend.yaml.example).
357362
358363##### <a name="name_id" style="color:#000000">Name ID Format</a>
364+
359365The SAML backend can indicate which *Name ID* format it wants by specifying the key
360366`name_id_format` in the SP entity configuration in the backend plugin configuration:
361367
@@ -368,6 +374,7 @@ The SAML backend can indicate which *Name ID* format it wants by specifying the
368374 ```
369375
370376##### Use a discovery service
377+
371378To allow the user to choose which target provider they want to authenticate with, the configuration
372379parameter `disco_srv`, must be specified if the metadata given to the backend module contains more than one IdP:
373380
@@ -433,6 +440,7 @@ config:
433440# ## <a name="openid_plugin" style="color:#000000">OpenID Connect plugins</a>
434441
435442# ### <a name="openid_backend" style="color:#000000">Backend</a>
443+
436444The OpenID Connect backend acts as an OpenID Connect Relying Party (RP), making
437445authentication requests to OpenID Connect Provider (OP). The default
438446configuration 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
444452and make sure to provide the redirect URI, constructed as described in the
445453section about Google configuration below, in the static registration.
446454
447-
448455# ### <a name="openid_frontend" style="color:#000000">Frontend</a>
456+
449457The OpenID Connect frontend acts as and OpenID Connect Provider (OP), accepting requests from OpenID
450458Connect Relying Parties (RPs). The default configuration file can be found
451459[here](../example/plugins/frontends/openid_connect_frontend.yaml.example).
@@ -477,10 +485,12 @@ The configuration parameters available:
477485The other parameters should be left with their default values.
478486
479487# ## <a name="social_plugins" style="color:#000000">Social login plugins</a>
488+
480489The social login plugins can be used as backends for the proxy, allowing the
481490proxy to act as a client to the social login services.
482491
483492# ### Google
493+
484494The default configuration file can be
485495found [here](../example/plugins/backends/google_backend.yaml.example).
486496
@@ -495,7 +505,7 @@ It should use the available variables, `<base_url>` and `<name>`, where:
495505
4965061. ` < base_url> ` is the base url of the proxy as specified in the ` BASE` configuration parameter
497507in ` 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.
499509
500510The example config in ` google_backend.yaml.example` :
501511
@@ -507,14 +517,15 @@ config:
507517 redirect_uris: [< base_url> /< name> ]
508518[...]
509519` ` `
520+
510521together with ` BASE: " https://proxy.example.com" ` in ` proxy_conf.yaml` would
511522yield the redirect URI ` https://proxy.example.com/google` to register with Google.
512523
513524A list of all claims possibly released by Google can be found [here](https://developers.google.com/identity/protocols/OpenIDConnect#obtainuserinfo),
514525which should be used when configuring the attribute mapping (see above).
515526
516-
517527# ### Facebook
528+
518529The default configuration file can be
519530found [here](../example/plugins/backends/facebook_backend.yaml.example).
520531
@@ -549,7 +560,7 @@ pre-configured (static) attributes, see the
549560
550561The static attributes are described as key-value pairs in the YAML file, e.g:
551562
552- ` ` `
563+ ` ` ` yaml
553564organisation: Example Org.
554565country: Sweden
555566` ` `
@@ -574,15 +585,18 @@ The filters are applied such that all attribute values matched by the regular ex
574585non-matching attribute values will be discarded.
575586
576587# #### Examples
588+
577589Filter attributes from the target provider ` https://provider.example.com` , to only preserve values starting with the
578590string ` " foo:bar" ` :
591+
579592` ` ` yaml
580593" https://provider.example.com" :
581594 " " :
582595 " " : " ^foo:bar"
583596` ` `
584597
585598Filter the attribute ` attr1` to only preserve values ending with the string ` " foo:bar" ` :
599+
586600` ` ` yaml
587601" " :
588602 " " :
@@ -591,6 +605,7 @@ Filter the attribute `attr1` to only preserve values ending with the string `"fo
591605
592606Filter the attribute ` attr1` to the requester ` https://provider.example.com` , to only preserver values containing
593607the string ` " foo:bar" ` :
608+
594609` ` ` yaml
595610" " :
596611 " https://client.example.com" :
@@ -601,6 +616,7 @@ the string `"foo:bar"`:
601616
602617Attributes delivered from the target provider can be filtered based on a list of allowed attributes per requester
603618using the ` AttributePolicy` class:
619+
604620` ` ` yaml
605621attribute_policy:
606622 < requester> :
@@ -610,11 +626,13 @@ attribute_policy:
610626` ` `
611627
612628# ### Route to a specific backend based on the requester
629+
613630To choose which backend (essentially choosing target provider) to use based on the requester, use the
614631` DecideBackendByRequester` class which implements that special routing behavior. See the
615632[example configuration](../example/plugins/microservices/requester_based_routing.yaml.example).
616633
617634# ### Route to a specific backend based on the target entity id
635+
618636Use the ` DecideBackendByTargetIssuer` class which implements that special routing behavior. See the
619637[example configuration](../example/plugins/microservices/target_based_routing.yaml.example).
620638
@@ -623,6 +641,7 @@ If a Discovery Service have been used and the target entity id is selected by us
623641 to get the expected result. See the [example configuration](../example/plugins/microservices/disco_to_target_issuer.yaml.example).
624642
625643# ### Filter authentication requests to target SAML entities
644+
626645If using the ` SAMLMirrorFrontend` module and some of the target providers should support some additional SP' s, the
627646`DecideIfRequesterIsAllowed` micro service can be used. It provides a rules mechanism to describe which SP' s are
628647allowed to send requests to which IdP' s. See the [example configuration](../example/plugins/microservices/allowed_requesters.yaml.example).
@@ -633,6 +652,7 @@ Metadata containing all SP's (any SP that might be allowed by a target IdP) must
633652The rules are described using ` allow` and ` deny` directives under the ` rules` configuration parameter.
634653
635654In the following example, the target IdP ` target_entity_id1` only allows requests from ` requester1` and ` requester2` .
655+
636656` ` ` yaml
637657rules:
638658 target_entity_id1:
@@ -643,6 +663,7 @@ SP's are by default denied if the IdP has any rules associated with it (i.e, the
643663However, if the IdP does not have any rules associated with its entity id, all SP' s are by default allowed.
644664
645665Deny all but one SP:
666+
646667```yaml
647668rules:
648669 target_entity_id1:
@@ -651,6 +672,7 @@ rules:
651672```
652673
653674Allow all but one SP:
675+
654676```yaml
655677rules:
656678 target_entity_id1:
@@ -733,9 +755,11 @@ full featured general purpose web server (in a reverse proxy architecture) such
733755Apache HTTP Server to help buffer slow clients and enable more sophisticated error page rendering.
734756
735757Start the proxy server with the following command:
758+
736759```bash
737760gunicorn -b<socket address> satosa.wsgi:app --keyfile=<https key> --certfile=<https cert>
738761```
762+
739763where
740764* `socket address` is the socket address that `gunicorn` should bind to for incoming requests, e.g. `0.0.0.0:8080`
741765* `https key` is the path to the private key to use for HTTPS, e.g. `pki/key.pem`
0 commit comments