Debian Codegraph @

doc/sources/admin/openidconnectservice.rst

raw
1 OpenID Connect service configuration
2 ====================================
3
4 Service configuration
5 ---------------------
6
7 Go in Manager and click on ``OpenID Connect Service`` node.
8
9 Issuer identifier
10 ~~~~~~~~~~~~~~~~~
11
12 Set the issuer identifier, this URL will also be used as the base URL for all OIDC endpoints.
13 If this value is left empty, the portal URL is used. Don't change this unless you have a very good reason to.
14
15 Endpoints
16 ~~~~~~~~~~
17
18 Name of different OpenID Connect endpoints. You can keep the default
19 values unless you have a specific need to change them.
20
21 - **Authorization**
22 - **Tokens**
23 - **User Info**
24 - **JWKS**
25 - **Registration**
26 - **Introspection**
27 - **Token revocation**
28 - **End of session**
29 - **Check Session**
30 - **Front-Channel URI**
31 - **Back-Channel URI**
32
33 .. tip::
34
35 These endpoints are published in JSON metadata.
36
37
38 Authentication context
39 ~~~~~~~~~~~~~~~~~~~~~~
40
41 You can associate here an authentication context to an authentication level.
42
43 .. _amrrules:
44
45 Authentication Method Reference rules
46 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47
48 When issuing an ID Token, Lemonldap will fill the ``amr`` field according to
49 the rules specified in this section. A minimal set of rules is provided. If
50 you need particular ``amr`` values to be sent to your applications depending on
51 authentication conditions, you can add your own custom rules here.
52
53 The key of each entry is the ``amr`` value to be added to the ID token. The
54 value is a rule that decides whether or not that value is set.
55
56 Any session variable or environment variable can be used, but the most
57 relevant variables to use here are probably:
58
59 * ``$_auth``: name of the authentication module
60 * ``$_choice``: name of the authentication choice, if used
61 * ``$_2f``: name of the 2FA type used
62 * ``$authenticationLevel``: current authentication level
63 * ``$_clientId``: client ID of the target service, in case a service requires special processing
64 * ``$_clientConfKey``: configuration key of the target service, in case a service requires special processing
65
66 For more information on standard AMR values, refer to :rfc:`8176`
67
68 Dynamic registration
69 ~~~~~~~~~~~~~~~~~~~~
70
71 If **Dynamic registration** is enabled, you can configure **Exported vars** and **Extra claims** options
72 to define attributes and extra claims released when a new relying party is registered through ``/oauth2/register`` endpoint.
73
74 - **Activation**:
75
76 - ``0``: Disabled
77 - ``1``: Confidential clients only (clients must use a secret-based
78 ``token_endpoint_auth_method``)
79 - ``2``: All clients, including public clients
80 (``token_endpoint_auth_method=none``)
81
82 - **Exported vars**
83 - **Extra claims**
84
85 All dynamically registered clients have ``RequirePKCE`` set to
86 ``pkceOrSecret`` (value 2). This means:
87
88 - Confidential clients (``client_secret_basic``, ``client_secret_post``,
89 ``client_secret_jwt``) can authenticate with their secret or PKCE
90 - ``private_key_jwt`` clients authenticate via signed JWT (requires
91 ``jwks_uri`` in the registration request)
92 - Public clients (``token_endpoint_auth_method=none``) are required to use
93 PKCE since they have no other authentication method
94
95 .. warning::
96 Dynamic Registration can be a security risk because a new configuration
97 will be created in the backend for each registration request.
98 You can restrict this by protecting the WebServer registration endpoint
99 with an authentication module, and give credentials to clients.
100
101 .. _openidconnectservice-security-parameters:
102
103 Security
104 ~~~~~~~~
105
106 - **Keys**: Define public/private key pair for asymmetric signature. A JWKS
107 ``kid`` (Key ID) is automatically derived when new keys are generated.
108 You have to choose the key type: ``RSA`` or ``EC``. The list of
109 supported algorithms in OIDC metadata will be automatically updated.
110
111 - Set signing key if LLNG is an OpenID-Connect server
112 - Set Encryption key if LLNG is an OpenID-Connect Relying-Party and if you
113 want that the OpenID-Connect server encrypt the JWT tokens
114 - **Advanced key configuration**
115
116 - **Signing key name**: By default, the key specified above will be used
117 for signature. You can use :doc:`anonther key <keys>` instead in order to
118 better manage key rotation. If you declare a comma-separated list, only
119 the first declared key will be used for signature, but all listed keys
120 will be published in the JWKS document
121 - **Encryption key name**: By default, the key specified above will be
122 used for encryption. You can use :doc:`anonther key <keys>` instead in
123 order to better manage key rotation. If you declare a comma-separated
124 list, only the first declared key will be used for encryption, but all
125 listed keys will be published in the JWKS document
126 - **Authorization Code Flow**: Set to 'On' to allow Authorization Code flow
127 - **Implicit Flow**: Set to 'On' to allow Implicit flow
128 - **Hybrid Flow**: Set to 'On' to allow Hybrid flow
129 - **Always send exported attributes**: By default, LL::NG will release all
130 exported attributes to RPs. When this option is disabled, only attributes
131 allowed by a scope can be transmitted
132 - **Only allow declared scopes**: By default, LL::NG will grant all requested scopes.
133 When this option is enabled, LL::NG will only grant:
134
135 - Standard OIDC scopes (``openid`` ``profile`` ``email`` ``address`` ``phone``)
136 - Scopes declared in :ref:`Scope values content <oidcextraclaims>`
137 - Scopes declared in :ref:`Scope Rules <oidcscoperules>` (if they match the rule)
138 - **Drop CSP headers from OIDC responses**: Set to 'On' to drop all Content Security Policy headers (:ref:`CSP<security-configure-security-settings>`) from OIDC responses
139 - **Default "alg" algorithm for JWE encryption**: when LL::NG is an OpenID-Connect
140 Server, you can set here the default "alg" algorithm to use for JWE encryption
141 - **Default "enc" algorithm for JWE encryption**: when LL::NG is an OpenID-Connect
142 Server, you can set here the default "enc" algorithm to use for JWE encryption
143 - **Do not display metadata**: Set to 'On' to hide OIDC metadata
144
145
146 .. _x5c:
147
148 .. versionchanged:: 2.0.16
149
150 In order to increase compatibility with some applications, LemonLDAP::NG
151 encapsulates the OIDC signing key in a certificate.
152
153 If you generated your OIDC keys on an older version of LemonLDAP::NG, and
154 some application complains that the JWKS document is missing a `x5c` key,
155 you can upgrade your OIDC signing key in the following manner ::
156
157 # Extract the OIDC signing key
158 lemonldap-ng-cli get oidcServicePrivateKeySig | sed 's/^oidcServicePrivateKeySig = //' > oidc.key
159
160 # Generate a certificate
161 openssl req -x509 -key oidc.key -out oidc.pem -sha256 -days 7000 -subj="/CN=$(hostname -f)"
162
163 # Import the new certificate
164 lemonldap-ng-cli set oidcServicePublicKeySig "$(cat oidc.pem)"
165
166 # Remove temporary files
167 rm oidc.key oidc.pem
168
169 Timeouts
170 ~~~~~~~~
171
172 - **Authorization Codes**: Expiration time of
173 authorization code. Default value is one minute.
174 - **ID Tokens**: Expiration time of ID Tokens.
175 Default value is one hour.
176 - **Access Tokens**: Expiration time of Access Tokens.
177 Default value is one hour.
178 - **Offline sessions**: This option sets lifetime of Refresh Tokens
179 retrieved with ``offline_access`` scope. Default value is one month.
180 - **OIDC Metadata TTL**: When a non 0 value is set here, the OIDC metadata
181 are generated with a ``Cache-Control: public`` header and the corresponding
182 "time-to-live" value.
183
184
185 Sessions
186 ~~~~~~~~
187
188 Best pratice is to use a separate sessions storage for OpenID Connect
189 sessions, else they will be stored in main sessions storage.
190
191 Keys rotation script
192 --------------------
193
194 OpenID Connect specifications allow to rotate keys to improve security.
195 LL::NG provides a script to do this, that should be used in a cronjob.
196
197 The script is ``/usr/share/lemonldap-ng/bin/rotateOidcKeys``. It can be
198 run for example each week:
199
200 ::
201
202 5 5 * * 6 www-data /usr/share/lemonldap-ng/bin/rotateOidcKeys
203
204 Both a systemd timer and a cronjob are provided in LL::NG tarball and packages.
205
206 This is _not_ enabled by default, one needs to enable it:
207
208 - For cron, un-comment the line in the `/etc/cron.d/lemonldap-ng-rotateOidcKeys` cronjob.
209 - For systemd, run `systemctl enable lemonldap-ng-rotateOidcKeys.timer --now`.
210
211 .. tip::
212
213 Set the correct WebServer user, else generated configuration will
214 not be readable by LL::NG.
215
216 Session management
217 ------------------
218
219 LL::NG implements the `OpenID Connect Change Notification specification <http://openid.net/specs/openid-connect-session-1_0.html#ChangeNotification>`__
220
221 A ``changed`` state will be sent if the user is disconnected from LL::NG
222 portal (or has removed its SSO cookie). Else the ``unchanged`` state
223 will be returned.
224
225
226 .. tip::
227
228 This feature requires that the LL::NG cookie is exposed to
229 javascript (``httpOnly`` option must be set to ``0``).