Skip to content

Commit 75ff1c6

Browse files
authored
Update authentication docs (librenms#16996)
* Update authentication docs level -> roles remove most references to config.php settings add a couple missing settings definitions * Apply fixes from StyleCI --------- Co-authored-by: Tony Murray <[email protected]>
1 parent a96f757 commit 75ff1c6

File tree

5 files changed

+136
-91
lines changed

5 files changed

+136
-91
lines changed

LibreNMS/Authentication/HttpAuthAuthorizer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function userExists($username, $throw_exception = false)
2727
return true;
2828
}
2929

30-
if (Config::has('http_auth_guest') && parent::userExists(Config::get('http_auth_guest'))) {
30+
if (Config::get('http_auth_guest') && parent::userExists(Config::get('http_auth_guest'))) {
3131
return true;
3232
}
3333

@@ -42,7 +42,7 @@ public function getUserid($username)
4242
return $user_id;
4343
}
4444

45-
if (Config::has('http_auth_guest')) {
45+
if (Config::get('http_auth_guest')) {
4646
return parent::getUserid(Config::get('http_auth_guest'));
4747
}
4848

doc/Extensions/Authentication.md

+99-75
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ the same time.
3636
lnms config:set auth_mechanism mysql
3737
```
3838

39-
## User levels and User account type
39+
## Built-in user roles and User account type
4040

41-
- 1: **Normal User**: You will need to assign device / port
42-
permissions for users at this level.
41+
- **user**: You will need to assign device / port
42+
permissions for users in this role.
4343

44-
- 5: **Global Read**: Read only Administrator.
44+
- **global-read**: Read only Administrator.
4545

46-
- 10: **Administrator**: This is a global read/write admin account.
46+
- **admin**: This is a global read/write admin account.
4747

48-
- 11: **Demo Account**: Provides full read/write with certain
49-
restrictions (i.e can't delete devices).
48+
- **demo**: Provides full read/write with certain
49+
restrictions (i.e can't delete devices). Do not use this role.
5050

5151
**Note** Oxidized configs can often contain sensitive data. Because of
5252
that only Administrator account type can see configs.
@@ -115,9 +115,9 @@ this will ignore certificate errors.
115115

116116
If you set `auth_ad_require_groupmembership` to 1, the
117117
authenticated user has to be a member of the specific group.
118-
Otherwise all users can authenticate, and will be either level 0 or
118+
Otherwise all users can authenticate, and will have no default roles or
119119
you may set `auth_ad_global_read` to 1 and all users will
120-
have read only access unless otherwise specified.
120+
have the role 'global-read' and have read only access to all devices.
121121

122122
### Old account cleanup
123123

@@ -144,8 +144,8 @@ users won't be removed.
144144
lnms config:set auth_ad_debug false
145145
lnms config:set active_directory.users_purge 30
146146
lnms config:set auth_ad_require_groupmembership true
147-
lnms config:set auth_ad_groups.ad-admingroup.level 10
148-
lnms config:set auth_ad_groups.ad-usergroup.level 5
147+
lnms config:set auth_ad_groups.ad-admingroup.roles ["admin"]
148+
lnms config:set auth_ad_groups.ad-usergroup.roles ["global-read"]
149149
```
150150

151151
Replace `ad-admingroup` with your Active Directory admin-user group
@@ -210,9 +210,9 @@ lets say we have a prefix of `uid=`, the user `derp`, and the suffix of
210210
lnms config:set auth_ldap_server ldap.example.com
211211
lnms config:set auth_ldap_suffix ',ou=People,dc=example,dc=com'
212212
lnms config:set auth_ldap_groupbase 'ou=groups,dc=example,dc=com'
213-
lnms config:set auth_ldap_groups.admin.level 10
214-
lnms config:set auth_ldap_groups.pfy.level 5
215-
lnms config:set auth_ldap_groups.support.level 1
213+
lnms config:set auth_ldap_groups.admin.roles ["admin"]
214+
lnms config:set auth_ldap_groups.pfy.roles ["global-read"]
215+
lnms config:set auth_ldap_groups.support.roles ["user"]
216216
```
217217

218218
### Additional options (usually not needed)
@@ -273,7 +273,7 @@ An example config setup for use with Jumpcloud LDAP as a service is:
273273
lnms config:set auth_ldap_suffix ',ou=Users,o={id},dc=jumpcloud,dc=com'
274274
lnms config:set auth_ldap_groupbase 'ou=Users,o={id},dc=jumpcloud,dc=com'
275275
lnms config:set auth_ldap_groupmemberattr member
276-
lnms config:set auth_ldap_groups.{group}.level 10
276+
lnms config:set auth_ldap_groups.{group}.roles ["admin"]
277277
lnms config:set auth_ldap_userdn true
278278
```
279279

@@ -282,12 +282,12 @@ Replace {id} with the unique ID provided by Jumpcloud. Replace
282282
is case sensitive.
283283

284284
Note: If you have multiple user groups to define individual access
285-
levels replace the `auth_ldap_groups` line with the following:
285+
roles replace the `auth_ldap_groups` line with the following:
286286

287287
!!! setting "auth/ldap"
288288
```bash
289-
lnms config:set auth_ldap_groups.{admin_group}.level 10]
290-
lnms config:set auth_ldap_groups.global_readonly_group.level 5
289+
lnms config:set auth_ldap_groups.{admin_group}.roles ["admin"]
290+
lnms config:set auth_ldap_groups.{global_readonly_group}.roles ["global-read"]
291291
```
292292

293293
### SELinux configuration
@@ -301,7 +301,7 @@ setsebool -P httpd_can_connect_ldap 1
301301

302302
Please note that a mysql user is created for each user the logs in
303303
successfully. Users are assigned the `user` role by default,
304-
unless radius sends a reply attribute with a role.
304+
unless radius sends a reply attribute with a role.
305305

306306
You can change the default role(s) by setting
307307
!!! setting "auth/radius"
@@ -310,26 +310,27 @@ You can change the default role(s) by setting
310310
```
311311

312312
The attribute `Filter-ID` is a standard Radius-Reply-Attribute (string) that
313-
can be assigned a specially formatted string to assign a single role to the user.
313+
can be assigned a specially formatted string to assign a single role to the user.
314314

315315
The string to send in `Filter-ID` reply attribute must start with `librenms_role_` followed by the role name.
316316
For example to set the admin role send `librenms_role_admin`.
317317

318318
The following strings correspond to the built-in roles, but any defined role can be used:
319-
- `librenms_role_normal` - Sets the normal user level.
320-
- `librenms_role_admin` - Sets the administrator level.
321-
- `librenms_role_global-read` - Sets the global read level
319+
- `librenms_role_normal` - Sets the normal user .
320+
- `librenms_role_admin` - Sets the administrator role.
321+
- `librenms_role_global-read` - Sets the global-read role
322322

323323
LibreNMS will ignore any other strings sent in `Filter-ID` and revert to default role that is set in your config.
324324

325-
```php
326-
$config['radius']['hostname'] = 'localhost';
327-
$config['radius']['port'] = '1812';
328-
$config['radius']['secret'] = 'testing123';
329-
$config['radius']['timeout'] = 3;
330-
$config['radius']['users_purge'] = 14; // Purge users who haven't logged in for 14 days.
331-
$config['radius']['default_level'] = 1; // Set the default user level when automatically creating a user.
332-
```
325+
!!! setting "auth/radius"
326+
```bash
327+
lnms config:set radius.hostname localhost
328+
lnms config:set radius.port 1812
329+
lnms config:set radius.secret testing123
330+
lnms config:set radius.timeout 3
331+
lnms config:set radius.users_purge 14
332+
lnms config:set radius.default_roles ["admin"]
333+
```
333334

334335
### Radius Huntgroup
335336

@@ -342,27 +343,28 @@ Cleanup of old accounts is done by checking the authlog. You will need
342343
to set the number of days when old accounts will be purged
343344
AUTOMATICALLY by daily.sh.
344345

345-
Please ensure that you set the `$config['authlog_purge']` value to be
346-
greater than `$config['radius']['users_purge']` otherwise old users
346+
Please ensure that you set the `authlog_purge` value to be
347+
greater than `radius.users_purge` otherwise old users
347348
won't be removed.
348349

349350
## HTTP Authentication
350351

351352
Config option: `http-auth`
352353

353354
LibreNMS will expect the user to have authenticated via your
354-
webservice already. At this stage it will need to assign a userlevel
355+
webservice already. At this stage it will need to assign a local user
355356
for that user which is done in one of two ways:
356357

357358
- A user exists in MySQL still where the usernames match up.
358359

359360
- A global guest user (which still needs to be added into MySQL:
360361

361-
```php
362-
$config['http_auth_guest'] = "guest";
363-
```
362+
!!! setting "auth/http"
363+
```bash
364+
lnms config:set http_auth_guest guest
365+
```
364366

365-
This will then assign the userlevel for guest to all authenticated users.
367+
This will then assign the guest user to all authenticated users.
366368

367369
### HTTP Authentication / AD Authorization
368370

@@ -373,7 +375,7 @@ This module is a combination of ___http-auth___ and ___active\_directory___
373375
LibreNMS will expect the user to have authenticated via your
374376
webservice already (e.g. using Kerberos Authentication in Apache) but
375377
will use Active Directory lookups to determine and assign the
376-
userlevel of a user. The userlevel will be calculated by using AD
378+
role(s) of a user. The roles will be calculated by using AD
377379
group membership information as the ___active\_directory___ module
378380
does.
379381

@@ -387,15 +389,16 @@ Directory server(s)).
387389

388390
There is also one extra option for controlling user information caching: auth_ldap_cache_ttl.
389391
This option allows to control how long user information (user_exists,
390-
userid, userlevel) are cached within the PHP Session.
392+
userid, roles) are cached within the PHP Session.
391393
The default value is 300 seconds.
392394
To disable this caching (highly discourage) set this option to 0.
393395

394-
```php
395-
$config['auth_ad_binduser'] = "ad_binduser";
396-
$config['auth_ad_bindpassword'] = "ad_bindpassword";
397-
$config['auth_ldap_cache_ttl'] = 300;
398-
```
396+
!!! setting "auth/ad"
397+
```bash
398+
lnms config:set auth_ad_binduser ad_binduser
399+
lnms config:set auth_ad_bindpassword ad_bindpassword
400+
lnms config:set auth_ldap_cache_ttl 300
401+
```
399402

400403
### HTTP Authentication / LDAP Authorization
401404

@@ -405,54 +408,69 @@ This module is a combination of ___http-auth___ and ___ldap___
405408

406409
LibreNMS will expect the user to have authenticated via your
407410
webservice already (e.g. using Kerberos Authentication in Apache) but
408-
will use LDAP to determine and assign the userlevel of a user. The
409-
userlevel will be calculated by using LDAP group membership
411+
will use LDAP to determine and assign the role(s) of a user. The
412+
roles will be calculated by using LDAP group membership
410413
information as the ___ldap___ module does.
411414

412415
The configuration is similar to the ___ldap___ module with one extra option: auth_ldap_cache_ttl.
413-
This option allows to control how long user information (user_exists, userid, userlevel) are cached within the PHP Session.
416+
This option allows to control how long user information (user_exists, userid, roles) are cached within the PHP Session.
414417
The default value is 300 seconds.
415418
To disabled this caching (highly discourage) set this option to 0.
416419

417420
#### Standard config
418421

419-
```php
420-
$config['auth_mechanism'] = 'ldap-authorization';
421-
$config['auth_ldap_server'] = 'ldap.example.com'; // Set server(s), space separated. Prefix with ldaps:// for ssl
422-
$config['auth_ldap_suffix'] = ',ou=People,dc=example,dc=com'; // appended to usernames
423-
$config['auth_ldap_groupbase'] = 'ou=groups,dc=example,dc=com'; // all groups must be inside this
424-
$config['auth_ldap_groups']['admin']['roles'] = ['admin']; // set admin group to admin role
425-
$config['auth_ldap_groups']['pfy']['roles'] = ['global-read']; // set pfy group to global read only role
426-
$config['auth_ldap_groups']['support']['roles'] = ['user']; // set support group as a normal user
427-
```
422+
!!! setting "auth/ldap"
423+
```bash
424+
lnms config:set auth_mechanism authorization
425+
lnms config:set auth_ldap_server ldap.example.com
426+
lnms config:set auth_ldap_suffix ,ou=People,dc=example,dc=com
427+
lnms config:set auth_ldap_groupbase ou=groups,dc=example,dc=com
428+
lnms config:set auth_ldap_groups.admin.roles ["admin"]
429+
lnms config:set auth_ldap_groups.pfy.roles ["global-read"]
430+
lnms config:set auth_ldap_groups.support.roles ["user"]
431+
```
432+
433+
auth_ldap_server: set server(s), space separated. Prefix with ldaps:// for ssl
434+
auth_ldap_suffix: appended to usernames
435+
auth_ldap_groupbase: all groups must be inside this
436+
auth_ldap_groups: set roles by group name
428437

429438
#### Additional options (usually not needed)
430439

431-
```php
432-
$config['auth_ldap_version'] = 3; # v2 or v3
433-
$config['auth_ldap_port'] = 389; // 389 or 636 for ssl
434-
$config['auth_ldap_starttls'] = True; // Enable TLS on port 389
435-
$config['auth_ldap_prefix'] = 'uid='; // prepended to usernames
436-
$config['auth_ldap_group'] = 'cn=groupname,ou=groups,dc=example,dc=com'; // generic group with level 0
437-
$config['auth_ldap_groupmemberattr'] = 'memberUid'; // attribute to use to see if a user is a member of a group
438-
$config['auth_ldap_groupmembertype'] = 'username'; // username type to find group members by, either username (default), fulldn or puredn
439-
$config['auth_ldap_emailattr'] = 'mail'; // attribute for email address
440-
$config['auth_ldap_attr.uid'] = 'uid'; // attribute to check username against
441-
$config['auth_ldap_userlist_filter'] = 'service=informatique'; // Replace 'service=informatique' by your ldap filter to limit the number of responses if you have an ldap directory with thousand of users
442-
$config['auth_ldap_cache_ttl'] = 300;
443-
```
440+
!!! setting "auth/ldap"
441+
```bash
442+
lnms config:set auth_ldap_version 3
443+
lnms config:set auth_ldap_port 389
444+
lnms config:set auth_ldap_starttls true
445+
lnms config:set auth_ldap_prefix uid=
446+
lnms config:set auth_ldap_group cn=groupname,ou=groups,dc=example,dc=com
447+
lnms config:set auth_ldap_groupmemberattr memberUid
448+
lnms config:set auth_ldap_groupmembertype username
449+
lnms config:set auth_ldap_userlist_filter service=informatique
450+
lnms config:set auth_ldap_cache_ttl 300
451+
```
452+
453+
auth_ldap_port: 389 or 636 for ssl
454+
auth_ldap_prefix: prepended to usernames
455+
auth_ldap_group: generic group with no roles
456+
auth_ldap_groupmemberattr: attribute to use to see if a user is a member of a group
457+
auth_ldap_groupmembertype: username type to find group members by, either username (default), fulldn or puredn
458+
auth_ldap_userlist_filter: Replace 'service=informatique' by your ldap filter to limit the number of responses if you have an ldap directory with thousand of users
444459

445460
#### LDAP bind user (optional)
446461

447462
If your ldap server does not allow anonymous bind, it is highly
448463
suggested to create a bind user, otherwise "remember me", alerting
449464
users, and the API will not work.
450465

451-
```php
452-
$config['auth_ldap_binduser'] = 'ldapbind'; // will use auth_ldap_prefix and auth_ldap_suffix
453-
#$config['auth_ldap_binddn'] = 'CN=John.Smith,CN=Users,DC=MyDomain,DC=com'; // overrides binduser
454-
$config['auth_ldap_bindpassword'] = 'password';
455-
```
466+
!!! setting "auth/ldap"
467+
```bash
468+
lnms config:set auth_ldap_binduser ldapbind
469+
lnms config:set auth_ldap_binddn CN=John.Smith,CN=Users,DC=MyDomain,DC=com
470+
lnms config:set auth_ldap_bindpassword password
471+
```
472+
473+
auth_ldap_binddn: overrides auth_ldap_binduser with a dn
456474

457475
## View/embedded graphs without being logged into LibreNMS
458476

@@ -576,6 +594,12 @@ $config['sso']['descr_attr'] = "unscoped-affiliation
576594

577595
#### Group Strategies
578596

597+
SSO currently uses legacy levels instead of roles. Here is a map:
598+
1. user
599+
5. global-read
600+
10. admin
601+
11. demo
602+
579603
##### Static
580604

581605
As used above, ___static___ gives every single user the same privilege

html/mix-manifest.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"/css/vendor.css": "/css/vendor.css?id=d520734ded0ec75b0a572aa8db1c2161",
55
"/css/app.css": "/css/app.css?id=dcc1cfc548f711f258651833d592f7fb",
66
"/js/vendor.js": "/js/vendor.js?id=9c1ce1964559bbafd2c87384ac2f9058",
7-
"/js/lang/de.js": "/js/lang/de.js?id=f80b2c49bd4d1587d4747d189c566ffa",
8-
"/js/lang/en.js": "/js/lang/en.js?id=af40282f2c5b7a9dc50d9ee9547048cc",
9-
"/js/lang/fr.js": "/js/lang/fr.js?id=7e43fd1965beef315f0b416fd8607231",
10-
"/js/lang/it.js": "/js/lang/it.js?id=7827375adf92766a477291c48fa1b360",
11-
"/js/lang/pt-BR.js": "/js/lang/pt-BR.js?id=c6ee987c64a83b078c9bc654fc780092",
12-
"/js/lang/ru.js": "/js/lang/ru.js?id=f6b7c078755312a0907c4f983991cc52",
13-
"/js/lang/sr.js": "/js/lang/sr.js?id=388e38b41f63e35175061e849bf0d8e5",
14-
"/js/lang/uk.js": "/js/lang/uk.js?id=85ef43c7afe57a42b774f3cbae5a77e5",
15-
"/js/lang/zh-CN.js": "/js/lang/zh-CN.js?id=a178770f41a54f7b000eeb973e388936",
16-
"/js/lang/zh-TW.js": "/js/lang/zh-TW.js?id=2cf0d871ec12cbd5ccb746b983d127df"
7+
"/js/lang/de.js": "/js/lang/de.js?id=8429dcd20b839bd59b9305ec77cdb8c0",
8+
"/js/lang/en.js": "/js/lang/en.js?id=cabc306e85f656c1f660d5812180bd89",
9+
"/js/lang/fr.js": "/js/lang/fr.js?id=e893e6ab2524aef3d07e32afded97e8b",
10+
"/js/lang/it.js": "/js/lang/it.js?id=71de629d4ce5fecb212653750b37bfba",
11+
"/js/lang/pt-BR.js": "/js/lang/pt-BR.js?id=3d42629cde9f87dfa8d70b830d1c888a",
12+
"/js/lang/ru.js": "/js/lang/ru.js?id=72c8c6753f761ccd17c21e97204b8ac1",
13+
"/js/lang/sr.js": "/js/lang/sr.js?id=eac37137736d4f0fea4f4395326e7a2f",
14+
"/js/lang/uk.js": "/js/lang/uk.js?id=6bc672052e314b054242dd144d9c0815",
15+
"/js/lang/zh-CN.js": "/js/lang/zh-CN.js?id=4dfdb26b7ac232e299a66adc3f2f25bb",
16+
"/js/lang/zh-TW.js": "/js/lang/zh-TW.js?id=3e0ff8611b6f6a88ed6640b453683ea6"
1717
}

lang/en/settings.php

+9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
'ldap' => ['name' => 'LDAP Settings'],
3333
'radius' => ['name' => 'Radius Settings'],
3434
'socialite' => ['name' => 'Socialite Settings'],
35+
'http' => ['name' => 'HTTP Auth Settings'],
3536
],
3637
'authorization' => [
3738
'device-group' => ['name' => 'Device Group Settings'],
@@ -454,6 +455,10 @@
454455
'description' => 'Use full user DN',
455456
'help' => "Uses a user's full DN as the value of the member attribute in a group instead of member: username using the prefix and suffix. (it's member: uid=username,ou=groups,dc=domain,dc=com)",
456457
],
458+
'auth_ldap_userlist_filter' => [
459+
'description' => 'Custom LDAP User filter',
460+
'help' => 'Custom ldap filter to limit the number of responses if you have an ldap directory with thousand of users',
461+
],
457462
'auth_ldap_wildcard_ou' => [
458463
'description' => 'Wildcard user OU',
459464
'help' => 'Search for user matching user name independently of OU set in user suffix. Useful if your users are in different OU. Bind username, if set, still user suffix',
@@ -958,6 +963,10 @@
958963
'description' => 'Field name containing username',
959964
'help' => 'Can be a ENV or HTTP-header field like REMOTE_USER, PHP_AUTH_USER or a custom variant',
960965
],
966+
'http_auth_guest' => [
967+
'description' => 'Http Auth guest user',
968+
'help' => 'If set, allows all http users to authenticate and assigns unknown users to give local username',
969+
],
961970
'http_proxy' => [
962971
'description' => 'HTTP Proxy',
963972
'help' => 'Set this as a fallback if http_proxy environment variable is not available.',

0 commit comments

Comments
 (0)