一个面向 NeoForge 的服务器端 Discord MFA(多因素认证)与账号注册桥接模组,支持代理兼容、个人 IP 封禁以及管理员维护模式。
关于 mcdsp
mcdsp 是一款专为 NeoForge 设计的服务器端安全模组(仅限专用服务器),旨在保护用户账号安全。该模组利用 Minecraft 现代化的网络配置阶段,要求用户通过 Discord 私聊(DM)直接批准登录尝试,从而阻止未授权的连接。
主要功能
- 多因素认证 (MFA): 集成到 Minecraft 的配置流程中。玩家连接时,已注册的玩家将收到一条包含“允许进入”和“拒绝进入”按钮的 Discord 私聊消息。
- 个人 IP 管理: 如果发生可疑登录,玩家可以使用“封禁 IP”按钮阻止特定 IP 访问其账号,而不会影响全局网络访问。
- 封闭白名单 / 受控注册: 可在公开注册和仅限“受信任”Discord 账号注册之间切换。
- MFA 冷却限制: 内置速率限制可防止自动化的“MFA 提示轰炸”(即疯狂发送连接请求以迫使用户响应)。
- 管理套件: 可通过斜杠命令在-game 内管理维护模式和全局 IP 封禁工具。
命令文档
玩家命令 (Discord 斜杠命令)
/register <nickname> — 将你的 Minecraft 账号绑定到你的 Discord ID。
/unregister <nickname> — 解除 Minecraft 账号的绑定。
/register-list — 列出所有绑定到你 Discord ID 的 Minecraft 账号。
/banned-ips — 显示你 personally 封禁的 IP 地址列表。
/unban-ip <ip> — 解除对你账号的指定 IP 封禁。
/kick-account <nickname> [ban_ip: true/false] — 如果检测到有人正在使用你的 Minecraft 账号,强制断开其连接,并可选择同时封禁其 IP。
员工命令(Discord 斜杠命令)
(仅限配置文件中 moderator_discord_ids 下列出的 Discord ID)
-
/mcdsp toggle — 在“所有人开放”和“仅限受信任的 Discord 用户”之间切换注册状态。
-
/mcdsp limit <value> — 设置每个 Discord 用户可以关联的最大账号数量。
-
/mcdsp timeout <秒数> — 调整 Discord 验证提示的过期计时器。
-
/mcdsp cooldown <秒数> — 配置来自同一 IP/用户的登录尝试之间的速率限制延迟。
-
/mcdsp maintenance <true/false> — 切换服务器维护模式(仅工作人员可加入)。
-
/mcdsp ipban <ip> — 全局断开与该 IP 地址的连接。
-
/mcdsp ipunban <ip> — 移除全局 IP 封禁。
-
/mcdsp iplist — 列出所有被封禁的全局 IP 地址。
安装与设置
- 将模组 jar 文件放入服务器的
mods 文件夹中。该模组仅适用于服务端,玩家无需安装。
- 运行服务器一次以生成
config/mcdsp-common.toml 配置文件。
- 通过 Discord 开发者门户 创建一个 Discord Bot。请确保启用
Guild Messages(公会消息)和 Message Content(消息内容)的 Gateway Intents。
- 获取你的 Bot Token 并将其粘贴到配置文件中(或设置环境变量
MCDSP_TOKEN)。
- 在
moderator_discord_ids 列表中添加你工作人员(Staff)的 Discord ID。
保证与限制(免责声明)
模组保证:
- 账号所有权验证: 未注册玩家会被系统性地阻止加入。已注册玩家必须通过 Discord 批准登录,才能进入游戏。
- 会话劫持防御: 即使攻击者窃取了玩家的活跃 Minecraft 会话令牌(在线或离线模式),他们也无法在无法访问受害者 Discord 私聊的情况下加入服务器。
- 代理友好型安全: 由于验证任务在标准的 Minecraft 配置阶段(握手之后)运行,只要服务器和代理设置中正确启用了 IP 转发,该模组原生支持代理设置(Velocity、BungeeCord、HAProxy)。
- 按账号隔离 IP 封禁: 玩家可以安全地屏蔽攻击者的 IP,而不会中断其他使用相同 VPN 的合法玩家的连接。
该模组无法保证的事项(局限性):
- 客户端安全:
此模组完全在服务器端运行。它无法检测或防止客户端的修改、作弊行为(如飞行、透视、自动攻击)或利用程序包。您仍需配备标准的反作弊系统。
- 针对 Discord 账户被盗的保护:
如果玩家的 Discord Token 被盗(通过 Discord 恶意软件/抓取工具),或者他们被社会工程学手段欺骗点击了“允许加入”,模组无法阻止入侵。
- 极端负载下的高性能:
存储使用的是扁平化的 JSON 文件。在玩家注册量极大或数据库庞大(数千个账号)的情况下,磁盘写入可能会成为瓶颈。建议用于中小型服务器。
- Discord API 的可用性:
如果 Discord 服务宕机或机器人因频率限制被 Discord 限流,玩家将无法完成多因素认证(MFA)提示并会超时。
A server-side Discord MFA and account registration bridge for NeoForge, featuring proxy compatibility, personal IP banning, and staff maintenance mode.
About mcdsp
mcdsp is a server-side security mod for NeoForge (DEDICATED SERVER ONLY) designed to secure user accounts. By utilizing Minecraft's modern network Configuration Phase, the mod prevents unauthorized connections by requiring users to approve login attempts directly through Discord Private Messages (DMs).
Key Features
- Multi-Factor Authentication (MFA): Integrates into the Minecraft configuration flow. Upon connecting, registered players receive a Discord DM with "Allow Entry" and "Deny Entry" buttons.
- Personal IP Management: If a suspicious login occurs, players can block that specific IP address from accessing their account using the "Ban IP" button, without affecting global network access.
- Closed Whitelist / Managed Registration: Toggle between public registration and "trusted-only" Discord registration.
- MFA Spam Cooldowns: Built-in rate limits prevent automated "MFA Prompt Bombing" (spamming connection requests to force a user response).
- Administrative Suite: In-game maintenance mode and global IP banning tools manageable via Slash Commands.
Command Documentation
Player Commands (Discord Slash Commands)
/register <nickname> — Links your Minecraft account to your Discord ID.
/unregister <nickname> — Unlinks your Minecraft account.
/register-list — Lists all Minecraft accounts registered to your Discord ID.
/banned-ips — Displays IP addresses you have personally banned from your accounts.
/unban-ip <ip> — Unbans a previously blocked IP from your accounts.
/kick-account <nickname> [ban_ip: true/false] — Forces a connection drop for your Minecraft account if someone is on it, with an option to block their IP.
Staff Commands (Discord Slash Commands)
(Restricted to Discord IDs listed in the Config under moderator_discord_ids)
/mcdsp toggle — Toggles registration between "open to everyone" and "trusted Discord users only".
/mcdsp limit <value> — Sets the maximum number of accounts a Discord user can link.
/mcdsp timeout <seconds> — Adjusts the expiration timer for Discord verification prompts.
/mcdsp cooldown <seconds> — Configures rate-limiting delays between login attempts from the same IP/User.
/mcdsp maintenance <true/false> — Toggles server maintenance mode (only staff can join).
/mcdsp ipban <ip> — Drops connections globally from this IP address.
/mcdsp ipunban <ip> — Removes a global IP ban.
/mcdsp iplist — Lists all globally banned IP addresses.
Installation & Setup
- Place the mod jar file in your server's
mods folder. It is server-side only; players do not need to install it.
- Run the server once to generate
config/mcdsp-common.toml.
- Create a Discord Bot via the Discord Developer Portal. Ensure you enable the Gateway Intents for
Guild Messages and Message Content.
- Retrieve your bot token and paste it into the configuration file (or set the environment variable
MCDSP_TOKEN).
- Populate the
moderator_discord_ids list with your staff's Discord IDs.
Guarantees & Limitations (Disclaimer)
What the Mod Guarantees:
- Account Ownership Verification: Unregistered players are systematically blocked from joining. Registered players must approve their login via Discord before they can enter the game.
- Session Hijack Defense: Even if an attacker steals a player's active Minecraft session token (online or offline mode), they cannot join the server without access to the victim's Discord DMs.
- Proxy-Friendly Security: Because verification tasks run during the standard Minecraft Configuration Phase (after the handshake), the mod natively supports proxy setups (Velocity, BungeeCord, HAProxy) out of the box, as long as IP forwarding is correctly enabled in your server and proxy settings.
- Account-Specific IP Quarantine: Players can safely block attacker IPs without interrupting the connections of other legitimate players using the same VPNs.
What the Mod Does NOT Guarantee (Limitations):
- Client-Side Security:
This mod runs entirely on the server. It does not detect or prevent client-side modifications, cheats (e.g., Fly, X-Ray, KillAura), or exploit packages. You still need a standard Anti-Cheat.
- Protection against Discord Compromise:
If a player's Discord token is stolen (via Discord malware/grabbers) or if they are tricked via social engineering into clicking "Allow Entry", the mod cannot prevent the intrusion.
- High Performance under Extreme Load:
The storage utilizes flat JSON files. Under exceptionally heavy player registration waves or large databases (thousands of accounts), disk writes may bottleneck. It is recommended for small to medium-sized servers.
- Discord API Availability:
If Discord services are down or the Bot gets rate-limited by Discord, players will not be able to complete MFA prompts and will time out.
评论 0
登录后参与评分
还没有评论,来抢沙发吧