Restrict device access with Kandji
Kandji collects a series of signals from its agent installed on each device that can be used to determine the security posture of a device. Tailscale can fetch these signals from Kandji and use them as device posture attributes in access rules, which can then be used by organizations to grant access to sensitive resources only to devices that have a high level of trust.
This can be achieved using Tailscale's device posture management features:
- Kandji posture integration, which synchronizes signals from Kandji to device posture attributes in Tailscale.
- Device Identity Collection, which collects identifiers (for example, serial numbers), used to match devices in Tailscale to devices in Kandji.
- Posture conditions in access rules, which allows configuring access restrictions based on device attributes.
This document provides instructions on how to:
- Enable Device Identity collection for your tailnet.
- Configure Kandji posture integration.
What is Kandji posture integration?
Kandji posture integration lets you connect your Tailscale network to Kandji. The integration runs periodically and copies signals from Kandji to device posture attributes.
When configured, it will periodically:
- Fetch a list of devices recorded in your Kandji account, and their details.
- Match Kandji devices with corresponding devices in your tailnet, based on the serial number associated with a device.
- Write the data from each device into the following Tailscale device posture attributes:
Attribute key | Description | Allowed values |
---|---|---|
kandji:mdmEnabled | whether the device is enrolled in Kandji MDM | true , false |
kandji:agentInstalled | whether the Kandji agent is present on the device | true , false |
Prerequisites
- Device Identity Collection is enabled, and devices in your tailnet are reporting identifiers
- Kandji API Token
Create Kandji API Token
Create a Kandji API Token that will be used to fetch a list of devices and their data from Kandji.
-
In Kandji, in the left-hand panel, select Settings.
-
From the top menu, select Access and select Add Token.
-
Add a name for the API token and select Create.
-
The API Token will be shown once, make sure to copy it for use later and select Next.
-
In the new dialog, select Configure to configure the permissions for the API token.
-
Under Prism, select Device Information (
/api/v1/prism/device_information
) and select Save in the right corner. -
Under Access, make note of your organization's API URL, for example
https://your-organization.api.kandji.io
.
Configure Kandji posture integration
Configure Tailscale to fetch the attributes from Kandji.
-
Open the Device management page of the Tailscale admin console.
-
Under the Device Posture Integrations section, select Connect next to the Kandji integration.
-
Enter your Kandji API URL, the URL you use to access the Kandji console.
-
Enter your API Token.
-
Select the Connect to Kandji button.
View the integration status
Check that the integration has run successfully.
In the Device Posture Integrations section of the Device management page, configured integrations and their status will show under Integrations. The time of the most recent sync will display on this page. If an error occurs while synchronizing, it will display on this page.
Check node attributes
After you configure Kandji posture integration, you can confirm that the new attributes are being written for your Tailscale nodes via the Machines page of the admin console.
- Open the Machines page of the Tailscale admin console.
- Select a machine you want to inspect.
- The attributes for the machine are in the Machine Details section. This should include the set of
kandji:
attributes listed previously.
You can also check node attributes via the Tailscale API.
Adjust Tailscale access rules
Once Kandji posture integration is configured and your devices have device posture attributes that reflects their signals as reported by Kandji, you can use that device posture attribute as part of your posture rules.
For example, to only allow access to tag:production
from devices that have an active Kandji agent, you can create a new posture and use it as part of a corresponding access rule:
"postures": {
"posture:trusted": [
"kandji:agentInstalled == true",
],
},
"acls": [
{
"action": "accept",
"src": ["autogroup:member"],
"srcPosture": ["posture:trusted"],
"dst": ["tag:production:*"],
},
]
Schedule
For each configured integration, Tailscale will aim to sync device posture attributes every 15 minutes, with a few exceptions:
- Adding a new integration, or changing configuration of an existing one, will trigger an out-of-schedule sync.
- If an integration fails due to authentication error (usually caused by invalid credentials), it will be paused for up to 24 hours.
Audit log events
The following audit log events are added for device posture.
Target | Action | Description |
---|---|---|
Integration | Create posture integration | A new posture integration was created |
Integration | Update posture integration | A posture integration was updated |
Integration | Removed posture integration | A posture integration was removed |
Node | Update node attribute | Device posture attributes for a node were changed |