2021-07-10 03:36:08 +08:00
|
|
|
# Two-Factor Authentication
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
Over the last couple of years, the primary attack vector for internet
|
|
|
|
accounts has been static passwords. Therefore static passwords are no
|
|
|
|
longer sufficient to protect unauthorized access to accounts. Two
|
|
|
|
Factor Authentication adds a variable part in authentication
|
|
|
|
procedures. A user is now required to supply a changing 6-digit
|
2021-07-10 03:36:08 +08:00
|
|
|
passcode in addition to their password to obtain access to the account.
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
LibreNMS has a RFC4226 conformant implementation of both Time and Counter
|
2019-09-09 05:48:35 -05:00
|
|
|
based One-Time-Passwords. It also allows the administrator to
|
|
|
|
configure a throttle time to enforce after 3 failures exceeded. Unlike
|
2021-07-10 03:36:08 +08:00
|
|
|
RFC4226 suggestions, this throttle time will not stack on the amount of
|
|
|
|
failures.
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
## Types
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2016-01-30 21:06:58 -05:00
|
|
|
In general, these two types do not differ in algorithmic terms.
|
|
|
|
The types only differ in the variable being used to derive the passcodes from.
|
2019-09-09 05:48:35 -05:00
|
|
|
The underlying HMAC-SHA1 remains the same for both types, security
|
|
|
|
advantages or disadvantages of each are discussed further down.
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
### Timebased One-Time-Password (TOTP)
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
Like the name suggests, this type uses the current Time or a subset of
|
|
|
|
it to generate the passcodes. These passcodes solely rely on the
|
|
|
|
secrecy of their Secretkey in order to provide passcodes. An attacker
|
|
|
|
only needs to guess that Secretkey and the other variable part is any
|
|
|
|
given time, presumably the time upon login. RFC4226 suggests a
|
|
|
|
resynchronization attempt in case the passcode mismatches, providing
|
|
|
|
the attacker a range of up to +/- 3 Minutes to create passcodes.
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
### Counterbased One-Time-Password (HOTP)
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
This type uses an internal counter that needs to be in sync with the
|
|
|
|
server's counter to successfully authenticate the passcodes. The main
|
|
|
|
advantage over timebased OTP is the attacker doesn't only need to know
|
|
|
|
the Secretkey but also the server's Counter in order to create valid
|
|
|
|
passcodes. RFC4226 suggests a resynchronization attempt in case the
|
|
|
|
passcode mismatches, providing the attacker a range of up to +4
|
|
|
|
increments from the actual counter to create passcodes.
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
## Configuration
|
|
|
|
|
|
|
|
### WebUI
|
|
|
|
|
|
|
|
Enable 'Two-Factor' Via Global Settings in the Web UI under
|
|
|
|
Authentication -> General Authentication Settings.
|
|
|
|
|
|
|
|
Optionally enter a throttle timer in seconds. This will unlock an account
|
|
|
|
after this time once it has failed 3 attempt to authenticate. Set to 0 (default)
|
|
|
|
to disable this feature, meaning accounts will remain locked after 3 attempts
|
|
|
|
and will need an administrator to clear.
|
|
|
|
|
|
|
|
### CLI
|
2014-12-24 21:22:02 +00:00
|
|
|
|
|
|
|
Enable Two-Factor:
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
`./lnms config:set twofactor true`
|
|
|
|
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2016-01-07 23:02:18 +01:00
|
|
|
Set throttle-time (in seconds):
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
`./lnms config:set twofactor_lock 300`
|
|
|
|
|
|
|
|
## User Administation
|
|
|
|
|
|
|
|
If Two-Factor is enabled, the Settings -> Manage Users grid will show a '2FA' column
|
|
|
|
containing a green tick for users with active 2FA.
|
|
|
|
|
|
|
|
There is no functionality to mandate 2FA for users.
|
|
|
|
|
|
|
|
If a user has failed 3 attempts, their account can be unlocked or 2FA disabled by
|
|
|
|
editing the user from the Manage Users table.
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
If a throttle timer is set, it will unlock accounts after this time. If set to the
|
|
|
|
default of 0, accounts will need to be manually unlocked by an administrator after 3
|
|
|
|
failed attempts.
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
Locked accounts will report to the user stating to wait for the throttle time period,
|
|
|
|
or to contact the administrator if no timer set.
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
## End-User Enrolment
|
|
|
|
|
|
|
|
These steps imply that Two-Factor has been enabled system wide as above under Configuration.
|
|
|
|
|
|
|
|
2FA is enabled by each user once they are logged in normally:
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2014-12-24 21:22:02 +00:00
|
|
|
- Go to 'My Settings' (/preferences/)
|
|
|
|
- Choose TwoFactor type
|
|
|
|
- Click on 'Generate TwoFactor Secret Key'
|
2016-01-07 23:02:18 +01:00
|
|
|
- If your browser didn't reload, reload manually
|
2014-12-24 21:22:02 +00:00
|
|
|
- Scan provided QR or click on 'Manual' to see the Key
|
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
### Google Authenticator
|
2014-12-24 21:22:02 +00:00
|
|
|
|
2016-01-07 23:02:18 +01:00
|
|
|
Installation guides for Google Authenticator can be found [here](https://support.google.com/accounts/answer/1066447?hl=en).
|
2014-12-24 21:22:02 +00:00
|
|
|
|
|
|
|
Usage:
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2021-07-10 03:36:08 +08:00
|
|
|
- Create a key as described above
|
|
|
|
- Scan provided QR or click on 'Manual' and enter the Secret
|
|
|
|
- On next login, enter the passcode that the App provides
|
|
|
|
|
|
|
|
### LastPass Authenticator
|
|
|
|
|
|
|
|
LastPass Authenticator is confirmed to work with Timebased One-Time Passwords (TOTP).
|
|
|
|
|
|
|
|
Installation guide for LastPass Authenticator can be found [here](https://support.logmeininc.com/lastpass/help/lastpass-authenticator-lp030014).
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
- Create a Timerbased key as described above
|
|
|
|
- Click Add (+) and scan provided QR or click on 'NO QR CODE?' and enter naming details and the Secret
|
2014-12-24 21:22:02 +00:00
|
|
|
- On next login, enter the passcode that the App provides
|