| 1 |
Command Line Interface (lemonldap-ng-cli) examples |
| 2 |
================================================== |
| 3 |
|
| 4 |
This page shows some examples of LL::NG Command Line Interface. See |
| 5 |
:ref:`how to use the command<configlocation-command-line-interface-cli>`. |
| 6 |
|
| 7 |
|
| 8 |
.. attention:: |
| 9 |
|
| 10 |
On Debian, the command is located in |
| 11 |
``/usr/share/lemonldap-ng/bin`` and on CentOS in |
| 12 |
``/usr/libexec/lemonldap-ng/bin``. Adapt the path for the system you are |
| 13 |
using. |
| 14 |
|
| 15 |
Save/restore configuration |
| 16 |
-------------------------- |
| 17 |
|
| 18 |
This part requires LLNG 2.0.5 at least. |
| 19 |
|
| 20 |
Save: |
| 21 |
|
| 22 |
.. code-block:: sh |
| 23 |
|
| 24 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli save >config.json |
| 25 |
|
| 26 |
Restore: |
| 27 |
|
| 28 |
.. code-block:: shell |
| 29 |
|
| 30 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli restore config.json |
| 31 |
# Or |
| 32 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli restore - <config.json |
| 33 |
|
| 34 |
Rollback (restore previous configuration, *since 2.0.8*): |
| 35 |
|
| 36 |
.. code-block:: shell |
| 37 |
|
| 38 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli rollback |
| 39 |
|
| 40 |
Configure HTTPS |
| 41 |
--------------- |
| 42 |
|
| 43 |
When setting HTTPS, you first need to modify Apache/Nginx configuration, |
| 44 |
then you must configure LL::NG to change portal URL, Handler |
| 45 |
redirections, cookie settings, ... |
| 46 |
|
| 47 |
:: |
| 48 |
|
| 49 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 50 |
set \ |
| 51 |
portal https://auth.example.com \ |
| 52 |
mailUrl https://auth.example.com/resetpwd \ |
| 53 |
registerUrl https://auth.example.com/register \ |
| 54 |
https 1 \ |
| 55 |
securedCookie 1 |
| 56 |
|
| 57 |
Configure sessions backend |
| 58 |
-------------------------- |
| 59 |
|
| 60 |
For production, it is recommended to use |
| 61 |
:doc:`Browseable session backend<browseablesessionbackend>`. Once tables |
| 62 |
are created with columns corresponding to index, the following commands |
| 63 |
can be executed to set all the session backends. |
| 64 |
|
| 65 |
In this example we have: |
| 66 |
|
| 67 |
- Backend: PgJSON |
| 68 |
- DB user: lemonldaplogin |
| 69 |
- DB password: lemonldappw |
| 70 |
- Database: lemonldapdb |
| 71 |
- Host: pg.example.com |
| 72 |
|
| 73 |
- SSO sessions: |
| 74 |
|
| 75 |
:: |
| 76 |
|
| 77 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 78 |
delKey \ |
| 79 |
globalStorageOptions Directory \ |
| 80 |
globalStorageOptions LockDirectory |
| 81 |
|
| 82 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 83 |
set \ |
| 84 |
globalStorage Apache::Session::Browseable::PgJSON |
| 85 |
|
| 86 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 87 |
addKey \ |
| 88 |
globalStorageOptions DataSource 'DBI:Pg:database=lemonldapdb;host=pg.example.com' \ |
| 89 |
globalStorageOptions UserName 'lemonldaplogin' \ |
| 90 |
globalStorageOptions Password 'lemonldappw' \ |
| 91 |
globalStorageOptions Commit 1 \ |
| 92 |
globalStorageOptions TableName 'sessions' |
| 93 |
|
| 94 |
- Persistent sessions: |
| 95 |
|
| 96 |
:: |
| 97 |
|
| 98 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 99 |
delKey \ |
| 100 |
persistentStorageOptions Directory \ |
| 101 |
persistentStorageOptions LockDirectory |
| 102 |
|
| 103 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 104 |
set \ |
| 105 |
persistentStorage Apache::Session::Browseable::PgJSON |
| 106 |
|
| 107 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 108 |
addKey \ |
| 109 |
persistentStorageOptions DataSource 'DBI:Pg:database=lemonldapdb;host=pg.example.com' \ |
| 110 |
persistentStorageOptions UserName 'lemonldaplogin' \ |
| 111 |
persistentStorageOptions Password 'lemonldappw' \ |
| 112 |
persistentStorageOptions Commit 1 \ |
| 113 |
persistentStorageOptions TableName 'psessions' |
| 114 |
|
| 115 |
- CAS sessions |
| 116 |
|
| 117 |
:: |
| 118 |
|
| 119 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 120 |
set \ |
| 121 |
casStorage Apache::Session::Browseable::PgJSON |
| 122 |
|
| 123 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 124 |
addKey \ |
| 125 |
casStorageOptions DataSource 'DBI:Pg:database=lemonldapdb;host=pg.example.com' \ |
| 126 |
casStorageOptions UserName 'lemonldaplogin' \ |
| 127 |
casStorageOptions Password 'lemonldappw' \ |
| 128 |
casStorageOptions Commit 1 \ |
| 129 |
casStorageOptions TableName 'cassessions' |
| 130 |
|
| 131 |
- SAML sessions |
| 132 |
|
| 133 |
:: |
| 134 |
|
| 135 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 136 |
set \ |
| 137 |
samlStorage Apache::Session::Browseable::PgJSON |
| 138 |
|
| 139 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 140 |
addKey \ |
| 141 |
samlStorageOptions DataSource 'DBI:Pg:database=lemonldapdb;host=pg.example.com' \ |
| 142 |
samlStorageOptions UserName 'lemonldaplogin' \ |
| 143 |
samlStorageOptions Password 'lemonldappw' \ |
| 144 |
samlStorageOptions Commit 1 \ |
| 145 |
samlStorageOptions TableName 'samlsessions' |
| 146 |
|
| 147 |
- OpenID Connect sessions |
| 148 |
|
| 149 |
:: |
| 150 |
|
| 151 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 152 |
set \ |
| 153 |
oidcStorage Apache::Session::Browseable::PgJSON |
| 154 |
|
| 155 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 156 |
addKey \ |
| 157 |
oidcStorageOptions DataSource 'DBI:Pg:database=lemonldapdb;host=pg.example.com' \ |
| 158 |
oidcStorageOptions UserName 'lemonldaplogin' \ |
| 159 |
oidcStorageOptions Password 'lemonldappw' \ |
| 160 |
oidcStorageOptions Commit 1 \ |
| 161 |
oidcStorageOptions TableName 'oidcsessions' |
| 162 |
|
| 163 |
Configure virtual host |
| 164 |
---------------------- |
| 165 |
|
| 166 |
A virtual host must be defined in Apache/Nginx and access rules and |
| 167 |
exported headers must be configured in LL::NG. |
| 168 |
|
| 169 |
In this example we have: |
| 170 |
|
| 171 |
- host: test.example.com |
| 172 |
- Access rules: |
| 173 |
|
| 174 |
- default => accept |
| 175 |
- Logout: ^/logout\.php => logout_sso |
| 176 |
|
| 177 |
- Headers: |
| 178 |
|
| 179 |
- Auth-User: $uid |
| 180 |
- Auth-Mail: $mail |
| 181 |
|
| 182 |
:: |
| 183 |
|
| 184 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 185 |
addKey \ |
| 186 |
'locationRules/test.example.com' 'default' 'accept' \ |
| 187 |
'locationRules/test.example.com' '(?#Logout)^/logout\.php' 'logout_sso' \ |
| 188 |
'exportedHeaders/test.example.com' 'Auth-User' '$uid' \ |
| 189 |
'exportedHeaders/test.example.com' 'Auth-Mail' '$mail' |
| 190 |
|
| 191 |
Configure form replay |
| 192 |
--------------------- |
| 193 |
|
| 194 |
To add form replay on a host, you need to set the caught URI and |
| 195 |
the variables to post. |
| 196 |
|
| 197 |
In this example we have: |
| 198 |
|
| 199 |
- Host: test.example.com |
| 200 |
- Caught URI: /login.php |
| 201 |
- jQuery URL: default |
| 202 |
|
| 203 |
- Variables: |
| 204 |
- login: $uid |
| 205 |
- password: $_password |
| 206 |
|
| 207 |
:: |
| 208 |
|
| 209 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 -sep , \ |
| 210 |
addKey \ |
| 211 |
post,test.example.com,'/login.php' jqueryUrl default |
| 212 |
|
| 213 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 -sep , \ |
| 214 |
addPostVars \ |
| 215 |
post,test.example.com,'/login.php' login '$uid' \ |
| 216 |
post,test.example.com,'/login.php' password '$_password' |
| 217 |
|
| 218 |
Configure LDAP authentication backend |
| 219 |
------------------------------------- |
| 220 |
|
| 221 |
In this example we use: |
| 222 |
|
| 223 |
- LDAP server: ldap://ldap.example.com |
| 224 |
- LDAP Bind DN : cn=lemonldapng,ou=dsa,dc=example,dc=com |
| 225 |
- LDAP Bind PW: changeit |
| 226 |
- LDAP search base: ou=users,dc=example,dc=com |
| 227 |
- LDAP attributes: |
| 228 |
|
| 229 |
- uid => uid |
| 230 |
- cn => cn |
| 231 |
- mail => mail |
| 232 |
- sn => sn |
| 233 |
- givenName => givenName |
| 234 |
- mobile => mobile |
| 235 |
|
| 236 |
- LDAP group base: ou=groups,dc=example,dc=com |
| 237 |
- Use recursive search for groups |
| 238 |
|
| 239 |
:: |
| 240 |
|
| 241 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 242 |
set \ |
| 243 |
authentication LDAP \ |
| 244 |
userDB LDAP \ |
| 245 |
passwordDB LDAP \ |
| 246 |
ldapServer 'ldap://ldap.example.com' \ |
| 247 |
managerDn 'cn=lemonldapng,ou=dsa,dc=example,dc=com' \ |
| 248 |
managerPassword 'changeit' \ |
| 249 |
ldapBase 'ou=users,dc=example,dc=com' |
| 250 |
|
| 251 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 252 |
addKey \ |
| 253 |
ldapExportedVars uid uid \ |
| 254 |
ldapExportedVars cn cn \ |
| 255 |
ldapExportedVars sn sn \ |
| 256 |
ldapExportedVars mobile mobile \ |
| 257 |
ldapExportedVars mail mail \ |
| 258 |
ldapExportedVars givenName givenName |
| 259 |
|
| 260 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 261 |
set \ |
| 262 |
ldapGroupBase 'ou=groups,dc=example,dc=com' \ |
| 263 |
ldapGroupObjectClass groupOfNames \ |
| 264 |
ldapGroupAttributeName member \ |
| 265 |
ldapGroupAttributeNameGroup dn \ |
| 266 |
ldapGroupAttributeNameSearch cn \ |
| 267 |
ldapGroupAttributeNameUser dn \ |
| 268 |
ldapGroupRecursive 1 |
| 269 |
|
| 270 |
Configure CAS Identity Provider |
| 271 |
------------------------------- |
| 272 |
|
| 273 |
You just have to enable the CAS server feature, and you can set the |
| 274 |
access control policy (see |
| 275 |
:ref:`CAS service options<idpcas-configuring-the-cas-service>`): |
| 276 |
|
| 277 |
:: |
| 278 |
|
| 279 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 280 |
set \ |
| 281 |
issuerDBCASActivation 1 \ |
| 282 |
casAccessControlPolicy error |
| 283 |
|
| 284 |
Register a CAS application |
| 285 |
-------------------------- |
| 286 |
|
| 287 |
This is only required if your access control policy is not ``none``. |
| 288 |
|
| 289 |
In this example we have: |
| 290 |
|
| 291 |
- App configuration key: testapp |
| 292 |
- App service URL: https://testapp.example.com/ |
| 293 |
- App exported attribute: mail and cn |
| 294 |
|
| 295 |
:: |
| 296 |
|
| 297 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 298 |
addKey \ |
| 299 |
casAppMetaDataExportedVars/testapp mail mail \ |
| 300 |
casAppMetaDataExportedVars/testapp cn cn \ |
| 301 |
casAppMetaDataOptions/testapp casAppMetaDataOptionsService 'https://testapp.example.com/' |
| 302 |
|
| 303 |
Configure SAML Identity Provider |
| 304 |
-------------------------------- |
| 305 |
|
| 306 |
You can then generate a private key and a self-signed certificate with |
| 307 |
these commands; |
| 308 |
|
| 309 |
:: |
| 310 |
|
| 311 |
openssl req -new -newkey rsa:4096 -keyout saml.key -nodes -out saml.pem -x509 -days 3650 |
| 312 |
|
| 313 |
Fix the certificate key format (you can skip this step if you are |
| 314 |
running >= 2.0.6) |
| 315 |
|
| 316 |
:: |
| 317 |
|
| 318 |
sed -e "s/END PRIVATE/END RSA PRIVATE/" \ |
| 319 |
-e "s/BEGIN PRIVATE/BEGIN RSA PRIVATE/" \ |
| 320 |
-i saml.key |
| 321 |
|
| 322 |
Import them in configuration and activate the SAML issuer |
| 323 |
|
| 324 |
:: |
| 325 |
|
| 326 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 327 |
set \ |
| 328 |
samlServicePrivateKeySig "`cat saml.key`" \ |
| 329 |
samlServicePublicKeySig "`cat saml.pem`" \ |
| 330 |
issuerDBSAMLActivation 1 |
| 331 |
|
| 332 |
You can also define organization name and URL for SAML metadata: |
| 333 |
|
| 334 |
:: |
| 335 |
|
| 336 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 337 |
set \ |
| 338 |
samlOrganizationName 'ACME' \ |
| 339 |
samlOrganizationDisplayName 'ACME Corporation' \ |
| 340 |
samlOrganizationURL 'http://www.acme.com' |
| 341 |
|
| 342 |
Register an SAML Service Provider |
| 343 |
--------------------------------- |
| 344 |
|
| 345 |
In this example we have: |
| 346 |
|
| 347 |
- SP configuration key: testsp |
| 348 |
- SP metadata file: metadata-testsp.xml |
| 349 |
- SP exported attribute: EmailAdress (filled with mail session key) |
| 350 |
|
| 351 |
:: |
| 352 |
|
| 353 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 354 |
addKey \ |
| 355 |
samlSPMetaDataXML/testsp samlSPMetaDataXML "`cat metadata-testsp.xml`" \ |
| 356 |
samlSPMetaDataExportedAttributes/testsp mail '1;EmailAddress' |
| 357 |
|
| 358 |
Configure OpenID Connect Identity Provider |
| 359 |
------------------------------------------ |
| 360 |
|
| 361 |
Activate the OpenID Connect Issuer and set issuer name (equal to portal |
| 362 |
URL): |
| 363 |
|
| 364 |
:: |
| 365 |
|
| 366 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 367 |
set \ |
| 368 |
issuerDBOpenIDConnectActivation 1 |
| 369 |
|
| 370 |
Generate keys: |
| 371 |
|
| 372 |
:: |
| 373 |
|
| 374 |
openssl genrsa -out oidc.key 4096 |
| 375 |
openssl rsa -pubout -in oidc.key -out oidc_pub.key |
| 376 |
|
| 377 |
Import them: |
| 378 |
|
| 379 |
:: |
| 380 |
|
| 381 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 382 |
set \ |
| 383 |
oidcServicePrivateKeySig "`cat oidc.key`" \ |
| 384 |
oidcServicePublicKeySig "`cat oidc_pub.key`" \ |
| 385 |
oidcServiceKeyIdSig "randomstring" |
| 386 |
|
| 387 |
If needed you can allow implicit and hybrid flows: |
| 388 |
|
| 389 |
:: |
| 390 |
|
| 391 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 392 |
set \ |
| 393 |
oidcServiceAllowImplicitFlow 1 \ |
| 394 |
oidcServiceAllowHybridFlow 1 |
| 395 |
|
| 396 |
Register an OpenID Connect Relying Party |
| 397 |
---------------------------------------- |
| 398 |
|
| 399 |
In this example we have: |
| 400 |
|
| 401 |
- RP configuration key: testrp |
| 402 |
- Client ID : testclientid |
| 403 |
- Client secret : testclientsecret |
| 404 |
- Allowed redirection URL: |
| 405 |
|
| 406 |
- For login: https://testrp.example.com/?callback=1 |
| 407 |
- For logout: https://testrp.example.com/ |
| 408 |
|
| 409 |
- Exported attributes: |
| 410 |
|
| 411 |
- email => mail |
| 412 |
- familiy_name => sn |
| 413 |
- name => cn |
| 414 |
|
| 415 |
- Exported attributes: |
| 416 |
|
| 417 |
:: |
| 418 |
|
| 419 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 420 |
addKey \ |
| 421 |
oidcRPMetaDataExportedVars/testrp email mail \ |
| 422 |
oidcRPMetaDataExportedVars/testrp family_name sn \ |
| 423 |
oidcRPMetaDataExportedVars/testrp name cn |
| 424 |
|
| 425 |
- Credentials: |
| 426 |
|
| 427 |
:: |
| 428 |
|
| 429 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 430 |
addKey \ |
| 431 |
oidcRPMetaDataOptions/testrp oidcRPMetaDataOptionsClientID testclientid \ |
| 432 |
oidcRPMetaDataOptions/testrp oidcRPMetaDataOptionsClientSecret testclientsecret |
| 433 |
|
| 434 |
- Redirection: |
| 435 |
|
| 436 |
:: |
| 437 |
|
| 438 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 439 |
addKey \ |
| 440 |
oidcRPMetaDataOptions/testrp oidcRPMetaDataOptionsRedirectUris 'https://testrp.example.com/?callback=1' \ |
| 441 |
oidcRPMetaDataOptions/testrp oidcRPMetaDataOptionsPostLogoutRedirectUris 'https://testrp.example.com/' |
| 442 |
|
| 443 |
- Signature and token expiration: |
| 444 |
|
| 445 |
:: |
| 446 |
|
| 447 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 448 |
addKey \ |
| 449 |
oidcRPMetaDataOptions/testrp oidcRPMetaDataOptionsIDTokenSignAlg RS512 \ |
| 450 |
oidcRPMetaDataOptions/testrp oidcRPMetaDataOptionsIDTokenExpiration 3600 \ |
| 451 |
oidcRPMetaDataOptions/testrp oidcRPMetaDataOptionsAccessTokenExpiration 3600 |
| 452 |
|
| 453 |
Categories and applications in menu |
| 454 |
----------------------------------- |
| 455 |
|
| 456 |
Create the category "applications": |
| 457 |
|
| 458 |
:: |
| 459 |
|
| 460 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 461 |
addKey \ |
| 462 |
applicationList/applications type category \ |
| 463 |
applicationList/applications catname Applications |
| 464 |
|
| 465 |
Create the application "sample" inside category "applications": |
| 466 |
|
| 467 |
:: |
| 468 |
|
| 469 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 470 |
addKey \ |
| 471 |
applicationList/applications/sample type application \ |
| 472 |
applicationList/applications/sample/options description "A sample application" \ |
| 473 |
applicationList/applications/sample/options display "auto" \ |
| 474 |
applicationList/applications/sample/options logo "tux.png" \ |
| 475 |
applicationList/applications/sample/options name "Sample application" \ |
| 476 |
applicationList/applications/sample/options uri "https://sample.example.com/" |
| 477 |
|
| 478 |
|
| 479 |
.. _cli-examples-encryption-key: |
| 480 |
|
| 481 |
Encryption key |
| 482 |
-------------- |
| 483 |
|
| 484 |
To update the master encryption key: |
| 485 |
|
| 486 |
:: |
| 487 |
|
| 488 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 \ |
| 489 |
set \ |
| 490 |
key 'xxxxxxxxxxxxxxx' |
| 491 |
|
| 492 |
|
| 493 |
Bulk configuration changes |
| 494 |
-------------------------- |
| 495 |
|
| 496 |
.. versionadded:: 2.0.15 |
| 497 |
|
| 498 |
The ``merge`` subcommand can be used to inject multiple configuration keys and |
| 499 |
variables at once. It reads a list of JSON or YAML formatted files and combines |
| 500 |
them with the current config. This allows you to script common configuration |
| 501 |
changes in the form of snippets. |
| 502 |
|
| 503 |
Example (JSON): |
| 504 |
|
| 505 |
.. code:: json |
| 506 |
|
| 507 |
{ |
| 508 |
"https": 1, |
| 509 |
"securedCookie": 1, |
| 510 |
"sameSite": "None", |
| 511 |
"macros": { |
| 512 |
"UA": null, |
| 513 |
"_whatToTrace": "uid" |
| 514 |
} |
| 515 |
} |
| 516 |
|
| 517 |
|
| 518 |
Example (YAML) : |
| 519 |
|
| 520 |
.. code:: yaml |
| 521 |
|
| 522 |
# YAML files can be commented |
| 523 |
https: 1 |
| 524 |
securedCookie: 1 |
| 525 |
sameSite: "None" |
| 526 |
|
| 527 |
# override some default macros |
| 528 |
macros: |
| 529 |
|
| 530 |
# Remove UA |
| 531 |
UA: ~ |
| 532 |
|
| 533 |
# Update _whatToTrace |
| 534 |
_whatToTrace: uid |
| 535 |
|
| 536 |
|
| 537 |
Importing the changes: |
| 538 |
|
| 539 |
.. code:: shell |
| 540 |
|
| 541 |
# Import a JSON snippet |
| 542 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 merge example.json |
| 543 |
|
| 544 |
# Import a YAML snippet |
| 545 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 merge example.yaml |
| 546 |
|
| 547 |
# Import several snippets |
| 548 |
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli -yes 1 merge my_config/*.yaml |
| 549 |
|
| 550 |
.. note:: You may need to install the `YAML <https://metacpan.org/pod/YAML>`__ |
| 551 |
Perl module to be able to import |
| 552 |
YAML configuration snippets |
| 553 |
|
| 554 |
.. warning:: |
| 555 |
|
| 556 |
* The config files will be read as the webserver (``apache``/``www-data``) |
| 557 |
user. Make sure they have the correct permissions before running the |
| 558 |
command |
| 559 |
* Do not use booleans in JSON/YAML files, LemonLDAP only understands 0/1 |
| 560 |
values for boolean configuration keys |
| 561 |
* Due to limitations in the Perl YAML parser, you need to set a key to ``~`` |
| 562 |
instead of ``null`` to remove it |
| 563 |
|
| 564 |
|
| 565 |
.. _cli-sessions: |
| 566 |
|
| 567 |
Sessions Management |
| 568 |
------------------- |
| 569 |
.. versionadded:: 2.0.9 |
| 570 |
|
| 571 |
|
| 572 |
Get the content of a session :: |
| 573 |
|
| 574 |
lemonldap-ng-sessions get 9684dd2a6489bf2be2fbdd799a8028e3 |
| 575 |
|
| 576 |
Get the content of a persistent session :: |
| 577 |
|
| 578 |
lemonldap-ng-sessions get --persistent dwho |
| 579 |
|
| 580 |
Search all sessions by username :: |
| 581 |
|
| 582 |
lemonldap-ng-sessions search --where uid=dwho |
| 583 |
|
| 584 |
Modify session :: |
| 585 |
|
| 586 |
lemonldap-ng-sessions setKey 9684dd2a6489bf2be2fbdd799a8028e3 \ |
| 587 |
authenticationLevel 1 |
| 588 |
|
| 589 |
|
| 590 |
.. versionadded:: 2.0.10 |
| 591 |
Delete all sessions by username |
| 592 |
|
| 593 |
:: |
| 594 |
|
| 595 |
lemonldap-ng-sessions delete --where uid=dwho |
| 596 |
|
| 597 |
|
| 598 |
Second Factors management |
| 599 |
------------------------- |
| 600 |
|
| 601 |
.. versionadded:: 2.0.9 |
| 602 |
|
| 603 |
List second factors of a user :: |
| 604 |
|
| 605 |
lemonldap-ng-sessions secondfactors get dwho |
| 606 |
|
| 607 |
Deregister Yubico OTP for a user :: |
| 608 |
|
| 609 |
lemonldap-ng-sessions secondfactors delType dwho UBK |
| 610 |
|
| 611 |
OIDC Consents management |
| 612 |
------------------------ |
| 613 |
|
| 614 |
.. versionadded:: 2.0.9 |
| 615 |
|
| 616 |
List consents of a user :: |
| 617 |
|
| 618 |
lemonldap-ng-sessions consents get dwho |
| 619 |
|
| 620 |
Revoke consents on OIDC provider 'test' for a user:: |
| 621 |
|
| 622 |
lemonldap-ng-sessions consents delete dwho test |