[PR #700] [MERGED] Feat rego default policy #12890

Closed
opened 2026-08-05 02:06:55 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/700
Author: @gigovich
Created: 2/21/2023
Status: Merged
Merged: 3/13/2023
Merged by: @gigovich

Base: mainHead: feat-rego-default-policy


📝 Commits (10+)

  • c86cf8a Add Rego default policy processing to handle rules
  • 4ea6e26 Add default Rego policy
  • cc32dd2 Create correct Rego package and query to filter peers by rules
  • 3514cff Use policy as rule replacement.
  • bec3805 Add account manager CRUD methods and start implement server handlers.
  • 4091244 Add API declarations. Improve policies.
  • 9f5d2f2 Finish handlers for policies processing.
  • 14e9909 Fix account mocks
  • e476f20 Add migration from Rules to new policies in account loading.
  • eb1dda7 Test for file store. Broken tests in management.

📊 Changes

25 files changed (+1714 additions, -864 deletions)

View changed files

📝 go.mod (+18 -9)
📝 go.sum (+52 -37)
📝 management/server/account.go (+29 -54)
📝 management/server/account_test.go (+46 -102)
📝 management/server/activity/codes.go (+27 -3)
📝 management/server/file_store.go (+19 -5)
📝 management/server/file_store_test.go (+41 -6)
📝 management/server/group.go (+10 -13)
📝 management/server/http/api/openapi.yml (+180 -15)
📝 management/server/http/api/types.gen.go (+87 -41)
📝 management/server/http/handler.go (+10 -1)
management/server/http/policies.go (+326 -0)
📝 management/server/http/rules_handler.go (+37 -163)
📝 management/server/http/rules_handler_test.go (+31 -77)
📝 management/server/management_test.go (+3 -1)
📝 management/server/mock_server/account_mock.go (+38 -10)
📝 management/server/peer.go (+8 -74)
📝 management/server/peer_test.go (+28 -26)
management/server/policy.go (+451 -0)
management/server/policy_test.go (+67 -0)

...and 5 more files

📄 Description

Describe your changes

Convert rules to Rego policies and allow users to write raw policies to set up connectivity and firewall on the clients.
This PR also has related changes in the dashboard. Please consider it together with https://github.com/netbirdio/dashboard/pull/147

NB-215

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/700 **Author:** [@gigovich](https://github.com/gigovich) **Created:** 2/21/2023 **Status:** ✅ Merged **Merged:** 3/13/2023 **Merged by:** [@gigovich](https://github.com/gigovich) **Base:** `main` ← **Head:** `feat-rego-default-policy` --- ### 📝 Commits (10+) - [`c86cf8a`](https://github.com/netbirdio/netbird/commit/c86cf8ae69079f4391da56accac3d875bbf1b6f7) Add Rego default policy processing to handle rules - [`4ea6e26`](https://github.com/netbirdio/netbird/commit/4ea6e2667c7b9a2fea60e81f7f091549b28ec923) Add default Rego policy - [`cc32dd2`](https://github.com/netbirdio/netbird/commit/cc32dd2f1a4f54ce7e4b81e1af9644c3ca9bcb3a) Create correct Rego package and query to filter peers by rules - [`3514cff`](https://github.com/netbirdio/netbird/commit/3514cff094a62856b9cfa50769ea805671a18b55) Use policy as rule replacement. - [`bec3805`](https://github.com/netbirdio/netbird/commit/bec38054a71a94e3e4427feda333423b32fde97e) Add account manager CRUD methods and start implement server handlers. - [`4091244`](https://github.com/netbirdio/netbird/commit/4091244544015b1aa0bf86ef67809f8e4eed84b6) Add API declarations. Improve policies. - [`9f5d2f2`](https://github.com/netbirdio/netbird/commit/9f5d2f21197f24a29a111742efa21e872df6869d) Finish handlers for policies processing. - [`14e9909`](https://github.com/netbirdio/netbird/commit/14e99094270428b8e0067120374b2e77b52e509b) Fix account mocks - [`e476f20`](https://github.com/netbirdio/netbird/commit/e476f2050c79a1e6c86e1ddc2debd9273c799c88) Add migration from Rules to new policies in account loading. - [`eb1dda7`](https://github.com/netbirdio/netbird/commit/eb1dda761a31f3862fa224bfbda188930aba1695) Test for file store. Broken tests in management. ### 📊 Changes **25 files changed** (+1714 additions, -864 deletions) <details> <summary>View changed files</summary> 📝 `go.mod` (+18 -9) 📝 `go.sum` (+52 -37) 📝 `management/server/account.go` (+29 -54) 📝 `management/server/account_test.go` (+46 -102) 📝 `management/server/activity/codes.go` (+27 -3) 📝 `management/server/file_store.go` (+19 -5) 📝 `management/server/file_store_test.go` (+41 -6) 📝 `management/server/group.go` (+10 -13) 📝 `management/server/http/api/openapi.yml` (+180 -15) 📝 `management/server/http/api/types.gen.go` (+87 -41) 📝 `management/server/http/handler.go` (+10 -1) ➕ `management/server/http/policies.go` (+326 -0) 📝 `management/server/http/rules_handler.go` (+37 -163) 📝 `management/server/http/rules_handler_test.go` (+31 -77) 📝 `management/server/management_test.go` (+3 -1) 📝 `management/server/mock_server/account_mock.go` (+38 -10) 📝 `management/server/peer.go` (+8 -74) 📝 `management/server/peer_test.go` (+28 -26) ➕ `management/server/policy.go` (+451 -0) ➕ `management/server/policy_test.go` (+67 -0) _...and 5 more files_ </details> ### 📄 Description ## Describe your changes Convert rules to Rego policies and allow users to write raw policies to set up connectivity and firewall on the clients. This PR also has related changes in the dashboard. Please consider it together with https://github.com/netbirdio/dashboard/pull/147 ## Issue ticket number and link NB-215 ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [x] It is a refactor - [x] Created tests that fail without the change (if possible) - [x] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 02:06:55 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#12890