Add machine-bound license activation
This commit is contained in:
1 parent
8b51081a59
commit
fcccce32b1
13 files changed
+381
-1
No files matched your search
@@ -20,3 +20,4 @@ src/Jiaowu.Api/wwwroot/
|
||||
!.env.docker.example
|
||||
certs/
|
||||
publish/
|
||||
tools/Jiaowu.LicenseTool/
|
||||
@@ -2,6 +2,8 @@
|
||||
<Folder Name="/src/">
|
||||
<Project Path="src/Jiaowu.Api/Jiaowu.Api.csproj" />
|
||||
<Project Path="src/Jiaowu.Plugin.Abstractions/Jiaowu.Plugin.Abstractions.csproj" />
|
||||
<Project Path="src/Jiaowu.Licensing/Jiaowu.Licensing.csproj" />
|
||||
<Project Path="src/Jiaowu.LicenseApi/Jiaowu.LicenseApi.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/tests/">
|
||||
<Project Path="tests/Jiaowu.Api.Tests/Jiaowu.Api.Tests.csproj" />
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# Jiaowu license activation
|
||||
|
||||
The Jiaowu application only displays its machine code and verifies activation codes. It never creates or signs a license. License codes use RSA-PSS with SHA-256; the signing private key belongs only to the offline tool or the separately hosted license API. Jiaowu receives only the public key.
|
||||
|
||||
## One-time key setup
|
||||
|
||||
Build and run the local tool:
|
||||
|
||||
```powershell
|
||||
dotnet run --project tools/Jiaowu.LicenseTool -- keygen C:\license-keys\jiaowu-private.pem C:\license-keys\jiaowu-public.pem
|
||||
```
|
||||
|
||||
Keep `jiaowu-private.pem` offline with restricted access. Copy `jiaowu-public.pem` to each Jiaowu server and configure:
|
||||
|
||||
```text
|
||||
Licensing__PublicKeyPath=C:\jiaowu\secrets\jiaowu-public.pem
|
||||
```
|
||||
|
||||
Restart Jiaowu after changing the public key. Never copy the private key to a Jiaowu application server or commit it to source control.
|
||||
|
||||
## Offline issuance
|
||||
|
||||
Open **System authorization** as a super administrator and copy the machine code. On the protected signing workstation, create a one-year code:
|
||||
|
||||
```powershell
|
||||
dotnet run --project tools/Jiaowu.LicenseTool -- issue C:\license-keys\jiaowu-private.pem JW-ABCDEF-123456-789ABC-DEF012 annual
|
||||
```
|
||||
|
||||
Use an integer number of years from 1 through 30 instead of `annual` for a custom term. Paste the resulting `J1.…` code into Jiaowu's activation page. Activation verifies its signature, expiry, and machine binding locally; no Internet connection is needed.
|
||||
|
||||
## Online license API
|
||||
|
||||
`src/Jiaowu.LicenseApi` is a separate ASP.NET Core service intended to sit behind HTTPS. Configure its private key and a long random API key in its secret store:
|
||||
|
||||
```text
|
||||
Licensing__PrivateKeyPath=/run/secrets/jiaowu-private.pem
|
||||
Licensing__ApiKey=<long-random-secret>
|
||||
```
|
||||
|
||||
The service exposes `GET /health` and `POST /api/licenses/issue`. The issue endpoint requires `X-License-Api-Key` and accepts JSON such as:
|
||||
|
||||
```json
|
||||
{"machineCode":"JW-ABCDEF-123456-789ABC-DEF012","years":1,"isAnnual":true}
|
||||
```
|
||||
|
||||
It returns a signed activation code for the supplied machine. A customer-facing portal or order system should call this endpoint from its server after checking the customer's purchase, then present the activation code for pasting into Jiaowu. Do not expose the API key in browser code. The API service can use the same public/private key pair as offline issuance, while only the public key is installed on Jiaowu.
|
||||
|
||||
For Docker or virtualized installations, set `JIAOWU_LICENSE_MACHINE_ID` to a stable deployment identifier before taking the machine code. Keep that value unchanged for the life of the installation; changing it changes the machine code and invalidates its machine binding.
|
||||
Loaded 3 of 13 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user