cherubimro/roundcube-fido2 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cherubimro/roundcube-fido2

Composer 安装命令:

composer require cherubimro/roundcube-fido2

包简介

FIDO2/WebAuthn two-factor authentication for Roundcube Webmail

README 文档

README

A Roundcube Webmail plugin that adds FIDO2/WebAuthn second-factor authentication using hardware security keys.

Users log in with their password first, then verify with a security key tap as a second factor. Supports YubiKey, Feitian BioPass, SoloKeys, Google Titan, and any FIDO2-compliant authenticator.

Requirements

  • Roundcube 1.6+
  • PHP 8.1+
  • HTTPS (WebAuthn requires a secure context)
  • Composer

Installation

Via Composer (recommended)

From your Roundcube directory:

composer require cherubimro/roundcube-fido2

If the package isn't on Packagist yet, add the repository first in your Roundcube composer.json:

"repositories": [
    { "type": "vcs", "url": "https://github.com/cherubimro/roundcube-fido2" }
]

Manual installation

Copy the plugin into your Roundcube plugins/ directory as webauthn:

cd /path/to/roundcube
cp -r /path/to/roundcube-fido2 plugins/webauthn
cd plugins/webauthn
composer install --no-dev

Copy the example configuration and edit it:

cp config.inc.php.dist config.inc.php

At minimum, set the relying party ID to match your domain:

$config['webauthn_rp_id'] = 'mail.example.com';

Enable the plugin in Roundcube's config/config.inc.php:

$config['plugins'] = ['webauthn', /* other plugins */];

The database table is created automatically on first use.

Configuration

All settings go in plugins/webauthn/config.inc.php:

Setting Default Description
webauthn_2fa_policy optional off / optional / required
webauthn_rp_name Roundcube Display name shown to users during ceremonies
webauthn_rp_id auto-detect Domain name (e.g. mail.example.com). Must match the domain users access Roundcube on
webauthn_rp_origins [] Allowed origins array (e.g. ['https://mail.example.com']). Empty = auto-detect
webauthn_timeout 60000 Ceremony timeout in milliseconds
webauthn_user_verification preferred preferred / required / discouraged
webauthn_attestation none none / indirect / direct
webauthn_attachment '' '' (any) / platform / cross-platform

Policy modes

  • off - Plugin disabled entirely.
  • optional - Users choose whether to enable 2FA in Settings > Security Keys. This is the default.
  • required - All users with registered keys must pass 2FA. Users without keys are allowed through (so they can register their first key).

Usage

Registering a key

  1. Log in to Roundcube.
  2. Go to Settings > Security Keys.
  3. Click Register New Key.
  4. Enter a name (e.g. "My YubiKey 5") and tap/touch your security key when prompted.
  5. If policy is optional, toggle Enable two-factor authentication.

Logging in with 2FA

  1. Enter your username and password as usual.
  2. A verification page appears: "Please insert and tap your security key."
  3. Tap your key. On success, you are redirected to your inbox.

Managing keys

  • Register multiple keys for redundancy.
  • Delete keys from the settings page.
  • When policy is required, the last key cannot be deleted.

Database

The plugin creates a webauthn_credentials table automatically. SQL schemas for manual creation are in the SQL/ directory:

  • SQL/mysql.sql
  • SQL/postgres.sql
  • SQL/sqlite.sql

Security

  • Challenges are single-use (consumed immediately after verification).
  • CSRF protection via Roundcube's built-in request token mechanism.
  • Clone detection: signature counter must strictly increase; anomalies are logged and rejected.
  • All database queries are scoped to the authenticated user ID.
  • The 2FA gate runs on every request via the startup hook. Only the verification page, assertion endpoints, and logout are whitelisted while 2FA is pending.
  • Credential IDs are stored as raw binary and compared byte-for-byte.

Supported databases

MySQL/MariaDB, PostgreSQL, and SQLite are all supported with matching schemas.

Library

Uses lbuchs/webauthn v2.2 -- a zero-dependency PHP WebAuthn server library.

License

GPL-3.0-or-later (same as Roundcube).

cherubimro/roundcube-fido2 适用场景与选型建议

cherubimro/roundcube-fido2 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「plugin」 「yubikey」 「roundcube」 「2fa」 「FIDO2」 「webauthn」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 cherubimro/roundcube-fido2 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 cherubimro/roundcube-fido2 我们能提供哪些服务?
定制开发 / 二次开发

基于 cherubimro/roundcube-fido2 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 23
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 41
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2026-02-23