Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Track runtime build in license activation
rcourtman86244d8c13af
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 565200afe3..860f517fe3 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -491,7 +491,12 @@ profile and assignment columns, but embedded table framing must route throughcommercial-owned `portal_handoff_id`, server-resolved checkout intent, purchase-return tokens,activation-bridge form state, owned billing purchase-arrival states, ordemo-hidden commercial route policy as installer credentials,- registration state, or fleet enrollment authority. The same adjacent+ registration state, or fleet enrollment authority. The adjacent licensing+ boundary also owns public-vs-Pro runtime build attribution for activated+ installs; lifecycle and fleet surfaces may read the resulting+ entitlement/runtime-capability posture, but must not infer paid runtime+ status from agent install commands, public image tags, or local lifecycle+ inventory. The same adjacentcommercial boundary also owns purchase-start unavailability recovery:lifecycle-adjacent surfaces may coexist with that shared browser route, butthey must not strand install or fleet flows on a raw Pulse Account errordiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 92e62ecb1d..a7559bafd2 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -215,12 +215,13 @@ product API routes free of maintainer commercial analytics.38. `internal/api/licensing_bridge.go` shared with `cloud-paid`: commercial licensing bridge handlers carry both API payload contract and cloud-paid entitlement boundary ownership.39. `internal/api/licensing_handlers.go` shared with `cloud-paid`: commercial licensing handlers carry both API payload contract and cloud-paid entitlement boundary ownership.That same shared licensing boundary also owns authenticated- install-version attribution: `internal/api/router.go` must hand the- canonical process `serverVersion` into `internal/api/licensing_handlers.go`,- and the shared licensing runtime must carry that exact value through- `/v1/activate`, `/v1/licenses/exchange`, and `/v1/grants/refresh` so- migrated installs can be attributed to exact builds without inventing a- second version source or trusting browser-supplied version hints.+ install-version and runtime-build attribution: `internal/api/router.go`+ must hand the canonical process `serverVersion` and normalized runtime+ identity into `internal/api/licensing_handlers.go`, and the shared+ licensing runtime must carry those exact values through `/v1/activate`,+ `/v1/licenses/exchange`, and `/v1/grants/refresh` so migrated installs can+ be attributed to exact builds and public-vs-Pro runtime status without+ inventing a second version source or trusting browser-supplied hints.That same shared licensing boundary also owns self-hosted purchase-returnframing. `/auth/license-purchase-start` and`/auth/license-purchase-activate` may return operators only to the@@ -1218,6 +1219,11 @@ execute. Billing entitlements may still report the licensed feature set, butbrowser feature gates must use the runtime-capabilities contract for executabletruth and show the paid-runtime-required action instead of treating the licenseas inactive.+The same runtime identity must also flow to the license server during+activation, legacy exchange, and grant refresh so support/audit tooling can+differentiate a paid customer running the public community binary from one+running the private Pulse Pro runtime even when both artifacts share a version+tag.That same shared licensing contract also owns internal runtime-onlycapabilities. Release demo runtimes may use the internal `demo_fixtures`entitlement to authorize mock fixture data and `/api/system/mock-mode`diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex 41764d6987..aa450a94b2 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -117,13 +117,14 @@ cloud-specific enforcement rules.2. `frontend-modern/src/useAppRuntimeState.ts` shared with `performance-and-scalability`: the authenticated app runtime bootstrap is both a hosted commercial org-context boundary and a protected app-shell performance boundary.3. `internal/api/licensing_bridge.go` shared with `api-contracts`: commercial licensing bridge handlers carry both API payload contract and cloud-paid entitlement boundary ownership.4. `internal/api/licensing_handlers.go` shared with `api-contracts`: commercial licensing handlers carry both API payload contract and cloud-paid entitlement boundary ownership.- That same shared licensing boundary also owns installation-version- continuity for authenticated v6 installs: `internal/api/router.go` and- `internal/api/licensing_handlers.go` must hand the canonical process- version into `pkg/licensing/service.go` and `pkg/licensing/grant_refresh.go`,- and cloud-paid transport must send that value on activate, legacy exchange,- and grant refresh instead of inferring install version from browser state,- dev build metadata, or anonymous telemetry.+ That same shared licensing boundary also owns installation-version and+ runtime-build continuity for authenticated v6 installs: `internal/api/router.go`+ and `internal/api/licensing_handlers.go` must hand the canonical process+ version and runtime identity into `pkg/licensing/service.go` and+ `pkg/licensing/grant_refresh.go`, and cloud-paid transport must send those+ values on activate, legacy exchange, and grant refresh instead of inferring+ install version or paid-runtime status from browser state, dev build+ metadata, public image tags, or anonymous telemetry.5. `internal/api/payments_webhook_handlers.go` shared with `api-contracts`: commercial payment webhook handlers carry both API payload contract and cloud-paid billing boundary ownership.6. `internal/api/public_signup_handlers.go` shared with `api-contracts`: hosted signup handlers carry both API payload contract and cloud-paid hosted provisioning boundary ownership.That shared monitored-system presentation boundary also owns disableddiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex ea7516d072..1fd83843aa 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -586,7 +586,12 @@ bypass the API fail-closed execution gate.`portal_handoff_id`, server-resolved checkout intent, purchase-return tokens, activation-bridgecallbacks, owned billing purchase-arrival states, or demo-hiddencommercial route policy as recovery identity, restore proof, preview- framing, or backup/recovery-local transport. That same adjacent commercial+ framing, or backup/recovery-local transport. The adjacent licensing+ boundary also owns public-vs-Pro runtime build attribution for activated+ installs; storage and recovery surfaces may consume runtime-capability+ blocks, but must not infer paid runtime status from restore context,+ provider inventory, public image tags, or backup transport state. That same+ adjacent commercialboundary also owns the canonical self-hosted purchase intent label:storage- and recovery-adjacent surfaces may observe `self_hosted_plan`, butthey must not emit or reinterpret legacy `max_monitored_systems` intent ordiff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 098ca13606..3279531eb2 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -6099,6 +6099,17 @@ func TestContract_SelfHostedCommunityRuntimeCapabilitiesJSONSnapshot(t *testing.assertJSONSnapshot(t, got, want)}+func TestContract_LicenseHandlersPassRuntimeIdentityToActivationService(t *testing.T) {+ source, err := os.ReadFile("licensing_handlers.go")+ if err != nil {+ t.Fatalf("read licensing_handlers.go: %v", err)+ }+ text := string(source)+ if count := strings.Count(text, "SetRuntimeIdentity(h.currentRuntimeIdentity())"); count < 2 {+ t.Fatalf("expected cached and new tenant services to receive runtime identity, count=%d", count)+ }+}+func TestContract_EntitlementPayloadMonitoredSystemUsageUnavailableJSONSnapshot(t *testing.T) {payload := buildEntitlementPayloadWithUsage(&licenseStatus{Valid: true,diff --git a/internal/api/licensing_handlers.go b/internal/api/licensing_handlers.goindex 2a0e3fc4ea..db2c946581 100644--- a/internal/api/licensing_handlers.go+++ b/internal/api/licensing_handlers.go@@ -511,6 +511,7 @@ func (h *LicenseHandlers) getTenantComponents(ctx context.Context) (*licenseServif v, ok := h.services.Load(orgID); ok {svc := v.(*licenseService)svc.SetClientVersion(h.runtimeVersion)+ svc.SetRuntimeIdentity(h.currentRuntimeIdentity())if err := h.ensureEvaluatorForOrg(orgID, svc); err != nil {log.Warn().Str("org_id", orgID).Err(err).Msg("Failed to refresh license evaluator for org")}@@ -532,6 +533,7 @@ func (h *LicenseHandlers) getTenantComponents(ctx context.Context) (*licenseServservice := newLicenseService()service.SetClientVersion(h.runtimeVersion)+ service.SetRuntimeIdentity(h.currentRuntimeIdentity())// Wire license server client and persistence so activation / refresh can use them.lsClient := newLicenseServerClientFromLicensing("")diff --git a/pkg/licensing/activation_types.go b/pkg/licensing/activation_types.goindex 2810dbfcbe..2026e08e64 100644--- a/pkg/licensing/activation_types.go+++ b/pkg/licensing/activation_types.go@@ -148,19 +148,21 @@ func grantClaimsToLicenseWithContinuity(// ActivateInstallationRequest is the payload sent to POST /v1/activate.type ActivateInstallationRequest struct {- ActivationKey string `json:"activation_key"`- InstanceName string `json:"instance_name,omitempty"`- InstanceFingerprint string `json:"instance_fingerprint"`- ClientVersion string `json:"client_version,omitempty"`+ ActivationKey string `json:"activation_key"`+ InstanceName string `json:"instance_name,omitempty"`+ InstanceFingerprint string `json:"instance_fingerprint"`+ ClientVersion string `json:"client_version,omitempty"`+ Runtime *RuntimeIdentity `json:"runtime,omitempty"`}// ExchangeLegacyLicenseRequest is the payload sent to POST /v1/licenses/exchange.// It converts a legacy v5 JWT-style license into the v6 activation/grant model.type ExchangeLegacyLicenseRequest struct {- LegacyLicenseKey string `json:"-"`- InstanceName string `json:"instance_name,omitempty"`- InstanceFingerprint string `json:"instance_fingerprint"`- ClientVersion string `json:"client_version,omitempty"`+ LegacyLicenseKey string `json:"-"`+ InstanceName string `json:"instance_name,omitempty"`+ InstanceFingerprint string `json:"instance_fingerprint"`+ ClientVersion string `json:"client_version,omitempty"`+ Runtime *RuntimeIdentity `json:"runtime,omitempty"`}// MarshalJSON emits the canonical v6 contract field `legacy_license_token`.@@ -168,26 +170,29 @@ type ExchangeLegacyLicenseRequest struct {// paths that still decoded `legacy_license_key`.func (r ExchangeLegacyLicenseRequest) MarshalJSON() ([]byte, error) {type exchangeLegacyLicenseRequestWire struct {- LegacyLicenseToken string `json:"legacy_license_token"`- InstanceName string `json:"instance_name,omitempty"`- InstanceFingerprint string `json:"instance_fingerprint"`- ClientVersion string `json:"client_version,omitempty"`+ LegacyLicenseToken string `json:"legacy_license_token"`+ InstanceName string `json:"instance_name,omitempty"`+ InstanceFingerprint string `json:"instance_fingerprint"`+ ClientVersion string `json:"client_version,omitempty"`+ Runtime *RuntimeIdentity `json:"runtime,omitempty"`}return json.Marshal(exchangeLegacyLicenseRequestWire{LegacyLicenseToken: r.LegacyLicenseKey,InstanceName: r.InstanceName,InstanceFingerprint: r.InstanceFingerprint,ClientVersion: r.ClientVersion,+ Runtime: r.Runtime,})}func (r *ExchangeLegacyLicenseRequest) UnmarshalJSON(data []byte) error {type exchangeLegacyLicenseRequestWire struct {- LegacyLicenseToken string `json:"legacy_license_token"`- LegacyLicenseKey string `json:"legacy_license_key"`- InstanceName string `json:"instance_name,omitempty"`- InstanceFingerprint string `json:"instance_fingerprint"`- ClientVersion string `json:"client_version,omitempty"`+ LegacyLicenseToken string `json:"legacy_license_token"`+ LegacyLicenseKey string `json:"legacy_license_key"`+ InstanceName string `json:"instance_name,omitempty"`+ InstanceFingerprint string `json:"instance_fingerprint"`+ ClientVersion string `json:"client_version,omitempty"`+ Runtime *RuntimeIdentity `json:"runtime,omitempty"`}var wire exchangeLegacyLicenseRequestWireif err := json.Unmarshal(data, &wire); err != nil {@@ -200,6 +205,7 @@ func (r *ExchangeLegacyLicenseRequest) UnmarshalJSON(data []byte) error {r.InstanceName = wire.InstanceNamer.InstanceFingerprint = wire.InstanceFingerprintr.ClientVersion = wire.ClientVersion+ r.Runtime = wire.Runtimereturn nil}@@ -253,10 +259,11 @@ type RefreshHints struct {// RefreshGrantRequest is the payload sent to POST /v1/grants/refresh.type RefreshGrantRequest struct {- InstallationID string `json:"installation_id"`- InstanceFingerprint string `json:"instance_fingerprint"`- CurrentGrantJTI string `json:"current_grant_jti,omitempty"`- ClientVersion string `json:"client_version,omitempty"`+ InstallationID string `json:"installation_id"`+ InstanceFingerprint string `json:"instance_fingerprint"`+ CurrentGrantJTI string `json:"current_grant_jti,omitempty"`+ ClientVersion string `json:"client_version,omitempty"`+ Runtime *RuntimeIdentity `json:"runtime,omitempty"`}// RefreshGrantResponse is the payload returned from the grant refresh endpoint.diff --git a/pkg/licensing/activation_types_test.go b/pkg/licensing/activation_types_test.goindex 526089724d..c296d644c4 100644--- a/pkg/licensing/activation_types_test.go+++ b/pkg/licensing/activation_types_test.go@@ -219,6 +219,7 @@ func TestExchangeLegacyLicenseRequestJSONCompatibility(t *testing.T) {InstanceName: "pulse-node",InstanceFingerprint: "fp-123",ClientVersion: "6.0.0-rc.2",+ Runtime: CloneRuntimeIdentity(ProRuntimeIdentity()),}data, err := json.Marshal(req)@@ -236,6 +237,13 @@ func TestExchangeLegacyLicenseRequestJSONCompatibility(t *testing.T) {if _, hasLegacyKey := raw["legacy_license_key"]; hasLegacyKey {t.Fatal("legacy_license_key should not be emitted by MarshalJSON")}+ runtime, ok := raw["runtime"].(map[string]any)+ if !ok {+ t.Fatalf("runtime = %#v, want object", raw["runtime"])+ }+ if got := runtime["build"]; got != RuntimeBuildPro {+ t.Fatalf("runtime.build = %v, want %s", got, RuntimeBuildPro)+ }for _, field := range []string{"legacy_license_token", "legacy_license_key"} {t.Run("unmarshal "+field, func(t *testing.T) {@@ -244,6 +252,9 @@ func TestExchangeLegacyLicenseRequestJSONCompatibility(t *testing.T) {"instance_name": "pulse-node","instance_fingerprint": "fp-123","client_version": "6.0.0-rc.2",+ "runtime": map[string]any{+ "build": RuntimeBuildCommunity,+ },}body, err := json.Marshal(payload)if err != nil {@@ -260,6 +271,9 @@ func TestExchangeLegacyLicenseRequestJSONCompatibility(t *testing.T) {if decoded.InstanceFingerprint != "fp-123" {t.Fatalf("InstanceFingerprint = %q, want fp-123", decoded.InstanceFingerprint)}+ if decoded.Runtime == nil || decoded.Runtime.Build != RuntimeBuildCommunity {+ t.Fatalf("Runtime build = %#v, want %q", decoded.Runtime, RuntimeBuildCommunity)+ }})}}diff --git a/pkg/licensing/grant_refresh.go b/pkg/licensing/grant_refresh.goindex dbd0a16179..f87d1df5ff 100644--- a/pkg/licensing/grant_refresh.go+++ b/pkg/licensing/grant_refresh.go@@ -183,6 +183,7 @@ func (s *Service) refreshGrantOnce(ctx context.Context) error {state := s.activationStatepersistence := s.persistenceclientVersion := s.clientVersion+ runtimeIdentity := NormalizeRuntimeIdentity(s.runtimeIdentity)s.mu.RUnlock()if client == nil {@@ -197,6 +198,7 @@ func (s *Service) refreshGrantOnce(ctx context.Context) error {InstanceFingerprint: state.InstanceFingerprint,CurrentGrantJTI: state.GrantJTI,ClientVersion: clientVersion,+ Runtime: CloneRuntimeIdentity(runtimeIdentity),}resp, err := client.RefreshGrant(ctx, state.InstallationID, state.InstallationToken, req)diff --git a/pkg/licensing/grant_refresh_test.go b/pkg/licensing/grant_refresh_test.goindex fc3dffe374..29a96170cd 100644--- a/pkg/licensing/grant_refresh_test.go+++ b/pkg/licensing/grant_refresh_test.go@@ -48,6 +48,9 @@ func TestGrantRefreshLoop_RefreshesGrant(t *testing.T) {if req.ClientVersion != expectedClientVersion {t.Fatalf("ClientVersion = %q, want %q", req.ClientVersion, expectedClientVersion)}+ if req.Runtime == nil || req.Runtime.Build != RuntimeBuildCommunity {+ t.Fatalf("Runtime build = %#v, want %q", req.Runtime, RuntimeBuildCommunity)+ }json.NewEncoder(w).Encode(RefreshGrantResponse{Grant: GrantEnvelope{JWT: newGrantJWT,diff --git a/pkg/licensing/service.go b/pkg/licensing/service.goindex 18da53c501..70c4532005 100644--- a/pkg/licensing/service.go+++ b/pkg/licensing/service.go@@ -99,6 +99,11 @@ type Service struct {// Canonical runtime version supplied by the owning process. This is used for// authenticated installation/version attribution on activation and refresh.clientVersion string++ // Canonical runtime build supplied by the owning process. This is separate+ // from version so support can distinguish public/community binaries from+ // private Pulse Pro binaries even when they share a release tag.+ runtimeIdentity RuntimeIdentity}// DefaultGracePeriod is the duration after license expiration during which@@ -108,7 +113,8 @@ const DefaultGracePeriod = 7 * 24 * time.Hour// NewService creates a new license service.func NewService() *Service {return &Service{- gracePeriod: DefaultGracePeriod,+ gracePeriod: DefaultGracePeriod,+ runtimeIdentity: CommunityRuntimeIdentity(),}}@@ -235,6 +241,7 @@ func (s *Service) ActivateWithKey(activationKey string) (*License, error) {client := s.serverClientpersistence := s.persistenceclientVersion := s.clientVersion+ runtimeIdentity := NormalizeRuntimeIdentity(s.runtimeIdentity)s.mu.RUnlock()if client == nil {@@ -253,6 +260,7 @@ func (s *Service) ActivateWithKey(activationKey string) (*License, error) {InstanceFingerprint: fingerprint,InstanceName: hostname,ClientVersion: clientVersion,+ Runtime: CloneRuntimeIdentity(runtimeIdentity),}ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)@@ -272,6 +280,7 @@ func (s *Service) ActivateLegacyLicense(legacyLicenseKey string) (*License, erroclient := s.serverClientpersistence := s.persistenceclientVersion := s.clientVersion+ runtimeIdentity := NormalizeRuntimeIdentity(s.runtimeIdentity)s.mu.RUnlock()if client == nil {@@ -289,6 +298,7 @@ func (s *Service) ActivateLegacyLicense(legacyLicenseKey string) (*License, erroInstanceFingerprint: fingerprint,InstanceName: hostname,ClientVersion: clientVersion,+ Runtime: CloneRuntimeIdentity(runtimeIdentity),}ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)@@ -399,6 +409,14 @@ func (s *Service) SetClientVersion(version string) {s.clientVersion = strings.TrimSpace(version)}+// SetRuntimeIdentity records the canonical runtime build for authenticated+// installation attribution on activation and grant refresh.+func (s *Service) SetRuntimeIdentity(identity RuntimeIdentity) {+ s.mu.Lock()+ defer s.mu.Unlock()+ s.runtimeIdentity = NormalizeRuntimeIdentity(identity)+}+// SetPersistence sets the persistence reference for activation state save/load.func (s *Service) SetPersistence(p *Persistence) {s.mu.Lock()diff --git a/pkg/licensing/service_activate_test.go b/pkg/licensing/service_activate_test.goindex bfbc7499c0..dc2be06d0a 100644--- a/pkg/licensing/service_activate_test.go+++ b/pkg/licensing/service_activate_test.go@@ -58,6 +58,9 @@ func TestServiceActivate_ExchangesLegacyJWTOutsideDevMode(t *testing.T) {if req.ClientVersion != expectedClientVersion {t.Fatalf("ClientVersion = %q, want %q", req.ClientVersion, expectedClientVersion)}+ if req.Runtime == nil || req.Runtime.Build != RuntimeBuildPro {+ t.Fatalf("Runtime build = %#v, want %q", req.Runtime, RuntimeBuildPro)+ }w.WriteHeader(http.StatusCreated)_ = json.NewEncoder(w).Encode(ActivateInstallationResponse{@@ -82,6 +85,7 @@ func TestServiceActivate_ExchangesLegacyJWTOutsideDevMode(t *testing.T) {svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))svc.SetClientVersion(expectedClientVersion)+ svc.SetRuntimeIdentity(ProRuntimeIdentity())lic, err := svc.Activate(licenseKey)if err != nil {@@ -140,6 +144,9 @@ func TestServiceActivateWithKey_SendsClientVersion(t *testing.T) {if req.ClientVersion != expectedClientVersion {t.Fatalf("ClientVersion = %q, want %q", req.ClientVersion, expectedClientVersion)}+ if req.Runtime == nil || req.Runtime.Build != RuntimeBuildPro {+ t.Fatalf("Runtime build = %#v, want %q", req.Runtime, RuntimeBuildPro)+ }w.WriteHeader(http.StatusCreated)_ = json.NewEncoder(w).Encode(ActivateInstallationResponse{@@ -165,6 +172,7 @@ func TestServiceActivateWithKey_SendsClientVersion(t *testing.T) {svc := NewService()svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))svc.SetClientVersion(expectedClientVersion)+ svc.SetRuntimeIdentity(ProRuntimeIdentity())if _, err := svc.Activate("ppk_live_native_test"); err != nil {t.Fatalf("Activate: %v", err)