2021-12-03 17:37:25 +00:00
Configuration
#############
Here are the different options you can have in your configuration file.
.. contents ::
:local:
2023-06-15 16:29:12 +00:00
.. note ::
Any configuration entry can be suffixed by *_FILE* and point to the path of
a file that contains the actual value. For instance you could have
`` SECRET_KEY_FILE = "/path/to/secret.txt" `` instead of `` SECRET_KEY = "very-secret" ``
2021-12-03 17:37:25 +00:00
Sections
========
Miscellaneous
-------------
2023-06-15 16:29:12 +00:00
Canaille is based on Flask, so any `flask configuration <https://flask.palletsprojects.com/en/2.3.x/config/#builtin-configuration-values> `_ option will be usable with canaille:
2021-12-03 17:37:25 +00:00
:SECRET_KEY:
**Required.** The Flask secret key. You should set a random string here.
:NAME:
*Optional.* The name of your organization. If not set `Canaille` will be used.
:LOGO:
*Optional.* The URL ot the logo of your organization. The default is the canaille logo.
:FAVICON:
*Optional.* An URL to a favicon. The default is the value of `` LOGO `` .
:THEME:
*Optional.* The name or the path to a canaille theme.
If the value is just a name, the theme should be in a directory with that namein the *themes* directory.
:LANGUAGE:
*Optional.* The locale code of the language to use. If not set, the language of the browser will be used.
2023-05-29 18:16:59 +00:00
:TIMEZONE:
*Optional.* The timezone in which datetimes will be displayed to the users. If unset, the server timezone will be used.
2023-06-23 14:26:38 +00:00
:HTMX:
*Optional.* Wether `HTMX <https://htmx.org> `_ will be used to accelerate webpages. Defaults to true.
2021-12-03 17:37:25 +00:00
:SENTRY_DSN:
*Optional.* A DSN to a sentry instance.
This needs the `` sentry_sdk `` python package to be installed.
This is useful if you want to collect the canaille exceptions in a production environment.
:HIDE_INVALID_LOGINS:
*Optional.* Wether to tell the users if a username exists during failing login attempts.
2022-04-05 07:49:45 +00:00
Defaults to `` True `` . This may be a security issue to disable this, as this give a way to malicious people to if an account exists on this canaille instance.
:ENABLE_PASSWORD_RECOVERY:
*Optional* Wether the password recovery feature is enabled or not.
Defaults to `` True `` .
2021-12-03 17:37:25 +00:00
2022-01-01 10:56:48 +00:00
:INVITATION_EXPIRATION:
*Optional* The validity duration of registration invitations, in seconds.
Defaults to 2 days.
2021-12-03 17:37:25 +00:00
LOGGING
-------
:LEVEL:
*Optional.* The logging level. Must be an either *DEBUG* , *INFO* , *WARNING* , *ERROR* or *CRITICAL* . Defults to *WARNING* .
:PATH:
*Optional.* The log file path. If not set, logs are written in the standard error output.
2023-04-10 18:31:54 +00:00
BACKENDS.LDAP
-------------
2021-12-03 17:37:25 +00:00
:URI:
**Required.** The URI to the LDAP server.
e.g. `` ldaps://ldad.mydomain.tld ``
:ROOT_DN:
**Required.** The root DN of your LDAP server.
e.g. `` dc=mydomain,dc=tld ``
:BIND_DN:
**Required.** The LDAP DN to bind with.
e.g. `` cn=admin,dc=mydomain,dc=tld ``
:BIND_PW:
**Required.** The LDAP user associated with `` BIND_DN `` .
:TIMEOUT:
*Optional.* The time to wait for the LDAP server to respond before considering it is not functional.
:USER_BASE:
**Required.** The DN of the node in which users will be searched for, and created.
e.g. `` ou=users,dc=mydomain,dc=tld ``
:USER_CLASS:
*Optional.* The LDAP object class to filter existing users, and create new users.
2023-03-11 18:46:12 +00:00
Can be a list of classes.
2021-12-03 17:37:25 +00:00
Defaults to `` inetOrgPerson `` .
2023-06-27 16:47:59 +00:00
:USER_RDN:
2021-12-03 17:37:25 +00:00
*Optional.* The attribute to identify an object in the User DN.
For example, if it has the value `` uid `` , users DN will be in the form `` uid=foobar,ou=users,dc=mydomain,dc=tld `` .
Defaults to `` cn `` .
:USER_FILTER:
*Optional.* The filter to match users on sign in.
Supports a variable {login} that can be used to compare against several LDAP attributes.
Defaults to `` (|(uid={login})(mail={login})) ``
:GROUP_BASE:
**Required.** The DN where of the node in which LDAP groups will be created and searched for.
e.g. `` ou=groups,dc=mydomain,dc=tld ``
:GROUP_CLASS:
*Optional.* The LDAP object class to filter existing groups, and create new groups.
2023-03-11 18:46:12 +00:00
Can be a list of classes.
2021-12-03 17:37:25 +00:00
Defaults to `` groupOfNames ``
2023-06-27 16:47:59 +00:00
:GROUP_RDN:
2021-12-03 17:37:25 +00:00
*Optional.* The attribute to identify an object in a group DN.
For example, if it has the value `` cn `` , groups DN will be in the form `` cn=foobar,ou=users,dc=mydomain,dc=tld `` .
Defaults to `` cn ``
:GROUP_NAME_ATTRIBUTE:
*Optional.* The attribute to identify a group in the web interface.
Defaults to `` cn ``
ACL
---
You can define access controls that define what users can do on canaille
An access control consists in a `` FILTER `` to match users, a list of `` PERMISSIONS `` that users will be able to perform, and fields users will be able
to `` READ `` and `` WRITE `` . Users matching several filters will cumulate permissions.
The 'READ' and 'WRITE' attributes are the LDAP attributes of the user
object that users will be able to read and/or write.
:FILTER:
2023-04-14 16:46:42 +00:00
*Optional.* It can be:
- absent, in which case all the users will have the permissions in this ACL.
- a mapping where keys are user attributes name and the values those user
attribute values. All the values must be matched for the user to be part
of the access control.
- a list of those mappings. If a user values match at least one mapping,
then the user will be part of the access control
Here are some examples:
- `` FILTER = {'user_name': 'admin'} ``
- `` FILTER = [{'groups': 'admin'}, {'groups': 'moderators'}] ``
2021-12-03 17:37:25 +00:00
:PERMISSIONS:
*Optional.* A list of items the users in the access control will be able to manage. Values can be:
2022-04-05 15:16:09 +00:00
- **edit_self** to allow users to edit their own profile
2021-12-03 17:37:25 +00:00
- **use_oidc** to allow OpenID Connect authentication
- **manage_oidc** to allow OpenID Connect client managements
- **manage_users** to allow other users management
- **manage_groups** to allow group edition and creation
- **delete_account** allows a user to delete his own account. If used with *manage_users* , the user can delete any account
- **impersonate_users** to allow a user to take the identity of another user
:READ:
*Optional.* A list of attributes of `` USER_CLASS `` the user will be able to see, but not edit.
2022-04-05 15:16:09 +00:00
If the users has the `` edit_self `` permission, they will be able to see those fields on their own account.
If the users has the `` manage_users `` permission, the user will be able to see this fields on other users profile.
2021-12-03 17:37:25 +00:00
If the list containts the special `` groups `` field, the user will be able to see the groups he belongs to.
:WRITE:
*Optional.* A list of attributes of `` USER_CLASS `` the user will be able to edit.
2022-04-05 15:16:09 +00:00
If the users has the `` edit_self `` permission, they will be able to edit those fields on their own account.
If the users has the `` manage_users `` permission, they will be able to edit those fields on other users profile.
2021-12-03 17:37:25 +00:00
If the list containts the special `` groups `` field, the user will be able to edit the groups he belongs to.
2023-04-10 14:24:43 +00:00
OIDC
----
2021-12-03 17:37:25 +00:00
2023-04-10 14:24:43 +00:00
:DYNAMIC_CLIENT_REGISTRATION_OPEN:
*Optional.* Wether a token is needed for the RFC7591 dynamical client registration.
If true, no token is needed to register a client.
If false, dynamical client registration needs a token defined
in `DYNAMIC_CLIENT_REGISTRATION_TOKENS` `
Defaults to `` False ``
:DYNAMIC_CLIENT_REGISTRATION_TOKENS:
*Optional.* A list of tokens that can be used for dynamic client registration
OIDC.JWT
--------
2021-12-03 17:37:25 +00:00
Canaille needs a key pair to sign the JWT. The installation command will generate a key pair for you, but you can also do it manually.
:PRIVATE_KEY:
**Required.** The path to the private key.
e.g. `` /path/to/canaille/conf/private.pem ``
:PUBLIC_KEY:
**Required.** The path to the public key.
e.g. `` /path/to/canaille/conf/private.pem ``
2022-04-10 14:00:51 +00:00
:ISS:
2022-11-17 16:44:54 +00:00
*Optional.* The URI of the identity provider.
Defaults to `` SERVER_NAME `` if set, else the current domain will be used.
2022-04-10 14:00:51 +00:00
e.g. `` https://auth.mydomain.tld ``
2021-12-03 17:37:25 +00:00
:KTY:
*Optional.* The key type parameter.
Defaults to `` RSA `` .
:ALG:
*Optional.* The key algorithm.
Defaults to `` RS256 `` .
:EXP:
*Optional.* The time the JWT will be valid, in seconds.
Defaults to `` 3600 ``
2023-04-10 14:24:43 +00:00
OIDC.JWT.MAPPINGS
-----------------
2021-12-03 17:37:25 +00:00
A mapping where keys are JWT claims, and values are LDAP user object attributes.
2021-12-12 15:15:06 +00:00
Attributes are rendered using jinja2, and can use a `` user `` variable.
2021-12-03 17:37:25 +00:00
:SUB:
2023-02-05 17:57:18 +00:00
*Optional.* Defaults to `` {{ user.user_name[0] }} ``
2021-12-03 17:37:25 +00:00
:NAME:
2021-12-12 15:15:06 +00:00
*Optional.* Defaults to `` {{ user.cn[0] }} ``
2021-12-03 17:37:25 +00:00
:PHONE_NUMBER:
2023-02-05 17:57:18 +00:00
*Optional.* Defaults to `` {{ user.phone_number[0] }} ``
2021-12-03 17:37:25 +00:00
:EMAIL:
2021-12-12 15:15:06 +00:00
*Optional.* Defaults to `` {{ user.mail[0] }} ``
2021-12-03 17:37:25 +00:00
:GIVEN_NAME:
2023-02-05 17:57:18 +00:00
*Optional.* Defaults to `` {{ user.given_name[0] }} ``
2021-12-03 17:37:25 +00:00
:FAMILY_NAME:
2023-02-05 17:57:18 +00:00
*Optional.* Defaults to `` {{ user.family_name[0] }} ``
2021-12-03 17:37:25 +00:00
:PREFERRED_USERNAME:
2023-02-05 17:57:18 +00:00
*Optional.* Defaults to `` {{ user.display_name[0] }} ``
2021-12-03 17:37:25 +00:00
:LOCALE:
2023-02-05 17:57:18 +00:00
*Optional.* Defaults to `` {{ user.locale }} ``
2021-12-03 17:37:25 +00:00
:ADDRESS:
2023-02-05 17:57:18 +00:00
*Optional.* Defaults to `` {{ user.address[0] }} ``
2021-12-03 17:37:25 +00:00
2021-12-13 21:50:53 +00:00
:PICTURE:
2023-02-05 17:57:18 +00:00
*Optional.* Defaults to `` {% if user.photo %}{{ url_for('account.photo', user_name=user.user_name[0], field='photo', _external=True) }}{% endif %} ``
2021-12-13 21:50:53 +00:00
2021-12-13 22:04:34 +00:00
:WEBSITE:
2023-02-05 17:57:18 +00:00
*Optional.* Defaults to `` {{ user.profile_url[0] }} ``
2021-12-13 22:04:34 +00:00
2021-12-13 21:50:53 +00:00
2021-12-03 17:37:25 +00:00
SMTP
----
Canaille needs you to configure a SMTP server to send some mails, including the *I forgot my password* and the *invitation* mails.
Without this section Canaille will still be usable, but all the features related to mail will be disabled.
:HOST:
The SMTP server to connect to.
Defaults to `` localhost ``
:PORT:
The port to use with the SMTP connection.
Defaults to `` 25 ``
:TLS:
Whether the SMTP connection use TLS.
Default to `` False ``
2023-02-28 09:07:08 +00:00
:SSL:
Whether the SMTP connection use SSL.
Default to `` False ``
2021-12-03 17:37:25 +00:00
:LOGIN:
The SMTP server authentication login.
*Optional.*
:PASSWORD:
The SMTP server authentication password.
*Optional.*
:FROM_ADDR:
2022-11-14 17:59:07 +00:00
*Optional.* The mail address to use as the sender for Canaille emails.
Defaults to `admin@<HOSTNAME>` where `HOSTNAME` is the current hostname.