Page MenuHomePhorge

D5118.1775323244.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D5118.1775323244.diff

diff --git a/plugins/kolab_2fa/config.inc.php.dist b/plugins/kolab_2fa/config.inc.php.dist
--- a/plugins/kolab_2fa/config.inc.php.dist
+++ b/plugins/kolab_2fa/config.inc.php.dist
@@ -101,6 +101,10 @@
// timeout for 2nd factor auth submission (in seconds)
$config['kolab_2fa_timeout'] = 120;
+// Length of the secret string (in characters). Minimum and default is 16.
+// Note: Some OTP clients may consider too short secret as insecure.
+$config['kolab_2fa_secret_length'] = 16;
+
// configuration parameters for TOTP (uncomment to adjust)
$config['kolab_2fa_totp'] = [
// 'digits' => 6,
diff --git a/plugins/kolab_2fa/lib/Kolab2FA/Driver/Base.php b/plugins/kolab_2fa/lib/Kolab2FA/Driver/Base.php
--- a/plugins/kolab_2fa/lib/Kolab2FA/Driver/Base.php
+++ b/plugins/kolab_2fa/lib/Kolab2FA/Driver/Base.php
@@ -183,8 +183,16 @@
/**
* Generate a random secret string
*/
- public function generate_secret($length = 16)
+ public function generate_secret()
{
+ if (class_exists('\\rcmail', false)) {
+ $length = \rcmail::get_instance()->config->get('kolab_2fa_secret_length');
+ }
+
+ if (empty($length) || $length < 16) {
+ $length = 16;
+ }
+
// Base32 characters
$chars = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 7
diff --git a/plugins/kolab_2fa/lib/Kolab2FA/Log/RcubeLogger.php b/plugins/kolab_2fa/lib/Kolab2FA/Log/RcubeLogger.php
--- a/plugins/kolab_2fa/lib/Kolab2FA/Log/RcubeLogger.php
+++ b/plugins/kolab_2fa/lib/Kolab2FA/Log/RcubeLogger.php
@@ -28,8 +28,8 @@
class RcubeLogger implements Logger
{
- protected $name = null;
- protected $level = LOG_DEBUG;
+ protected $name = '2fa';
+ protected $level = LOG_INFO;
public function __construct($name = null)
{

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 4, 5:20 PM (5 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18830543
Default Alt Text
D5118.1775323244.diff (1 KB)

Event Timeline