A Fabric 1.20.1 mod that enforces an official modpack whitelist on your Minecraft SMP server. Players with unauthorized mods are kicked; players without the mod time out and are kicked. All verified players are frozen until the check completes.
- When a player joins, the server sends a 32-byte random nonce.
- The client collects all loaded mod IDs + SHA-256 hashes of their JARs, signs the list with HMAC-SHA256, and sends it back.
- The server verifies the HMAC and checks every mod against
whitelist.json:- Required mods must be present with a matching hash.
- Optional mods may be absent; if present their hash must match (unless
sha256isnull). - Any unknown mod (not in either list) → kick.
- Players are frozen (cannot move or interact) during the verification window.
The HMAC key is derived from the mod's own compiled bytecode — modifying the JAR breaks the key.
- Place
fiw-mods-api-*.jarin your server'smods/folder. - Copy
whitelist.example.jsontoconfig/fiw-mods-api/whitelist.jsonand fill in your mod hashes. - Start the server. The config file is created automatically on first run if absent.
Every player must have fiw-mods-api-*.jar in their mods folder.
config/fiw-mods-api/whitelist.json — see whitelist.example.json for the format.
{
"verification": {
"timeout_seconds": 10,
"kick_message": "This is not the official modpack",
"timeout_message": "Mod verification timed out. Install the official modpack."
},
"mods": {
"required": [
{ "id": "fiw-mods-api", "sha256": "<jar-sha256>" }
],
"optional": [
{ "id": "jei", "sha256": "<jar-sha256>" },
{ "id": "essential", "sha256": null }
]
}
}sha256: null— mod is allowed regardless of version/hash (useful for runtime-loaded sub-libraries like Essential's).- Players may freely remove optional mods; only extra unknown mods trigger a kick.
sha256sum mods/*.jarOr use the included hash-mods.sh helper:
./hash-mods.sh /path/to/your/mods/folder/fiwmods reload
Requires OP level 4. No server restart needed.
| Command | Permission | Description |
|---|---|---|
/fiwmods reload |
OP 4 | Reload whitelist.json from disk |
./gradlew buildOutput: build/libs/fiw-mods-api-1.0.0.jar
Important: every build produces a new JAR with a different SHA-256. Update fiw-mods-api's hash in whitelist.json and redeploy after each rebuild.
- NeoForge 1.21.6 port (planned)