| 1 |
REST configuration backend |
| 2 |
========================== |
| 3 |
|
| 4 |
You can share your configuration over the network using REST proxy |
| 5 |
system: |
| 6 |
|
| 7 |
- GET /config/latest: get the last config metadata |
| 8 |
- GET /config/<cfgNum>: get the metadata for config n° <cfgNum> |
| 9 |
- GET /config/<latest|cfgNum>/<key>: get conf key value |
| 10 |
- GET /config/<latest|cfgNum>?full=1: get the full configuration |
| 11 |
|
| 12 |
You can retrieve "human readable" error messages: |
| 13 |
|
| 14 |
- GET /error/<lang>/<errNum>: get <errNum> error reference and <lang> |
| 15 |
errors file. |
| 16 |
|
| 17 |
If no <lang> provided, 'en' errors file is returned. |
| 18 |
|
| 19 |
|
| 20 |
.. tip:: |
| 21 |
|
| 22 |
Note that REST is not a real configuration backend, but just a |
| 23 |
proxy system to access to your configuration over the network |
| 24 |
|
| 25 |
Configuration |
| 26 |
------------- |
| 27 |
|
| 28 |
First, configure your real backend |
| 29 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 30 |
|
| 31 |
- On your main server, configure a |
| 32 |
:doc:`File<fileconfbackend>`, |
| 33 |
:doc:`SQL<sqlconfbackend>` or |
| 34 |
:doc:`LDAP<ldapconfbackend>` backend |
| 35 |
- Enable REST server in the configuration using the manager (in portal |
| 36 |
plugins) |
| 37 |
- Configure your web server to allow remote access. Remote REST access |
| 38 |
is disabled by default. Change it as follow: |
| 39 |
|
| 40 |
\* In ``portal-apache2.conf``: |
| 41 |
|
| 42 |
.. code-block:: apache |
| 43 |
|
| 44 |
# REST functions for configuration access (disabled by default) |
| 45 |
<Location /index.fcgi/config> |
| 46 |
Require ip 192.168.2.0/24 |
| 47 |
</Location> |
| 48 |
|
| 49 |
\* In ``portal-nginx.conf``: |
| 50 |
|
| 51 |
.. code-block:: nginx |
| 52 |
|
| 53 |
# REST functions for configuration access (disabled by default) |
| 54 |
location /index.psgi/config { |
| 55 |
allow 192.168.2.0/24; |
| 56 |
} |
| 57 |
|
| 58 |
Next, configure REST for your remote servers |
| 59 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 60 |
|
| 61 |
Change configuration in lemonldap-ng.ini : |
| 62 |
|
| 63 |
.. code-block:: ini |
| 64 |
|
| 65 |
type = REST |
| 66 |
; Apache |
| 67 |
baseUrl = https://auth.example.com/index.fcgi/config |
| 68 |
; Nginx |
| 69 |
baseUrl = https://auth.example.com/index.psgi/config |
| 70 |
|
| 71 |
You can also add some other parameters |
| 72 |
|
| 73 |
.. code-block:: ini |
| 74 |
|
| 75 |
user = lemonldap |
| 76 |
password = mypassword |
| 77 |
realm = myrealm |
| 78 |
# LWP::UserAgent parameters |
| 79 |
lwpOpts = { timeout => 5 } |
| 80 |
lwpSslOpts = { SSL_ca_file => "..." } |
| 81 |
|
| 82 |
`user`, `password` and `realm` parameters are only used if the entry point |
| 83 |
`index.fcgi/config` is protected by a basic authentication. Thus, handlers will |
| 84 |
make requests to the portal using these parameters. `realm` is mandatory if |
| 85 |
basic authentication is used, and it must match the `auth_basic` (Nginx) or |
| 86 |
`AuthType` (Apache) setting in your web server. |