2020-05-26 00:15:56 +02:00
---
2022-02-21 08:16:54 +01:00
title: Custom authentication
sidebar_position: 40
2020-05-26 00:15:56 +02:00
---
2020-05-15 18:51:40 +02:00
2022-08-03 10:51:48 +02:00
:::warning
Since LibreTime v3.0.0-alpha.13, this documentation is out of date, as it relies on the Apache2 web server and the default web server installed by LibreTime is now NGINX.
:::
2022-02-21 08:16:54 +01:00
## Setup FreeIPA authentication
2017-03-18 19:15:20 +01:00
You can configure LibreTime to delegate all authentication to a FreeIPA server.
This allows you users to use their existing FreeIPA credentials. For this to
work you need to configure Apache to use `mod_authnz_pam` and `mod_intercept_form_submit` .
2022-02-21 08:16:54 +01:00
### Apache configuration
2017-03-18 19:15:20 +01:00
After installing the needed modules you can set up Apache to intercept form logins and
check them against pam.
2022-02-10 12:15:23 +01:00
```apacheconf
2017-03-18 19:15:20 +01:00
< Location / login >
InterceptFormPAMService http-libretime
InterceptFormLogin username
InterceptFormPassword password
InterceptFormLoginSkip admin
InterceptFormPasswordRedact on
InterceptFormLoginRealms INT.RABE.CH
Require pam-account http-libretime
< / Location >
< Location / >
< RequireAny >
< RequireAny >
Require pam-account http-libretime
Require all granted
< / RequireAny >
< RequireAll >
Require expr %{REQUEST_URI} =~ /(index.php|login|favicon.ico|js|css|locale)/
Require all granted
< / RequireAll >
< / RequireAny >
< / Location >
```
2022-02-21 08:16:54 +01:00
### PAM configuration
2017-03-18 19:15:20 +01:00
The above configuration expects a PAM configuration for the `http-libretime` service.
2024-06-05 17:54:12 +02:00
To configure this you need to create the file `/etc/pam.d/http-libretime` with the following contents.
2017-03-18 19:15:20 +01:00
```
auth required pam_sss.so
account required pam_sss.so
```
2022-02-21 08:16:54 +01:00
### LDAP configuration
2017-03-18 19:15:20 +01:00
LibreTime needs direct access to LDAP so it can fetch additional information. It does so with
a [system account ](https://www.freeipa.org/page/HowTo/LDAP#System_Accounts ) that you need to
set up beforehand.
2021-05-27 16:20:34 +02:00
You can configure everything pertaining to how LibreTime accesses LDAP in
2022-06-06 17:10:44 +02:00
`/etc/libretime/config.yml` . The default file has the following values you need to change.
2017-03-18 19:15:20 +01:00
2022-06-06 17:04:26 +02:00
```yml
2021-05-27 16:20:34 +02:00
#
2017-03-18 19:15:20 +01:00
# ----------------------------------------------------------------------
# L D A P
# ----------------------------------------------------------------------
#
# hostname: Hostname of LDAP server
#
# binddn: Complete DN of user used to bind to LDAP
#
# password: Password for binddn user
#
# account_domain: Domain part of username
#
# basedn: base search DN
#
# filter_field: Name of the uid field for searching
# Usually uid, may be cn
#
# groupmap_*: Map LibreTime user types to LDAP groups
# Lets LibreTime assign user types based on the
# group a given user is in.
#
2022-06-06 17:04:26 +02:00
ldap:
hostname: ldap.example.org
binddn: "uid=libretime,cn=sysaccounts,cn=etc,dc=int,dc=example,dc=org"
password: hackme
account_domain: INT.EXAMPLE.ORG
basedn: "cn=users,cn=accounts,dc=int,dc=example,dc=org"
filter_field: uid
groupmap_guest: "cn=guest,cn=groups,cn=accounts,dc=int,dc=example,dc=org"
groupmap_host: "cn=host,cn=groups,cn=accounts,dc=int,dc=example,dc=org"
groupmap_program_manager: "cn=program_manager,cn=groups,cn=accounts,dc=int,dc=example,dc=org"
groupmap_admin: "cn=admins,cn=groups,cn=accounts,dc=int,dc=example,dc=org"
groupmap_superadmin: "cn=superadmin,cn=groups,cn=accounts,dc=int,dc=example,dc=org"
2017-03-18 19:15:20 +01:00
```
2022-02-21 08:16:54 +01:00
### Enable FreeIPA authentication
2017-03-18 19:15:20 +01:00
2022-06-06 17:09:25 +02:00
After everything is set up properly you can enable FreeIPA auth in `config.yml` :
2017-03-18 19:15:20 +01:00
2022-06-06 17:04:26 +02:00
```yml
general:
auth: LibreTime_Auth_Adaptor_FreeIpa
2017-03-18 19:15:20 +01:00
```
You should now be able to use your FreeIPA credentials to log in to LibreTime.