Skip to content

feat(licensing): quota enforcement, client rejection and trial license limits#71

Open
philippfalk wants to merge 8 commits into
mainfrom
falk/license-enforcement
Open

feat(licensing): quota enforcement, client rejection and trial license limits#71
philippfalk wants to merge 8 commits into
mainfrom
falk/license-enforcement

Conversation

@philippfalk
Copy link
Copy Markdown
Member

This PR does three separate things related to licensing:

  1. Slightly reworks the quota enforcement mechanism to detect when the feature is not licensed and to more dynamically react to system state changes (for details see commit message).
  2. Disallows client mounts when the system doesn't have a valid license and the free client mount limit is reached
  3. Allows only a single trial license per system

Tagging @iamjoemccormick for reviewing licensing related semantics and @rustybee42 for reviewing the code flow related changes around quotas and licensing.

Before this commit, the quota retrieval and distribution of exceeded
IDs would be disabled on mgmtd startup if the feature wasn't licensed.
This lead to a couple of issues with enforcement consistency:

* When a license expired while mgmtd was running, enforcement would
  continue to work but only until mgmtd restarts
* When mgmtd restarted, collection and distribution of exceeded quotas
  would be disabled, leading to other nodes enforcing based on an old
  state
* When other nodes restarted, they would still be able to initially fetch
  outdated quota states and enforce based on them.

This commit fixes all of the above by not allowing intial downloads of
quota state if the feature is not licensed and not entirely disabling
the quota distribution mechanism. If the quota feature is not licensed
nodes quota collection from the nodes will be disabled for efficiency
reasons, but nodes will still receive exceeded quota updates to allow for
online changes in license state. These updates will not contain any
information about exceeded IDs and will simply clear out the state on the
nodes so quotas will no longer be enforced.
@philippfalk philippfalk requested a review from a team as a code owner May 19, 2026 17:28
Comment thread mgmtd/src/bee_msg/common.rs Fixed
Comment thread mgmtd/src/bee_msg/common.rs Fixed
Comment thread mgmtd/src/db/node.rs Outdated
Comment thread mgmtd/src/bee_msg/register_node.rs Outdated
Comment thread mgmtd/src/bee_msg/register_node.rs Outdated
Comment thread mgmtd/src/bee_msg/common.rs Outdated
Comment thread mgmtd/src/bee_msg/common.rs Outdated
Comment thread mgmtd/src/grpc/get_license.rs Outdated
Comment thread mgmtd/src/lib.rs Outdated
Comment thread mgmtd/src/quota.rs Outdated
Comment thread mgmtd/src/quota.rs Outdated
Drop the somewhat misleading "Internal" prefix for errors during license
verification. These errors are usually caused by invalid or non-existing
license files, which isn't an "internal" problem and requires user action.
@philippfalk philippfalk requested a review from rustybee42 May 22, 2026 12:25
Comment thread mgmtd/src/bee_msg/common.rs Dismissed
Copy link
Copy Markdown
Collaborator

@rustybee42 rustybee42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found another couple of tiny and a slightly bigger structural issue

Comment thread mgmtd/src/db/config.rs Outdated
Comment thread mgmtd/src/license.rs
Comment thread mgmtd/src/lib.rs Outdated
Comment thread mgmtd/src/quota.rs Outdated
Comment thread mgmtd/src/timer.rs Outdated
Comment thread shared/src/conn/msg_dispatch.rs Outdated
@philippfalk philippfalk requested a review from rustybee42 May 27, 2026 07:41
@philippfalk philippfalk force-pushed the falk/license-enforcement branch from b1b097c to fd9f05e Compare May 27, 2026 11:03
Copy link
Copy Markdown
Collaborator

@rustybee42 rustybee42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@philippfalk philippfalk enabled auto-merge (squash) May 27, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants