EZDOC License Server
Manages and validates node-locked EZDOC licenses over HTTP. License
signatures are computed inside a sandboxed WebAssembly module
(license_sig.wat) — the mixing algorithm never exists in plain
Python, and the module runs identically on any machine with a WASM
runtime.
Runtime note: the server was specified for wasmer. The
wasmerPython bindings publish no Windows native runtime (import fails on Windows), so the engine auto-detects its backend: wasmer wherever its Python runtime works (Linux server deployments), wasmtime everywhere else (including Windows), and pywasm (pure Python) inside Wasmer Edge's WASI runtime. All three execute the same signature module with identical results; the backend is selected in one place (wasm_license.py).The Wasmer CLI also executes the WASI engine directly on Windows and Linux:
wat2wasm license_sig_wasi.wat -o license_sig_wasi.wasm wasmer run license_sig_wasi.wasmIt speaks a line protocol on stdin/stdout (
M a b,D expiry m1 m2,X expiry now,Q). Verified on Wasmer v7.5.0 and v4.3.7 byinstaller\test_wasmer_final.py.
Run
pip install wasmtime
python license_server.py [--host 0.0.0.0] [--port 8765]
[--store licenses.db] [--admin-token TOKEN]
[--admin-user USER] [--admin-password PASSWORD]
The link clients use is http://<host>:<port> — for example
http://10.68.70.25:8765. Store it in EZDOC under
%APPDATA%\EZDOC\config.json → license_server_url (see
app\license_server_client.py). The admin token is set with
EZDOC_ADMIN_TOKEN / --admin-token; only an auto-generated token is
printed at startup, so a supplied token never leaks into shared logs. Web
login accounts are seeded once from EZDOC_ADMIN_USERNAME /
EZDOC_ADMIN_PASSWORD and then managed from /admin (or the CLI).
EZDOC app integration
EZDOC uses https://ebislic.wasmer.app by default (when
license_server_url is absent from config), and calls /activate on
import and /validate on every startup. The server is authoritative:
a revoked, expired, or differently-bound key is rejected immediately even
if a local license file exists. Every key is issued with a UNIQUE
machine ID generated by the server (MID-XXXXXXXX); the encrypted .ezlic
file carries it, the app stores it on the customer's computer inside the
encrypted license.dat, and every validation sends that stored ID back
so the server can enforce the binding. The URL can be
changed in the app under
General Settings → License Server URL. Leave it blank to disable server
checks and keep the old offline signed-key workflow.
Server-issued keys (EZSRV-…) may run offline for up to 7 days after the
last successful online check; after that the app refuses to start until the
server is reachable again. Offline/generator keys (EZDOC-…) keep their
existing signed-key fallback when the server is unreachable or does not know
the key. HTTPS uses certifi's refreshed CA bundle when available, which
avoids certificate errors on older bundled Python runtimes.
Wasmer Edge deployment
The live server is deployed as app ebis/ebislic:
https://ebislic.wasmer.app
edge_deploy/ contains the Edge package. app.yaml enables
capabilities.database with the postgres engine, so Wasmer provisions a
managed PostgreSQL database and injects DB_HOST / DB_PORT / DB_NAME /
DB_USERNAME / DB_PASSWORD. The server automatically uses that database;
local SQLite is only a fallback for non-Wasmer/self-hosted installs. The
/data volume is still mounted so the previous licenses.db can be migrated
once on first Postgres start; afterwards it is renamed to
licenses.db.migrated. single_concurrency keeps writes serialized through
one process. Credentials are stored as Wasmer app secrets and are not
present in source, wasmer.toml, or MSI files:
EZDOC_ADMIN_TOKEN– CLI/API token (not needed by the web login form)EZDOC_ADMIN_USERNAME– web login username (defaultadmin)EZDOC_ADMIN_PASSWORD– web login password
Manage them without printing secret values:
wasmer app secret reveal EZDOC_ADMIN_TOKEN --app ebis/ebislic
wasmer app secret update EZDOC_ADMIN_TOKEN <new-token> --app ebis/ebislic --redeploy
wasmer app secret update EZDOC_ADMIN_USERNAME <new-user> --app ebis/ebislic --redeploy
wasmer app secret update EZDOC_ADMIN_PASSWORD <new-password> --app ebis/ebislic --redeploy
Redeploy after source changes:
wasmer deploy --dir edge_deploy --non-interactive
Managing license keys
Two tools are provided:
Web admin page
Open /admin (live: https://ebislic.wasmer.app/admin). Sign in with
the username and password configured in the EZDOC_ADMIN_USERNAME and
EZDOC_ADMIN_PASSWORD secrets (or any account created later). Each function
has its own page, reached from the sidebar:
- All keys - license totals, search/filter, CSV export, bulk actions, and
per-row detail, edit, and
.ezlicdownload buttons. - Add license - create one or more node-locked keys and download the
encrypted
.ezlicfile for each new key, or export an existing key by entering it. The.ezlicfile is imported in EZDOC under Help > License Information > Import License File. - Check a key - validate or activate a key against a machine ID.
- Detail and Edit / renew - full stored record, renew, rebind, clear the binding, or delete.
- Users and Audit log - admins only.
Admins can issue / edit / renew / rebind / deactivate / revoke / delete keys,
export the filtered list to CSV, download an encrypted .ezlic file for any
non-revoked key, review the audit log, and manage users. Viewers can view and
check keys but cannot change them, export license files, or read the audit
log.
Managing web users
The Users page (admins only) lists accounts and lets you add a user,
change a password, toggle a role (admin / viewer), or delete a user.
Passwords are stored only as salted PBKDF2-HMAC-SHA256 hashes in the server's
managed Postgres database (SQLite for local installs); the last admin cannot
be demoted or deleted. The password
is never stored in the page or sent anywhere except the /admin/login or
user-update request; the resulting session token stays only in that browser
tab's sessionStorage and expires after 12 hours. No credential is embedded in
the page or written to server logs.
CLI manager
license_manager.py wraps the same API. Keep the token in the environment
so it never enters shell history:
set EZDOC_ADMIN_TOKEN=<your-token>
set EZDOC_LICENSE_SERVER_URL=https://ebislic.wasmer.app
python license_manager.py health
python license_manager.py issue --expiry 20991231 --count 5 --note "Customer A"
python license_manager.py list
python license_manager.py validate --key EZSRV-... --machine MACHINE-001
python license_manager.py activate --key EZSRV-... --machine MACHINE-001
python license_manager.py deactivate --key EZSRV-... --machine MACHINE-001
python license_manager.py revoke --key EZSRV-...
python license_manager.py export --key EZSRV-... --out license.ezlic
python license_manager.py audit --limit 50
python license_manager.py users
python license_manager.py user-add --username alice --role admin
python license_manager.py user-update --username alice --ask-password --role viewer
python license_manager.py user-del --username alice
All commands print JSON. --url, --token, and --timeout can also be
passed explicitly. Admin commands fail with exit code 2 when no token is
configured.
API
| Method | Path | Auth | Body | Purpose |
|---|---|---|---|---|
| GET | /health | – | – | liveness |
| GET | /admin | – | – | web license manager (username/password login) |
| POST | /admin/login | – | {username, password} | exchange web credentials for a session token |
| POST | /admin/logout | user | – | invalidate the current session |
| GET | /session | user | – | current username + role |
| POST | /issue | admin | {expiry "YYYYMMDD", machine_id?, count?, note?} | issue license(s) (WASM-signed) |
| POST | /activate | – | {key, machine_id?} | bind + activate; keys are bound at issue time (server-generated machine ID) |
| POST | /validate | – | {key, machine_id} | validate (WASM signature + expiry + revocation + binding) |
| POST | /deactivate | – | {key, machine_id} | free the machine binding |
| POST | /revoke | admin | {key} | revoke a license |
| POST | /license/update | admin | {key, expiry?, note?, machine_id?} | renew / edit / rebind a key |
| POST | /license/delete | admin | {key} | permanently delete a key |
| GET | /licenses | user | – | list every license (full detail) |
| GET | /license/export | admin | ?key=... | download encrypted .ezlic file |
| GET | /audit | admin | ?limit=200 | recent security audit events |
| GET | /users | admin | – | list web users (no hashes) |
| POST | /users/create | admin | {username, password, role?} | add a web user |
| POST | /users/update | admin | {username, password?, role?} | change a user's password/role |
| POST | /users/delete | admin | {username} | delete a web user |
Responses are JSON; {ok: true/false, ...} with a reason on failure.
Admin endpoints accept either the X-Admin-Token header (CLI) or a session
token from /admin/login in the same header. user endpoints accept either
of those; admin endpoints additionally require role admin (the CLI token
is always a full admin).
Security
- Security headers (
Content-Security-Policy,X-Frame-Options: DENY,X-Content-Type-Options: nosniff, HSTS,Cache-Control: no-store) and no Python version banner. - JSON bodies larger than 64 KB are rejected with HTTP 413.
- Web usernames/passwords must be at least 8 characters; repeated failed logins trigger a 15-minute lockout (HTTP 429).
- Sessions expire after 2 hours idle / 12 hours absolute and are revoked when a password or role changes.
- Security-relevant events (sign-in, issue/revoke/export, user/role changes) are written to the audit log; secrets and tokens are never logged.
Behavior
- Node-locked, unique machine IDs: every issued license carries a
WASM-computed signature bound to a machine ID that the SERVER
generates at issue time - crypto-grade random and unique (the
database is checked on every draw, so the same machine ID is never
issued twice). The encrypted
.ezlicfile carries the machine ID; on import the app verifies it with the server and stores it ENCRYPTED on the customer's computer (license.dat), re-sending it on every validation. Admins may still bind a specific machine ID explicitly (admin "bind now", CLI), and "Clear machine binding" releases a key for re-binding. - Expiry is checked inside the WASM module.
- Revocation takes effect immediately on every subsequent validate/activate.
- Persistence: Wasmer-managed PostgreSQL when
capabilities.databaseis enabled (the server auto-detectsDB_*env vars), otherwise local SQLite (licenses.dbby default). Licenses and web user accounts (salted password hashes only) survive redeploys. Existinglicenses.dbdata is imported once into Postgres and renamed tolicenses.db.migrated; a legacy JSON store is imported and renamed tolicenses.json.migrated. No live data is kept in JSON.
Files
license_server.py- HTTP server + management API +/adminadmin_ui.py- embedded web admin page (no external assets)license_manager.py- CLI manager for issue/list/validate/revokelicense_sig.wat- the WebAssembly signature module (source of truth)wasm_license.py- WASM runtime wrapper (wasmer / wasmtime / pywasm)test_wasm_sig.py- engine unit tests../installer/test_license_server.py- end-to-end API tests../installer/test_license_admin.py- web admin + CLI tests../installer/test_license_db.py- SQLite persistence + JSON/backend migration tests../installer/test_license_app_server.py- app validation logic (mocked server)../installer/test_license_app_server_e2e.py- app + real server E2E