[PR #1479] [MERGED] Add OS Version posture checks #15437

Closed
opened 2026-08-05 03:07:39 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1479
Author: @surik
Created: 1/17/2024
Status: Merged
Merged: 1/29/2024
Merged by: @surik

Base: feature/posture-checksHead: yury/os-posture-checks


📝 Commits (10+)

📊 Changes

10 files changed (+574 additions, -54 deletions)

View changed files

📝 management/server/http/api/openapi.yml (+43 -10)
📝 management/server/http/api/types.gen.go (+34 -4)
📝 management/server/http/posture_checks_handler.go (+33 -2)
📝 management/server/http/posture_checks_handler_test.go (+181 -24)
📝 management/server/policy_test.go (+58 -9)
📝 management/server/posture/checks.go (+7 -1)
📝 management/server/posture/nb_version.go (+2 -4)
📝 management/server/posture/nb_version_test.go (+0 -0)
management/server/posture/os_version.go (+96 -0)
management/server/posture/os_version_test.go (+120 -0)

📄 Description

Describe your changes

This PR extends the existing /api/posture-checks endpoint with additional OS version checks.

{
	"name": "Default",
	"description": "This checks if the peer is running on Android >=9, iOS >= 17, any macOS, or Linux kernel > 6.0 but not Windows",
	"checks": {
		"os_version_check": {
			"android": {
				"min_version": "9"
			},
			"darwin": {
				"min_version": "0"
			},
			"ios": {
				"min_version": "14.2"
			},
			"linux": {
				"min_kernel_version": "6.0"
			}
		}
	}
}
  • Version checks for Android, Darwin(macOS), and iOS are based on OS version. min_version has to be provided.
  • Version checks for Linux and Windows are based on the kernel version. min_kernel_version has to be provided.
  • To allow any version of a particular OS set min_version or min_kernel_version.
  • To disallow a particular OS simply skip the definition completely as in the example above for Windows.

After this PR is merged both os_version_check and nb_version_check can be provided in the same check:

{
	"name": "Default",
	"description": "This checks if the peer is running on Android >=9, iOS >= 17, any macOS, or Linux kernel > 6.0 but not Windows",
	"checks": {
		"nb_version_check": {
			"min_version": "0.25.0"
		},
		"os_version_check": {
			"linux": {
				"min_kernel_version": "6.0"
			}
		}
	}
}

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/1479 **Author:** [@surik](https://github.com/surik) **Created:** 1/17/2024 **Status:** ✅ Merged **Merged:** 1/29/2024 **Merged by:** [@surik](https://github.com/surik) **Base:** `feature/posture-checks` ← **Head:** `yury/os-posture-checks` --- ### 📝 Commits (10+) - [`23bdc8b`](https://github.com/netbirdio/netbird/commit/23bdc8b3d75765a460539fde13d87841e8cfaa2e) Add OSVersionCheck schema - [`52969fc`](https://github.com/netbirdio/netbird/commit/52969fc4dc0537cb7b7e852b99c1342535a1660c) Implement OSVersionCheck - [`670022e`](https://github.com/netbirdio/netbird/commit/670022e5037ead88d2922104fc7dba614f06fc7d) Fix tests - [`09aeb62`](https://github.com/netbirdio/netbird/commit/09aeb6285113e9ddb72867281d6ec9a602e10de2) Extend API with minx kernel version - [`29b2dcf`](https://github.com/netbirdio/netbird/commit/29b2dcff753384a4efc0e00fb2854a62f140ae29) Add OS Version check tests - [`fee8fd6`](https://github.com/netbirdio/netbird/commit/fee8fd60e0cb43e3f0b80a6940bad3c5dc99b969) Extend tests - [`3fa7941`](https://github.com/netbirdio/netbird/commit/3fa7941df831e6eb8973cb8f39be2695f34f3a2d) Extend TestGetPostureCheck test - [`9288187`](https://github.com/netbirdio/netbird/commit/9288187dc0ca79c354acc6e37592095d16c5c85d) Extend tests - [`e5f5728`](https://github.com/netbirdio/netbird/commit/e5f57286de5412b93d6c168969017a7cf1442b98) Rename api object for min version checks - [`ef8f216`](https://github.com/netbirdio/netbird/commit/ef8f21677e47fd94d3cfd0c312099d5674ca32fa) Extend test to coven MinKernelVersion ### 📊 Changes **10 files changed** (+574 additions, -54 deletions) <details> <summary>View changed files</summary> 📝 `management/server/http/api/openapi.yml` (+43 -10) 📝 `management/server/http/api/types.gen.go` (+34 -4) 📝 `management/server/http/posture_checks_handler.go` (+33 -2) 📝 `management/server/http/posture_checks_handler_test.go` (+181 -24) 📝 `management/server/policy_test.go` (+58 -9) 📝 `management/server/posture/checks.go` (+7 -1) 📝 `management/server/posture/nb_version.go` (+2 -4) 📝 `management/server/posture/nb_version_test.go` (+0 -0) ➕ `management/server/posture/os_version.go` (+96 -0) ➕ `management/server/posture/os_version_test.go` (+120 -0) </details> ### 📄 Description ## Describe your changes This PR extends the existing `/api/posture-checks` endpoint with additional OS version checks. ```json { "name": "Default", "description": "This checks if the peer is running on Android >=9, iOS >= 17, any macOS, or Linux kernel > 6.0 but not Windows", "checks": { "os_version_check": { "android": { "min_version": "9" }, "darwin": { "min_version": "0" }, "ios": { "min_version": "14.2" }, "linux": { "min_kernel_version": "6.0" } } } } ``` * Version checks for Android, Darwin(macOS), and iOS are based on OS version. `min_version` has to be provided. * Version checks for Linux and Windows are based on the kernel version. `min_kernel_version` has to be provided. * To allow any version of a particular OS set `min_version` or `min_kernel_version`. * To disallow a particular OS simply skip the definition completely as in the example above for Windows. After this PR is merged both `os_version_check` and `nb_version_check` can be provided in the same check: ```json { "name": "Default", "description": "This checks if the peer is running on Android >=9, iOS >= 17, any macOS, or Linux kernel > 6.0 but not Windows", "checks": { "nb_version_check": { "min_version": "0.25.0" }, "os_version_check": { "linux": { "min_kernel_version": "6.0" } } } } ``` ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] 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 03:07:39 -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#15437