Use device posture in access rules
Use the state of a person's managed device from CrowdStrike Falcon, Microsoft Intune, Jamf Pro or Kandji in attribute policies and in the risk score of a sign-in.
What it shows
- Connect the device tool in the portal, and test the lookup with one person.
- Write an attribute policy: a person may export a report only when their managed device is trusted and compliant.
- Ask LumoAuth for the decision with the access token of the person.
- Let the same state raise the risk score of a sign-in.
LumoAuth looks a person up in the device tool by email address, and reads the managed device that was last seen for that person. The answer is about the person, not about the device that sends the request. A person with one compliant laptop is compliant from every device.
Before you start
- Check that your plan includes device posture in the plans matrix.
- An account at one of the device tools, and an API credential there that may read devices.
- An API key with the scopes
admin:abac:writeandadmin:clients:write, for the setup script. Create it in the portal under Applications & developer tools, API keys. - The access token of a person who signed in through the application Acme Reports with the scope
abac:read. The setup script creates the application. The Express sign-in recipe shows how to sign in and read the token.
Connect the device tool. The steps are for Microsoft Intune, and the other tools differ only in the fields of the credential:
- In the portal, open Settings, Integrations, and select the tab Inbound signals & device posture.
- On the card Microsoft Intune, select Configure.
- Enter the Entra tenant ID, the Application (client) ID and the Client secret of an app registration. The registration needs the application permission
DeviceManagementManagedDevices.Read.All. - Switch on Use Microsoft Intune for device posture, and select Save configuration.
- Under Test with a user, enter the email address of a person with an enrolled device. The page shows the device, its operating system and the verdict.
| Variable | Value |
|---|---|
LUMOAUTH_URL | The address of LumoAuth: https://app.lumoauth.dev, or https://eu.app.lumoauth.dev for the EU region. |
LUMOAUTH_ORG_ID | Your organization, for example acme-corp. |
LUMOAUTH_API_KEY | An API key with the scopes admin:abac:write and admin:clients:write. Only the setup script uses it. |
USER_ACCESS_TOKEN | The access token of a person who signed in through the application of the setup script, with the scope abac:read. |
The setup script creates what the recipe needs, through the Admin API. You can run it again at any time.
node operations/device-posture/setup.mjs
setup.mjs
// Creates what the recipe needs: an attribute policy, and an application
// that may ask for the scope of the check. Run it again at any time.
//
// node operations/device-posture/setup.mjs
//
// The API key needs the scopes admin:abac:write and admin:clients:write. The
// person who created the key must be an administrator of the organization.
import { call, ensure, printEnv } from '../../_lib/admin.mjs';
// LumoAuth fills the `device` attributes from your device tool when a policy
// is evaluated. They describe the managed device that was last seen for the
// person, not the device that sends the request.
const policy = await ensure('/abac/policies', (p) => p.name === 'Export needs a compliant device', {
name: 'Export needs a compliant device',
description: 'A person may export a report when their managed device is trusted and compliant.',
resourceType: 'report',
action: 'export',
effect: 'allow',
priority: 100,
conditions: {
operator: 'AND',
conditions: [
{ subject: 'device.trusted', operator: 'equals', value: true },
{ subject: 'device.compliant', operator: 'equals', value: true },
],
},
});
// The check takes the access token of a signed-in person with the scope
// abac:read. A public application signs in with PKCE and has no secret.
const scopes = ['openid', 'profile', 'email', 'abac:read'];
const redirectUris = [`${process.env.APP_URL ?? 'http://localhost:3000'}/auth/callback`];
const application = await ensure('/admin/clients', (c) => c.name === 'Acme Reports', {
name: 'Acme Reports',
redirectUris,
scopes,
isConfidential: false,
});
await call('PATCH', `/admin/clients/${application.clientId}`, { redirectUris, scopes });
console.log(`The policy "${policy.name}" and the application "${application.name}" are ready.`);
printEnv({ LUMOAUTH_CLIENT_ID: application.clientId });
Code
Run each command from the recipes folder of the examples repository. Set the folder up once for your language. Every version below was run against a LumoAuth organization. The check ran against an organization with no device tool, so the answer was "denied". The answer "allowed" and the portal steps were not seen: they need an account at a device tool.
- curl
#!/bin/sh
# Ask LumoAuth whether the caller may export a report. The policy of the
# setup script allows it only with a compliant managed device.
#
# sh operations/device-posture/http/check.sh
#
# The script needs curl and jq.
set -eu
# The call takes the access token of a signed-in person, not an API key:
# the answer is about that person.
ANSWER=$(curl --silent --show-error "$LUMOAUTH_URL/orgs/$LUMOAUTH_ORG_ID/api/v1/abac/check" \
--header "Authorization: Bearer $USER_ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"resourceType": "report", "resourceId": "q3-revenue", "action": "export"}')
printf '%s\n' "$ANSWER" | jq -r '"export q3-revenue -> \(if .allowed then "allowed" else "denied" end) (\(.reason))"'
sh operations/device-posture/http/check.sh
Check the result
export q3-revenue -> denied (No matching policies - default deny)
- With no device tool, the
deviceattributes do not exist. The policy does not match, and the answer is "denied". - With a device tool, a person with a trusted and compliant device gets "allowed", and the reason names the policy. A person with no managed device, or with a device that is not compliant, gets "denied".
- LumoAuth keeps the answer of the device tool for 5 minutes for each person. A device that just became compliant can still read as not compliant for that time.
- For sign-in, open Security, Adaptive security, Detection signals. The signal Device posture adds to the risk score when the person has no managed device, or when the device is not trusted or not compliant. See Adaptive MFA and bot protection.
Limits
- The attributes do not prove which device sends the request. To bind a session to a managed device, require a passkey that lives on that device.
- A policy can read
device.known,device.trusted,device.compliant,device.os,device.name,device.sourceanddevice.lastSeen. - When the lookup at the device tool fails, the signal for sign-in adds nothing to the risk score.
- The address of the device tool must be a public HTTPS address.
- LumoAuth answers with a decision and a reason. Your app writes the message that tells the person what to fix.