| 1 |
Events management |
| 2 |
================= |
| 3 |
|
| 4 |
LemonLDAP::NG has two kinds of events to propagate between its nodes: |
| 5 |
|
| 6 |
* configuration updates |
| 7 |
* session logout |
| 8 |
|
| 9 |
By default, events aren't really propagated but a timer permits to refresh |
| 10 |
such data. |
| 11 |
|
| 12 |
Starting from version 2.20.0, LLNG adds an **optional** :ref:`PUB/SUB system<PubSub>` |
| 13 |
*(not enabled by default)* to replace this timers. This isn't useful in classic |
| 14 |
deployments but may help big ones. |
| 15 |
|
| 16 |
Default events system |
| 17 |
--------------------- |
| 18 |
|
| 19 |
Session reload |
| 20 |
~~~~~~~~~~~~~~ |
| 21 |
|
| 22 |
The default LLNG cache system keeps in memory sessions during 10mn, sessions |
| 23 |
are automatically refreshed after this delay. |
| 24 |
|
| 25 |
Configuration reload |
| 26 |
~~~~~~~~~~~~~~~~~~~~ |
| 27 |
|
| 28 |
After configuration is saved by Manager, LemonLDAP::NG will automatically |
| 29 |
reload the configuration after a few seconds. |
| 30 |
|
| 31 |
The reload will happen next time a request is processed if more than |
| 32 |
``checkTime`` (default: 1) and ``checkMsg`` (default: 5) seconds have passed |
| 33 |
since the last check. |
| 34 |
|
| 35 |
.. _PubSub: |
| 36 |
|
| 37 |
Using a Pub/Sub system |
| 38 |
---------------------- |
| 39 |
|
| 40 |
The message broker system replaces the previous system using an external |
| 41 |
**Pub/Sub** system. |
| 42 |
|
| 43 |
When enabled, all LLNG process subscribe to ``llng_events`` channel which |
| 44 |
propagate "events": |
| 45 |
|
| 46 |
* configution update (``newConf``) |
| 47 |
* logouts (``unlog``) |
| 48 |
|
| 49 |
Such messages are read every 5 seconds, then logout and configuration updates |
| 50 |
are propagated in this delay. To modify this delay *(10 seconds for example)*, |
| 51 |
set `checkMsg=10` inside ``lemonldap-ng.ini``, section ``[all]``. |
| 52 |
|
| 53 |
To configure the event system, go into "General Parameters » Advanced parameters » Events Management" |
| 54 |
and set **Pub/Sub** system to :ref:`Redis<PubSubRedis>`, :ref:`PostgreSQL<PubSubPg>` or |
| 55 |
:ref:`MQTT<PubSubMQTT>`. |
| 56 |
|
| 57 |
Then set into "**Pub/Sub system options**" the needed options depending on the |
| 58 |
chosen system *(see below)*. |
| 59 |
|
| 60 |
.. note:: |
| 61 |
|
| 62 |
The corresponding parameter inside ``lemonldap-ng.ini`` is ``messageBroker`` |
| 63 |
which takes as value: ``::Redis`` or ``::Pg`` or ``::MQTT`` |
| 64 |
(which are abbreviations of ``Lemonldap::NG::Common::MessageBroker::<name>``). |
| 65 |
|
| 66 |
Options take place into ``messageBrokerOptions`` parameter. |
| 67 |
|
| 68 |
.. _PubSubRedis: |
| 69 |
|
| 70 |
Redis |
| 71 |
~~~~~ |
| 72 |
|
| 73 |
See `Redis`_ options, |
| 74 |
|
| 75 |
Example: |
| 76 |
|
| 77 |
.. code-block:: perl |
| 78 |
|
| 79 |
server => "redis.example.com:6379" |
| 80 |
|
| 81 |
.. _PubSubPg: |
| 82 |
|
| 83 |
PostgreSQL |
| 84 |
~~~~~~~~~~ |
| 85 |
|
| 86 |
The following parameters are needed: |
| 87 |
|
| 88 |
* ``dbiChain``: see `DBD::Pg`_ to know the syntax |
| 89 |
* ``dbiUser``: the username to use to connect |
| 90 |
* ``dbiPassword``: the password to use to connect |
| 91 |
|
| 92 |
Example: |
| 93 |
|
| 94 |
.. code-block:: perl |
| 95 |
|
| 96 |
dbiChain => "dbi:Pg:dbname=llng;host=localhost;port=5432", |
| 97 |
dbiUser => "llng", |
| 98 |
dbiPassword => "llng", |
| 99 |
|
| 100 |
.. _PubSubMQTT: |
| 101 |
|
| 102 |
MQTT |
| 103 |
~~~~ |
| 104 |
|
| 105 |
The following parameter can be set: |
| 106 |
|
| 107 |
* ``server`` *(default: ``localhost:1883``)* |
| 108 |
* ``ssl``: set to 1 if SSL is available. Remember then to install `IO::Socket::SSL`_ (`libio-socket-ssl-perl`_ on Debian). |
| 109 |
|
| 110 |
If ``ssl`` is set then these parameters are allowed: |
| 111 |
|
| 112 |
* ``user``: usernane to use for login |
| 113 |
* ``password``: password to use for login |
| 114 |
* ``SSL_ca_file``: file with certificate authorities *(PEM encoded)* |
| 115 |
* ``SSL_cert_file``: client certificate |
| 116 |
* ``SSL_key_file``: client private key |
| 117 |
|
| 118 |
If ``ssl`` is set then these environment variables can be used also: |
| 119 |
|
| 120 |
* ``MQTT_SIMPLE_SSL_INSECURE``: Set to something other than 0 to disable SSL validation |
| 121 |
* ``MQTT_SIMPLE_SSL_CA``: Path to the CA certificate or a directory of certificates. `IO::Socket::SSL`_ can find the CA path automatically on some systems. |
| 122 |
* ``MQTT_SIMPLE_SSL_CERT``: Path to the client certificate file. |
| 123 |
* ``MQTT_SIMPLE_SSL_KEY``: Path to the client private key file. |
| 124 |
|
| 125 |
.. _Redis: https://metacpan.org/pod/Redis |
| 126 |
|
| 127 |
.. _`DBD::Pg`: https://metacpan.org/pod/DBD::Pg |
| 128 |
.. _`IO::Socket::SSL`: https://metacpan.org/pod/IO::Socket::SSL |
| 129 |
.. _`libio-socket-ssl-perl`: https://packages.debian.org/stable/libio-socket-ssl-perl |
| 130 |
|
| 131 |
Web |
| 132 |
~~~ |
| 133 |
|
| 134 |
LLNG provide a light pub/sub server, named **llng-pubsub-server**, designed to be |
| 135 |
used to manage LLNG events. |
| 136 |
|
| 137 |
To use it, configure the message broker: |
| 138 |
|
| 139 |
* ``server`` *(default: ``localhost:8080``)*. To enable SSL, use ``https://server:port`` |
| 140 |
* ``token``: optional token to be set if the server requires a token |
| 141 |
|
| 142 |
You can find **llng-pubsub-server** documentation into its manpage. |