bennet0496 / kolab_2fa
Kolab 2-Factor Authentication with Webauthn
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:roundcube-plugin
pkg:composer/bennet0496/kolab_2fa
Requires
- php: >=8.1
- ext-json: *
- ext-openssl: *
- endroid/qr-code: ~1.6.5
- enygma/yubikey: ~3.2
- ramsey/uuid: ^4.9
- roundcube/plugin-installer: >=0.1.3
- spomky-labs/otphp: ~10.0.3
- web-auth/webauthn-lib: ^5.2
Conflicts
README
The plugin is designed to be a generic container for different 2nd factor authentication mechanisms paired with different ways to store the related data for Roundcube user accounts. Both drivers and storage backends are derived from abstract classes which define the common interface and are configurable.
Forked to support Webauthn authentication.
Also added authenticator selection for High Security dialog in settings, as well as verifying login (password) before prompting for 2FA. This prevents easy user enumeration, as sending down Webauthn "allowCredentials" before proper authentication, while not security critical would be definite proof of a user's existence.
This Fork can not be used at the same time as the base version due to Class naming conflicts. However, it can be used as a drop-in replacement, as reuse of previously saved TOTP/HTOP/Yubikey tokens should just work.
Please back up your database before migrating!!!
Drivers
Multiple methods for 2nd factor authentication can be enabled for the users to select from. This implementation covers TOTP, HOTP and Yubikey methods form the original implementation as well as Webauthn.
TOTP (RFC 6238) and HOTP (RFC 4226) can be used in conjunction with freely available mobile phone apps like FreeOTP (TOTP only!) or Google Authenticator. To provision the app with your account settings, a QR code is displayed which can be scanned with the mobile phone camera.
The Yubikey driver uses the Yubico Validation Service either by using the public YubiCloud API or another locally hosted verification server. The host(s) to use for validation are configurable.
The Webauthn driver uses FIDO/U2F compliant authenticators or passkeys. Administrators may select with kind of authenticators to allow. I.e. cross-platform authenticator (like a Yubikey) or platform authenticator like Windows Hello or Touch ID. Aswell as whether user authentication (PIN entry/Biometrics) on the authenticator is required.
Storage Backends
Some authentication methods require to store secret data per user account on the server. For this, one of different storage backends can be selected:
Roundcube
The simplest way is to store authentication secrets and configuration in the user preferences of Roundcube itself.
LDAP
For an external storage option, the LDAP module can be used. This keeps the
authentication data separated from the Roundcube user database. See //LDAP Storage//
below for more information. The LDAP connection parameters are defined through the
kolab_2fa_storage_config config option. Untested with Webauthn. Also, probably
not useful for Webauthn as the "Phishing proof" nature due to cryptographic domain
validation will probably not make them useful in other applications.
Installation
After placing the plugin contents into Roundcube's plugins directory, the 3rd party libraries need to be installed using Composer:
$ composer require "endroid/qrcode" "~1.5.0" --no-update
$ composer require "spomky-labs/otphp" "~5.0.0" --no-update
$ composer require "enygma/yubikey" "~3.2"
$ composer require "web-auth/webauthn-lib" "^5.2"
See the composer.json file for the actual module names and versions.
Configuration
Copy the sample config.inc.php.dist file into config.inc.php and adjust the
settings according to your desired setup. All options are described with inline
comments directly in the sample file.
When using the LDAP storage together with a Kolab installation, you may want to save
an additional LDAP lookup for authentication factors on every login, the LDAP driver
can assign roles to the user record when registering authentication factors
(see user_roles storage config option). With the following additions to the
kolab_auth plugin config, these roles can be used to determine whether the user
has multi-factor authentication enabled:
// Disable lokkups by default:
$config['kolab_2fa_check'] = false;
// Enable 2nd factor lookup on a role-by-role basis
$config['kolab_auth_role_settings'] = array(
'cn=totp-user,dc=example,dc=org' => array(
'kolab_2fa_check' => array(
'mode' => 'override',
'value' => true,
),
),
);
LDAP Storage
Define an organizationalunit with DN ou=Tokens,dc=example,dc=org to store
all authentication tokens.
For token records, the [[https://git.fedorahosted.org/cgit/freeipa.git/tree/install/share/70ipaotp.ldif | FreeIPA OTP schema]] can be used. Please install this schema in your Kolab LDAP directory.
This is an example record for a TOTP token registered to user doe@example.org:
dn: ipatokenUniqueID=totp:c4a1ced768a0da55df662e73,ou=Tokens,dc=example,dc=org
objectClass: top
objectClass: ipaToken
objectClass: ipatokenTOTP
objectClass: ldapSubEntry
cn: Mobile App (TOTP)
ipatokenUniqueID: totp:c4a1ced768a0da55df662e73
ipatokenOwner: uid=doe,ou=People,dc=example,dc=org
ipatokenNotBefore: 201506110211Z
ipatokenOTPkey: 4T5CI7SOKWYQ5JTM
ipatokenDisabled: TRUE