mirror of
https://github.com/netbirdio/docs.git
synced 2026-10-09 23:29:04 +02:00
2548 lines
58 KiB
Plaintext
2548 lines
58 KiB
Plaintext
export const title = 'Posture Checks'
|
||
|
||
|
||
|
||
## List all Posture Checks {{ tag: 'GET' , label: '/api/posture-checks' }}
|
||
|
||
<Row>
|
||
<Col>
|
||
Returns a list of all posture checks
|
||
</Col>
|
||
|
||
<Col sticky>
|
||
<CodeGroup title="Request" tag="GET" label="/api/posture-checks">
|
||
```bash {{ title: 'cURL' }}
|
||
curl -X GET https://api.netbird.io/api/posture-checks \
|
||
-H 'Accept: application/json' \
|
||
-H 'Authorization: Token <TOKEN>'
|
||
```
|
||
|
||
```js
|
||
const axios = require('axios');
|
||
|
||
let config = {
|
||
method: 'get',
|
||
maxBodyLength: Infinity,
|
||
url: '/api/posture-checks',
|
||
headers: {
|
||
'Accept': 'application/json',
|
||
'Authorization': 'Token <TOKEN>'
|
||
}
|
||
};
|
||
|
||
axios(config)
|
||
.then((response) => {
|
||
console.log(JSON.stringify(response.data));
|
||
})
|
||
.catch((error) => {
|
||
console.log(error);
|
||
});
|
||
```
|
||
|
||
```python
|
||
import requests
|
||
import json
|
||
|
||
url = "https://api.netbird.io/api/posture-checks"
|
||
|
||
headers = {
|
||
'Accept': 'application/json',
|
||
'Authorization': 'Token <TOKEN>'
|
||
}
|
||
|
||
response = requests.request("GET", url, headers=headers)
|
||
|
||
print(response.text)
|
||
```
|
||
|
||
```go
|
||
package main
|
||
|
||
import (
|
||
"fmt"
|
||
"strings"
|
||
"net/http"
|
||
"io/ioutil"
|
||
)
|
||
|
||
func main() {
|
||
|
||
url := "https://api.netbird.io/api/posture-checks"
|
||
method := "GET"
|
||
|
||
client := &http.Client {
|
||
}
|
||
req, err := http.NewRequest(method, url, nil)
|
||
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
|
||
|
||
req.Header.Add("Accept", "application/json")
|
||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||
|
||
res, err := client.Do(req)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
defer res.Body.Close()
|
||
|
||
body, err := ioutil.ReadAll(res.Body)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
fmt.Println(string(body))
|
||
}
|
||
```
|
||
|
||
```ruby
|
||
require "uri"
|
||
require "json"
|
||
require "net/http"
|
||
|
||
url = URI("https://api.netbird.io/api/posture-checks")
|
||
|
||
https = Net::HTTP.new(url.host, url.port)
|
||
https.use_ssl = true
|
||
|
||
request = Net::HTTP::Get.new(url)
|
||
request["Accept"] = "application/json"
|
||
request["Authorization"] = "Token <TOKEN>"
|
||
|
||
response = https.request(request)
|
||
puts response.read_body
|
||
```
|
||
|
||
```java
|
||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||
.build();
|
||
|
||
Request request = new Request.Builder()
|
||
.url("https://api.netbird.io/api/posture-checks")
|
||
.method("GET")
|
||
.addHeader("Accept", "application/json")
|
||
.addHeader("Authorization: Token <TOKEN>")
|
||
.build();
|
||
Response response = client.newCall(request).execute();
|
||
```
|
||
|
||
```php
|
||
<?php
|
||
|
||
$curl = curl_init();
|
||
|
||
curl_setopt_array($curl, array(
|
||
CURLOPT_URL => 'https://api.netbird.io/api/posture-checks',
|
||
CURLOPT_RETURNTRANSFER => true,
|
||
CURLOPT_ENCODING => '',
|
||
CURLOPT_MAXREDIRS => 10,
|
||
CURLOPT_TIMEOUT => 0,
|
||
CURLOPT_FOLLOWLOCATION => true,
|
||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||
CURLOPT_HTTPHEADER => array(
|
||
'Accept: application/json',
|
||
'Authorization: Token <TOKEN>'
|
||
),
|
||
));
|
||
|
||
$response = curl_exec($curl);
|
||
|
||
curl_close($curl);
|
||
echo $response;
|
||
```
|
||
|
||
</CodeGroup>
|
||
|
||
|
||
<CodeGroup title="Response">
|
||
```json {{ title: 'Example' }}
|
||
[
|
||
{
|
||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
]
|
||
```
|
||
```json {{ title: 'Schema' }}
|
||
[
|
||
{
|
||
"id": "string",
|
||
"name": "string",
|
||
"description": "string",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "string"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "string",
|
||
"city_name": "string"
|
||
}
|
||
],
|
||
"action": "string"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"string"
|
||
],
|
||
"action": "string"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "string",
|
||
"mac_path": "string",
|
||
"windows_path": "string"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
]
|
||
```
|
||
</CodeGroup>
|
||
|
||
|
||
</Col>
|
||
</Row>
|
||
|
||
---
|
||
|
||
|
||
## Create a Posture Check {{ tag: 'POST' , label: '/api/posture-checks' }}
|
||
|
||
<Row>
|
||
<Col>
|
||
Creates a posture check
|
||
|
||
### Request-Body Parameters
|
||
|
||
<Properties><Property name="name" type="string" required={true}>
|
||
|
||
Posture check name identifier
|
||
|
||
</Property>
|
||
<Property name="description" type="string" required={true}>
|
||
|
||
Posture check friendly description
|
||
|
||
</Property>
|
||
<Property name="checks" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>List of objects that perform the actual checks</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="nb_version_check" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for the version of operating system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="os_version_check" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for the version of operating system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="android" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for the version of operating system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="darwin" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for the version of operating system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="ios" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for the version of operating system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="linux" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check with the kernel version</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_kernel_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="windows" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check with the kernel version</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_kernel_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="geo_location_check" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for geo location</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="locations" type="object[]" required={true}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>List of geo locations to which the policy applies</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="country_code" type="string" required={true}>
|
||
|
||
2-letter ISO 3166-1 alpha-2 code that represents the country
|
||
|
||
</Property>
|
||
<Property name="city_name" type="string" required={false}>
|
||
|
||
Commonly used English name of the city
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="action" type="string" required={true} enumList={["allow","deny"]}>
|
||
|
||
Action to take upon policy match
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="peer_network_range_check" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for allow or deny access based on the peer's IP addresses. A range matches when it contains any of the peer's local network interface IPs or its public connection (NAT egress) IP, so ranges may target private subnets, public CIDRs, or single hosts via a /32 or /128.</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="ranges" type="string[]" required={true}>
|
||
|
||
List of network ranges in CIDR notation, matched against the peer's local interface IPs and its public connection IP
|
||
|
||
</Property>
|
||
<Property name="action" type="string" required={true} enumList={["allow","deny"]}>
|
||
|
||
Action to take upon policy match
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="process_check" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture Check for binaries exist and are running in the peer’s system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="processes" type="object[]" required={true}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>More Information</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="linux_path" type="string" required={false}>
|
||
|
||
Path to the process executable file in a Linux operating system
|
||
|
||
</Property>
|
||
<Property name="mac_path" type="string" required={false}>
|
||
|
||
Path to the process executable file in a Mac operating system
|
||
|
||
</Property>
|
||
<Property name="windows_path" type="string" required={false}>
|
||
|
||
Path to the process executable file in a Windows operating system
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
|
||
</Col>
|
||
|
||
<Col sticky>
|
||
<CodeGroup title="Request" tag="POST" label="/api/posture-checks">
|
||
```bash {{ title: 'cURL' }}
|
||
curl -X POST https://api.netbird.io/api/posture-checks \
|
||
-H 'Accept: application/json' \
|
||
-H 'Content-Type: application/json' \
|
||
-H 'Authorization: Token <TOKEN>' \
|
||
--data-raw '{
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}'
|
||
```
|
||
|
||
```js
|
||
const axios = require('axios');
|
||
let data = JSON.stringify({
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
});
|
||
let config = {
|
||
method: 'post',
|
||
maxBodyLength: Infinity,
|
||
url: '/api/posture-checks',
|
||
headers: {
|
||
'Accept': 'application/json',
|
||
'Content-Type': 'application/json',
|
||
'Authorization': 'Token <TOKEN>'
|
||
},
|
||
data : data
|
||
};
|
||
|
||
axios(config)
|
||
.then((response) => {
|
||
console.log(JSON.stringify(response.data));
|
||
})
|
||
.catch((error) => {
|
||
console.log(error);
|
||
});
|
||
```
|
||
|
||
```python
|
||
import requests
|
||
import json
|
||
|
||
url = "https://api.netbird.io/api/posture-checks"
|
||
payload = json.dumps({
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
})
|
||
headers = {
|
||
'Content-Type': 'application/json',
|
||
'Accept': 'application/json',
|
||
'Authorization': 'Token <TOKEN>'
|
||
}
|
||
|
||
response = requests.request("POST", url, headers=headers, data=payload)
|
||
|
||
print(response.text)
|
||
```
|
||
|
||
```go
|
||
package main
|
||
|
||
import (
|
||
"fmt"
|
||
"strings"
|
||
"net/http"
|
||
"io/ioutil"
|
||
)
|
||
|
||
func main() {
|
||
|
||
url := "https://api.netbird.io/api/posture-checks"
|
||
method := "POST"
|
||
|
||
payload := strings.NewReader(`{
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}`)
|
||
client := &http.Client {
|
||
}
|
||
req, err := http.NewRequest(method, url, payload)
|
||
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
|
||
|
||
req.Header.Add("Content-Type", "application/json")
|
||
req.Header.Add("Accept", "application/json")
|
||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||
|
||
res, err := client.Do(req)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
defer res.Body.Close()
|
||
|
||
body, err := ioutil.ReadAll(res.Body)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
fmt.Println(string(body))
|
||
}
|
||
```
|
||
|
||
```ruby
|
||
require "uri"
|
||
require "json"
|
||
require "net/http"
|
||
|
||
url = URI("https://api.netbird.io/api/posture-checks")
|
||
|
||
https = Net::HTTP.new(url.host, url.port)
|
||
https.use_ssl = true
|
||
|
||
request = Net::HTTP::Post.new(url)
|
||
request["Content-Type"] = "application/json"
|
||
request["Accept"] = "application/json"
|
||
request["Authorization"] = "Token <TOKEN>"
|
||
|
||
request.body = JSON.dump({
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
})
|
||
response = https.request(request)
|
||
puts response.read_body
|
||
```
|
||
|
||
```java
|
||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||
.build();
|
||
MediaType mediaType = MediaType.parse("application/json");
|
||
RequestBody body = RequestBody.create(mediaType, '{
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}');
|
||
Request request = new Request.Builder()
|
||
.url("https://api.netbird.io/api/posture-checks")
|
||
.method("POST", body)
|
||
.addHeader("Content-Type", "application/json")
|
||
.addHeader("Accept", "application/json")
|
||
.addHeader("Authorization: Token <TOKEN>")
|
||
.build();
|
||
Response response = client.newCall(request).execute();
|
||
```
|
||
|
||
```php
|
||
<?php
|
||
|
||
$curl = curl_init();
|
||
|
||
curl_setopt_array($curl, array(
|
||
CURLOPT_URL => 'https://api.netbird.io/api/posture-checks',
|
||
CURLOPT_RETURNTRANSFER => true,
|
||
CURLOPT_ENCODING => '',
|
||
CURLOPT_MAXREDIRS => 10,
|
||
CURLOPT_TIMEOUT => 0,
|
||
CURLOPT_FOLLOWLOCATION => true,
|
||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||
CURLOPT_POSTFIELDS => '{
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}',
|
||
CURLOPT_HTTPHEADER => array(
|
||
'Content-Type: application/json',
|
||
'Accept: application/json',
|
||
'Authorization: Token <TOKEN>'
|
||
),
|
||
));
|
||
|
||
$response = curl_exec($curl);
|
||
|
||
curl_close($curl);
|
||
echo $response;
|
||
```
|
||
|
||
</CodeGroup>
|
||
|
||
|
||
<CodeGroup title="Response">
|
||
```json {{ title: 'Example' }}
|
||
{
|
||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
```
|
||
```json {{ title: 'Schema' }}
|
||
{
|
||
"id": "string",
|
||
"name": "string",
|
||
"description": "string",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "string"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "string",
|
||
"city_name": "string"
|
||
}
|
||
],
|
||
"action": "string"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"string"
|
||
],
|
||
"action": "string"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "string",
|
||
"mac_path": "string",
|
||
"windows_path": "string"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
```
|
||
</CodeGroup>
|
||
|
||
|
||
</Col>
|
||
</Row>
|
||
|
||
---
|
||
|
||
|
||
## Retrieve a Posture Check {{ tag: 'GET' , label: '/api/posture-checks/{postureCheckId}' }}
|
||
|
||
<Row>
|
||
<Col>
|
||
Get information about a posture check
|
||
|
||
### Path Parameters
|
||
<Properties>
|
||
|
||
<Property name="postureCheckId" type="string" required={true}>
|
||
The unique identifier of a posture check
|
||
</Property>
|
||
</Properties>
|
||
</Col>
|
||
|
||
<Col sticky>
|
||
<CodeGroup title="Request" tag="GET" label="/api/posture-checks/{postureCheckId}">
|
||
```bash {{ title: 'cURL' }}
|
||
curl -X GET https://api.netbird.io/api/posture-checks/{postureCheckId} \
|
||
-H 'Accept: application/json' \
|
||
-H 'Authorization: Token <TOKEN>'
|
||
```
|
||
|
||
```js
|
||
const axios = require('axios');
|
||
|
||
let config = {
|
||
method: 'get',
|
||
maxBodyLength: Infinity,
|
||
url: '/api/posture-checks/{postureCheckId}',
|
||
headers: {
|
||
'Accept': 'application/json',
|
||
'Authorization': 'Token <TOKEN>'
|
||
}
|
||
};
|
||
|
||
axios(config)
|
||
.then((response) => {
|
||
console.log(JSON.stringify(response.data));
|
||
})
|
||
.catch((error) => {
|
||
console.log(error);
|
||
});
|
||
```
|
||
|
||
```python
|
||
import requests
|
||
import json
|
||
|
||
url = "https://api.netbird.io/api/posture-checks/{postureCheckId}"
|
||
|
||
headers = {
|
||
'Accept': 'application/json',
|
||
'Authorization': 'Token <TOKEN>'
|
||
}
|
||
|
||
response = requests.request("GET", url, headers=headers)
|
||
|
||
print(response.text)
|
||
```
|
||
|
||
```go
|
||
package main
|
||
|
||
import (
|
||
"fmt"
|
||
"strings"
|
||
"net/http"
|
||
"io/ioutil"
|
||
)
|
||
|
||
func main() {
|
||
|
||
url := "https://api.netbird.io/api/posture-checks/{postureCheckId}"
|
||
method := "GET"
|
||
|
||
client := &http.Client {
|
||
}
|
||
req, err := http.NewRequest(method, url, nil)
|
||
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
|
||
|
||
req.Header.Add("Accept", "application/json")
|
||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||
|
||
res, err := client.Do(req)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
defer res.Body.Close()
|
||
|
||
body, err := ioutil.ReadAll(res.Body)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
fmt.Println(string(body))
|
||
}
|
||
```
|
||
|
||
```ruby
|
||
require "uri"
|
||
require "json"
|
||
require "net/http"
|
||
|
||
url = URI("https://api.netbird.io/api/posture-checks/{postureCheckId}")
|
||
|
||
https = Net::HTTP.new(url.host, url.port)
|
||
https.use_ssl = true
|
||
|
||
request = Net::HTTP::Get.new(url)
|
||
request["Accept"] = "application/json"
|
||
request["Authorization"] = "Token <TOKEN>"
|
||
|
||
response = https.request(request)
|
||
puts response.read_body
|
||
```
|
||
|
||
```java
|
||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||
.build();
|
||
|
||
Request request = new Request.Builder()
|
||
.url("https://api.netbird.io/api/posture-checks/{postureCheckId}")
|
||
.method("GET")
|
||
.addHeader("Accept", "application/json")
|
||
.addHeader("Authorization: Token <TOKEN>")
|
||
.build();
|
||
Response response = client.newCall(request).execute();
|
||
```
|
||
|
||
```php
|
||
<?php
|
||
|
||
$curl = curl_init();
|
||
|
||
curl_setopt_array($curl, array(
|
||
CURLOPT_URL => 'https://api.netbird.io/api/posture-checks/{postureCheckId}',
|
||
CURLOPT_RETURNTRANSFER => true,
|
||
CURLOPT_ENCODING => '',
|
||
CURLOPT_MAXREDIRS => 10,
|
||
CURLOPT_TIMEOUT => 0,
|
||
CURLOPT_FOLLOWLOCATION => true,
|
||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||
CURLOPT_HTTPHEADER => array(
|
||
'Accept: application/json',
|
||
'Authorization: Token <TOKEN>'
|
||
),
|
||
));
|
||
|
||
$response = curl_exec($curl);
|
||
|
||
curl_close($curl);
|
||
echo $response;
|
||
```
|
||
|
||
</CodeGroup>
|
||
|
||
|
||
<CodeGroup title="Response">
|
||
```json {{ title: 'Example' }}
|
||
{
|
||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
```
|
||
```json {{ title: 'Schema' }}
|
||
{
|
||
"id": "string",
|
||
"name": "string",
|
||
"description": "string",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "string"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "string",
|
||
"city_name": "string"
|
||
}
|
||
],
|
||
"action": "string"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"string"
|
||
],
|
||
"action": "string"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "string",
|
||
"mac_path": "string",
|
||
"windows_path": "string"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
```
|
||
</CodeGroup>
|
||
|
||
|
||
</Col>
|
||
</Row>
|
||
|
||
---
|
||
|
||
|
||
## Update a Posture Check {{ tag: 'PUT' , label: '/api/posture-checks/{postureCheckId}' }}
|
||
|
||
<Row>
|
||
<Col>
|
||
Update/Replace a posture check
|
||
|
||
### Path Parameters
|
||
<Properties>
|
||
|
||
<Property name="postureCheckId" type="string" required={true}>
|
||
The unique identifier of a posture check
|
||
</Property>
|
||
</Properties>
|
||
|
||
### Request-Body Parameters
|
||
|
||
<Properties><Property name="name" type="string" required={true}>
|
||
|
||
Posture check name identifier
|
||
|
||
</Property>
|
||
<Property name="description" type="string" required={true}>
|
||
|
||
Posture check friendly description
|
||
|
||
</Property>
|
||
<Property name="checks" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>List of objects that perform the actual checks</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="nb_version_check" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for the version of operating system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="os_version_check" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for the version of operating system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="android" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for the version of operating system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="darwin" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for the version of operating system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="ios" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for the version of operating system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="linux" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check with the kernel version</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_kernel_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="windows" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check with the kernel version</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="min_kernel_version" type="string" required={true}>
|
||
|
||
Minimum acceptable version
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="geo_location_check" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for geo location</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="locations" type="object[]" required={true}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>List of geo locations to which the policy applies</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="country_code" type="string" required={true}>
|
||
|
||
2-letter ISO 3166-1 alpha-2 code that represents the country
|
||
|
||
</Property>
|
||
<Property name="city_name" type="string" required={false}>
|
||
|
||
Commonly used English name of the city
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="action" type="string" required={true} enumList={["allow","deny"]}>
|
||
|
||
Action to take upon policy match
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="peer_network_range_check" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture check for allow or deny access based on the peer's IP addresses. A range matches when it contains any of the peer's local network interface IPs or its public connection (NAT egress) IP, so ranges may target private subnets, public CIDRs, or single hosts via a /32 or /128.</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="ranges" type="string[]" required={true}>
|
||
|
||
List of network ranges in CIDR notation, matched against the peer's local interface IPs and its public connection IP
|
||
|
||
</Property>
|
||
<Property name="action" type="string" required={true} enumList={["allow","deny"]}>
|
||
|
||
Action to take upon policy match
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
<Property name="process_check" type="object" required={false}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>Posture Check for binaries exist and are running in the peer’s system</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="processes" type="object[]" required={true}>
|
||
|
||
<details className="custom-details" open>
|
||
<summary>More Information</summary>
|
||
<Properties>
|
||
|
||
<Properties><Property name="linux_path" type="string" required={false}>
|
||
|
||
Path to the process executable file in a Linux operating system
|
||
|
||
</Property>
|
||
<Property name="mac_path" type="string" required={false}>
|
||
|
||
Path to the process executable file in a Mac operating system
|
||
|
||
</Property>
|
||
<Property name="windows_path" type="string" required={false}>
|
||
|
||
Path to the process executable file in a Windows operating system
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
</Properties>
|
||
</details>
|
||
|
||
</Property>
|
||
</Properties>
|
||
|
||
|
||
</Col>
|
||
|
||
<Col sticky>
|
||
<CodeGroup title="Request" tag="PUT" label="/api/posture-checks/{postureCheckId}">
|
||
```bash {{ title: 'cURL' }}
|
||
curl -X PUT https://api.netbird.io/api/posture-checks/{postureCheckId} \
|
||
-H 'Accept: application/json' \
|
||
-H 'Content-Type: application/json' \
|
||
-H 'Authorization: Token <TOKEN>' \
|
||
--data-raw '{
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}'
|
||
```
|
||
|
||
```js
|
||
const axios = require('axios');
|
||
let data = JSON.stringify({
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
});
|
||
let config = {
|
||
method: 'put',
|
||
maxBodyLength: Infinity,
|
||
url: '/api/posture-checks/{postureCheckId}',
|
||
headers: {
|
||
'Accept': 'application/json',
|
||
'Content-Type': 'application/json',
|
||
'Authorization': 'Token <TOKEN>'
|
||
},
|
||
data : data
|
||
};
|
||
|
||
axios(config)
|
||
.then((response) => {
|
||
console.log(JSON.stringify(response.data));
|
||
})
|
||
.catch((error) => {
|
||
console.log(error);
|
||
});
|
||
```
|
||
|
||
```python
|
||
import requests
|
||
import json
|
||
|
||
url = "https://api.netbird.io/api/posture-checks/{postureCheckId}"
|
||
payload = json.dumps({
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
})
|
||
headers = {
|
||
'Content-Type': 'application/json',
|
||
'Accept': 'application/json',
|
||
'Authorization': 'Token <TOKEN>'
|
||
}
|
||
|
||
response = requests.request("PUT", url, headers=headers, data=payload)
|
||
|
||
print(response.text)
|
||
```
|
||
|
||
```go
|
||
package main
|
||
|
||
import (
|
||
"fmt"
|
||
"strings"
|
||
"net/http"
|
||
"io/ioutil"
|
||
)
|
||
|
||
func main() {
|
||
|
||
url := "https://api.netbird.io/api/posture-checks/{postureCheckId}"
|
||
method := "PUT"
|
||
|
||
payload := strings.NewReader(`{
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}`)
|
||
client := &http.Client {
|
||
}
|
||
req, err := http.NewRequest(method, url, payload)
|
||
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
|
||
|
||
req.Header.Add("Content-Type", "application/json")
|
||
req.Header.Add("Accept", "application/json")
|
||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||
|
||
res, err := client.Do(req)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
defer res.Body.Close()
|
||
|
||
body, err := ioutil.ReadAll(res.Body)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
fmt.Println(string(body))
|
||
}
|
||
```
|
||
|
||
```ruby
|
||
require "uri"
|
||
require "json"
|
||
require "net/http"
|
||
|
||
url = URI("https://api.netbird.io/api/posture-checks/{postureCheckId}")
|
||
|
||
https = Net::HTTP.new(url.host, url.port)
|
||
https.use_ssl = true
|
||
|
||
request = Net::HTTP::Put.new(url)
|
||
request["Content-Type"] = "application/json"
|
||
request["Accept"] = "application/json"
|
||
request["Authorization"] = "Token <TOKEN>"
|
||
|
||
request.body = JSON.dump({
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
})
|
||
response = https.request(request)
|
||
puts response.read_body
|
||
```
|
||
|
||
```java
|
||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||
.build();
|
||
MediaType mediaType = MediaType.parse("application/json");
|
||
RequestBody body = RequestBody.create(mediaType, '{
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}');
|
||
Request request = new Request.Builder()
|
||
.url("https://api.netbird.io/api/posture-checks/{postureCheckId}")
|
||
.method("PUT", body)
|
||
.addHeader("Content-Type", "application/json")
|
||
.addHeader("Accept", "application/json")
|
||
.addHeader("Authorization: Token <TOKEN>")
|
||
.build();
|
||
Response response = client.newCall(request).execute();
|
||
```
|
||
|
||
```php
|
||
<?php
|
||
|
||
$curl = curl_init();
|
||
|
||
curl_setopt_array($curl, array(
|
||
CURLOPT_URL => 'https://api.netbird.io/api/posture-checks/{postureCheckId}',
|
||
CURLOPT_RETURNTRANSFER => true,
|
||
CURLOPT_ENCODING => '',
|
||
CURLOPT_MAXREDIRS => 10,
|
||
CURLOPT_TIMEOUT => 0,
|
||
CURLOPT_FOLLOWLOCATION => true,
|
||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||
CURLOPT_POSTFIELDS => '{
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}',
|
||
CURLOPT_HTTPHEADER => array(
|
||
'Content-Type: application/json',
|
||
'Accept: application/json',
|
||
'Authorization: Token <TOKEN>'
|
||
),
|
||
));
|
||
|
||
$response = curl_exec($curl);
|
||
|
||
curl_close($curl);
|
||
echo $response;
|
||
```
|
||
|
||
</CodeGroup>
|
||
|
||
|
||
<CodeGroup title="Response">
|
||
```json {{ title: 'Example' }}
|
||
{
|
||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||
"name": "Default",
|
||
"description": "This checks if the peer is running required NetBird's version",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "14.3"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "DE",
|
||
"city_name": "Berlin"
|
||
}
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"192.168.1.0/24",
|
||
"10.0.0.0/8",
|
||
"1.0.0.0/24",
|
||
"2.2.2.2/32",
|
||
"2001:db8:1234:1a00::/56"
|
||
],
|
||
"action": "allow"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "/usr/local/bin/netbird",
|
||
"mac_path": "/Applications/NetBird.app/Contents/MacOS/netbird",
|
||
"windows_path": "C:
rogramData
etBird\netbird.exe"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
```
|
||
```json {{ title: 'Schema' }}
|
||
{
|
||
"id": "string",
|
||
"name": "string",
|
||
"description": "string",
|
||
"checks": {
|
||
"nb_version_check": {
|
||
"min_version": "string"
|
||
},
|
||
"os_version_check": {
|
||
"android": {
|
||
"min_version": "13"
|
||
},
|
||
"ios": {
|
||
"min_version": "17.3.1"
|
||
},
|
||
"darwin": {
|
||
"min_version": "14.2.1"
|
||
},
|
||
"linux": {
|
||
"min_kernel_version": "5.3.3"
|
||
},
|
||
"windows": {
|
||
"min_kernel_version": "10.0.1234"
|
||
}
|
||
},
|
||
"geo_location_check": {
|
||
"locations": [
|
||
{
|
||
"country_code": "string",
|
||
"city_name": "string"
|
||
}
|
||
],
|
||
"action": "string"
|
||
},
|
||
"peer_network_range_check": {
|
||
"ranges": [
|
||
"string"
|
||
],
|
||
"action": "string"
|
||
},
|
||
"process_check": {
|
||
"processes": [
|
||
{
|
||
"linux_path": "string",
|
||
"mac_path": "string",
|
||
"windows_path": "string"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
```
|
||
</CodeGroup>
|
||
|
||
|
||
</Col>
|
||
</Row>
|
||
|
||
---
|
||
|
||
|
||
## Delete a Posture Check {{ tag: 'DELETE' , label: '/api/posture-checks/{postureCheckId}' }}
|
||
|
||
<Row>
|
||
<Col>
|
||
Delete a posture check
|
||
|
||
### Path Parameters
|
||
<Properties>
|
||
|
||
<Property name="postureCheckId" type="string" required={true}>
|
||
The unique identifier of a posture check
|
||
</Property>
|
||
</Properties>
|
||
</Col>
|
||
|
||
<Col sticky>
|
||
<CodeGroup title="Request" tag="DELETE" label="/api/posture-checks/{postureCheckId}">
|
||
```bash {{ title: 'cURL' }}
|
||
curl -X DELETE https://api.netbird.io/api/posture-checks/{postureCheckId} \
|
||
-H 'Authorization: Token <TOKEN>'
|
||
```
|
||
|
||
```js
|
||
const axios = require('axios');
|
||
|
||
let config = {
|
||
method: 'delete',
|
||
maxBodyLength: Infinity,
|
||
url: '/api/posture-checks/{postureCheckId}',
|
||
headers: {
|
||
'Authorization': 'Token <TOKEN>'
|
||
}
|
||
};
|
||
|
||
axios(config)
|
||
.then((response) => {
|
||
console.log(JSON.stringify(response.data));
|
||
})
|
||
.catch((error) => {
|
||
console.log(error);
|
||
});
|
||
```
|
||
|
||
```python
|
||
import requests
|
||
import json
|
||
|
||
url = "https://api.netbird.io/api/posture-checks/{postureCheckId}"
|
||
|
||
headers = {
|
||
'Authorization': 'Token <TOKEN>'
|
||
}
|
||
|
||
response = requests.request("DELETE", url, headers=headers)
|
||
|
||
print(response.text)
|
||
```
|
||
|
||
```go
|
||
package main
|
||
|
||
import (
|
||
"fmt"
|
||
"strings"
|
||
"net/http"
|
||
"io/ioutil"
|
||
)
|
||
|
||
func main() {
|
||
|
||
url := "https://api.netbird.io/api/posture-checks/{postureCheckId}"
|
||
method := "DELETE"
|
||
|
||
client := &http.Client {
|
||
}
|
||
req, err := http.NewRequest(method, url, nil)
|
||
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
|
||
|
||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||
|
||
res, err := client.Do(req)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
defer res.Body.Close()
|
||
|
||
body, err := ioutil.ReadAll(res.Body)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
return
|
||
}
|
||
fmt.Println(string(body))
|
||
}
|
||
```
|
||
|
||
```ruby
|
||
require "uri"
|
||
require "json"
|
||
require "net/http"
|
||
|
||
url = URI("https://api.netbird.io/api/posture-checks/{postureCheckId}")
|
||
|
||
https = Net::HTTP.new(url.host, url.port)
|
||
https.use_ssl = true
|
||
|
||
request = Net::HTTP::Delete.new(url)
|
||
request["Authorization"] = "Token <TOKEN>"
|
||
|
||
response = https.request(request)
|
||
puts response.read_body
|
||
```
|
||
|
||
```java
|
||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||
.build();
|
||
|
||
Request request = new Request.Builder()
|
||
.url("https://api.netbird.io/api/posture-checks/{postureCheckId}")
|
||
.method("DELETE")
|
||
.addHeader("Authorization: Token <TOKEN>")
|
||
.build();
|
||
Response response = client.newCall(request).execute();
|
||
```
|
||
|
||
```php
|
||
<?php
|
||
|
||
$curl = curl_init();
|
||
|
||
curl_setopt_array($curl, array(
|
||
CURLOPT_URL => 'https://api.netbird.io/api/posture-checks/{postureCheckId}',
|
||
CURLOPT_RETURNTRANSFER => true,
|
||
CURLOPT_ENCODING => '',
|
||
CURLOPT_MAXREDIRS => 10,
|
||
CURLOPT_TIMEOUT => 0,
|
||
CURLOPT_FOLLOWLOCATION => true,
|
||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||
CURLOPT_HTTPHEADER => array(
|
||
'Authorization: Token <TOKEN>'
|
||
),
|
||
));
|
||
|
||
$response = curl_exec($curl);
|
||
|
||
curl_close($curl);
|
||
echo $response;
|
||
```
|
||
|
||
</CodeGroup>
|
||
|
||
|
||
|
||
</Col>
|
||
</Row>
|
||
|
||
---
|